diff options
Diffstat (limited to 'gdb')
351 files changed, 11724 insertions, 22759 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 15f7f1d..b2718d1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,2235 @@ +2003-11-11 David Carlton <carlton@kealia.com> + + * Merge with mainline; tag is carlton-dictionary-20031111-merge. + +2003-11-10 Michael Chastain <mec.gnu@mindspring.com> + + * MAINTAINERS: Change my e-mail address. + +2003-11-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (return_value): Replace "inval" and "outval" with + "readbuf" and "writebuf". + * ppcnbsd-tdep.c (ppcnbsd_return_value): Ditto. + * d10v-tdep.c (d10v_return_value): Ditto. + * ppc-tdep.h (ppc_sysv_abi_return_value): Ditto. + (ppc_sysv_abi_broken_return_value): Ditto. + (ppc64_sysv_abi_return_value): Ditto. + * ppc-sysv-tdep.c (do_ppc_sysv_return_value): Ditto. + (ppc_sysv_abi_return_value): Ditto. + (ppc_sysv_abi_broken_return_value): Ditto. + (ppc64_sysv_abi_return_value): Ditto. + * values.c (register_value_being_returned): Update call. + * stack.c (return_command): Update call. + * gdbarch.h, gdbarch.c: Re-generate. + + * target.h (struct target_ops): Order xfer buffer parameters "read + write" not "write read". + * bfd-target.c (target_bfd_xfer_partial): Update. + * remote.c (remote_xfer_partial): Update. + * inftarg.c (child_xfer_partial): Update. + * target.c (default_xfer_partial): Update. + (target_read_partial, target_write_partial): Update. + (debug_to_xfer_partial): Update. + + * arch-utils.h, arch-utils.c: Fix typo in comment. + + * arch-utils.c (deprecated_select_gdbarch_hack): Delete function. + (gdbarch_from_bfd): Call gdbarch_find_by_info. + (set_gdbarch_from_file): Call + "deprecated_current_gdbarch_select_hack". + +2003-11-09 Andrew Cagney <cagney@redhat.com> + + * arch-utils.c (gdbarch_update_p): New function. + * gdbarch.sh (gdbarch_update_p): Delete function. + (find_arch_by_info, gdbarch_find_by_info): New functions. + (deprecated_current_gdbarch_select_hack): New function. + * gdbarch.c: Re-generate. + + * gdbarch.sh (clear_gdbarch_swap): Delete function. + (swapout_gdbarch_swap): Delete function. + (swapin_gdbarch_swap): Delete function. + (init_gdbarch_swap): Delete function. + (initialize_non_multiarch): Delete function. + (current_gdbarch_swap_in_hack): New function. + (current_gdbarch_swap_out_hack): New function. + (current_gdbarch_swap_init_hack): New function. + * gdbarch.c: Re-generate. + + * gdbarch.sh (verify_gdbarch, gdbarch_dump): Rename "gdbarch" + parameter to "current_gdbarch". Add comment explaining why. + (TARGET_FLOAT_FORMAT: Pass "current_gdbarch" to default_double_format. + (TARGET_DOUBLE_FORMAT,TARGET_LONG_DOUBLE_FORMAT): Ditto. + * gdbarch.c: Re-generate. + + * config/s390/s390.mh (XM_FILE, XM_CLIBS): Delete macros. + * config/s390/nm-linux.h (KERNEL_U_ADDR): Define. + * config/s390/xm-linux.h: Delete file. + * config/m88k/xm-delta88v4.h: Delete stray. + + * Makefile.in (arch-utils.o): Update dependencies. + * arch-utils.c: Include "osabi.h". + (gdbarch_info_fill): New function. + * arch-utils.h (gdbarch_info_fill): Declare. + * gdbarch.sh (gdbarch_update_p): Call "gdbarch_info_fill". + * gdbarch.c: Re-generate. + +2003-11-09 Mark Kettenis <kettenis@gnu.org> + David S. Miller <davem@redhat.com> + + * glibc-tdep.c, glibc-tdep.h: New files. + * config/arm/linux.mt (TDEPFILES): Add glibc-tdep.o + * config/i386/linux.mt (TDEPFILES): Likewise. + * i386-linux-tdep.c (glibc-tdep.h): Include. + (find_minsym_and_objfile, skip_hurd_resolver): Delete. + (i386_linux_skip_solib_resolver): Call glibc_skip_solib_resolver. + * arm-linux-tdep.c (glibc-tdep.h): Include. + (find_minsym_and_objfile, skip_hurd_resolver): Delete. + (arm_linux_skip_solib_resolver): Call glibc_skip_solib_resolver. + * Makefile.in (ALLDEPFILES): Add glibc-tdep.c + (glibc_tdep_h): Define. + (glibc-tdep.o): Add dependencies. + (arm-linux-tdep.o): Update dependencies. + (i386-linux-tdep.o): Likewise. + +2003-11-09 Andrew Cagney <cagney@redhat.com> + + * config/mips/irix6.mh (NAT_FILE): Set to "nm-irix5.h". + * config/mips/nm-irix6.h: Delete file. + * config/mips/nm-linux.h: Update copyright. + (MIPS_GNULINUX_TARGET): Delete macro. + * config/mips/irix6.mh (XM_FILE): Set to "xm-irix5.h". + * config/mips/xm-irix6.h: Delete file. + * config/mips/linux.mh (XM_FILE): Delete definition. + * config/mips/xm-linux.h: Delete file. + +2003-11-09 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_return_value): New function. + (d10v_use_struct_convention): Delete function. + (d10v_store_return_value): Delete function. + (d10v_extract_struct_value_address): Delete function. + (d10v_gdbarch_init): Set "return_value" instead of + "extract_return_value", "store_return_value", + "extract_struct_value_address", and "use_struct_convention". + (RET1_REGNUM): Delete const. + +2003-11-09 Mark Kettenis <kettenis@gnu.org> + + From David S. Miller <davem@redhat.com>: + * gdbarch.sh (SKIP_SOLIB_RESOLVER): New method. + * gdbarch.c, gdbarch.h: Regenerated. + * arch-utils.c (generic_skip_solib_resolver): New function. + * arch-utils.h (generic_skip_solib_resolver): New prototype. + * infrun.c (SKIP_SOLIB_RESOLVER): Don't define. + +2003-11-07 Andrew Cagney <cagney@redhat.com> + + * top.c (print_gdb_version): Replace STREQ with strcmp. + * valops.c (value_struct_elt_for_reference): Ditto. + (value_struct_elt_for_reference): Ditto. + * symtab.c (gdb_mangle_name): Ditto. + (find_line_symtab): Ditto. + * symmisc.c (maintenance_print_symbols): Ditto. + * symfile.c (symbol_file_command): Ditto. + * stabsread.c (define_symbol, read_type): Ditto. + (cleanup_undefined_types, scan_file_globals): Ditto. + * solib.c (solib_map_sections): Ditto. + * solib-svr4.c (bfd_lookup_symbol): Ditto. + * rs6000-tdep.c (skip_prologue): Ditto. + * p-valprint.c (pascal_value_print): Ditto. + (pascal_object_is_vtbl_ptr_type): Ditto. + * objfiles.c (in_plt_section): Ditto. + * minsyms.c (lookup_minimal_symbol): Ditto. + (compact_minimal_symbols): Ditto. + (find_solib_trampoline_target): Ditto. + * mdebugread.c (parse_type): Ditto. + * language.c (set_language_command): Ditto. + (set_type_command, set_range_command): Ditto. + * f-lang.c (add_common_block): Ditto. + (add_common_block): Ditto. + (find_first_common_named): Ditto. + (patch_all_commons_by_name): Ditto. + * elfread.c (elf_locate_sections): Ditto. + (elf_locate_sections): Ditto. + (elfstab_offset_sections): Ditto. + * dwarf2read.c (dwarf2_locate_sections): Ditto. + * dbxread.c (add_old_header_file): Ditto. + (find_corresponding_bincl_psymtab): Ditto. + (read_dbx_symtab, process_one_symbol): Ditto. + * coffread.c (patch_opaque_types): Ditto. + * cli/cli-decode.c (delete_cmd): Ditto. + * cli/cli-cmds.c (pwd_command, list_command): Ditto. + * c-typeprint.c (c_type_print_base): Ditto. + * breakpoint.c (bpstat_stop_status): Ditto. + (clear_command, breakpoint_re_set_one): Ditto. + +2003-11-07 Andrew Cagney <cagney@redhat.com> + + * bcache.h: Update copyright. Add comments on bcache VS hashtab. + * bcache.c (struct bstring): Make "length" an unsigned short, add + "half_hash". + (struct bcache): Add "half_hash_error_count". + (bcache): Compute and save the "half_hash". Compare the + "half_hash" before comparing the length. Update + half_hash_error_count. + +2003-11-07 Andrew Cagney <cagney@redhat.com> + + * inftarg.c (child_xfer_partial): New function + (init_child_ops): Set "to_xfer_partial". + +2003-11-07 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-tdep.c (ppc_linux_init_abi): When 32-bit GNU/Linux, + set "return_value" instead of "use_struct_convention". + (ppc_linux_use_struct_convention): Delete function. + (ppc_linux_return_value): New function. + * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): New function. + (ppc_sysv_abi_broken_return_value): New function. + (do_ppc_sysv_return_value): Add "gdbarch" parameter. + (ppc64_sysv_abi_push_dummy_call): Add "gdbarch" parameter, drop + static. + (ppc_sysv_abi_extract_return_value): Delete function. + (ppc_sysv_abi_broken_extract_return_value): Delete function. + (ppc_sysv_abi_store_return_value): Delete function. + (ppc_sysv_abi_broken_store_return_value): Delete function. + (ppc_sysv_abi_use_struct_convention): Delete function. + (ppc64_sysv_abi_use_struct_convention): Delete function. + (ppc64_sysv_abi_extract_return_value): Delete function. + (ppc64_sysv_abi_store_return_value): Delete function. + * ppcnbsd-tdep.c (ppcnbsd_return_value): New function. + (ppcnbsd_init_abi): Set "return_value", instead of + "use_struct_convention", "extract_return_value", and + "store_return_value". + (ppcnbsd_use_struct_convention): Delete function. + * ppc-tdep.h (ppc64_sysv_abi_return_value): Declare. + (ppc_sysv_abi_return_value): Declare. + (ppc_sysv_abi_broken_return_value): Declare. + (ppc_sysv_abi_use_struct_convention): Delete. + (ppc_sysv_abi_store_return_value): Delete. + (ppc_sysv_abi_extract_return_value): Delete. + (ppc_sysv_abi_broken_store_return_value): Delete. + (ppc_sysv_abi_broken_extract_return_value): Delete. + (ppc64_sysv_abi_use_struct_convention): Delete. + (ppc64_sysv_abi_extract_return_value): Delete. + (ppc64_sysv_abi_store_return_value): Delete. + * rs6000-tdep.c (rs6000_gdbarch_init): For 32-bit and 64-bit SYSV, + set "return_value" instead of "extract_return_value", + "store_return_value", and "use_struct_convention". + +2003-11-07 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c (dwarf2_build_frame_info): Wrap comment. + + * fbsd-proc.c (read_mapping): Use sscanf and fgets instead of + fscanf. + +2003-11-07 Mark Kettenis <kettenis@gnu.org> + + * fbsd-proc.c: Fix formatting. + +2003-11-06 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (first_pseudo_regnum, iacc0_regnum, frv_num_pseudo_regs): + Define. + (new_variant): Set name for iacc0_regnum. + (frv_register_name): Accommodate pseudo-registers. + (frv_register_type): Add case for iacc0_regnum. + (frv_pseudo_register_read, frv_pseudo_register_write): New functions. + (frv_gdbarch_init): Set number of pseudo registers. Establish + pseudo-register read/write methods. + +2003-11-06 Andrew Cagney <cagney@redhat.com> + + * valops.c (destructor_name_p): Replace STREQN with strncmp. + * top.c (command_line_input): Ditto. + * objc-exp.y (yylex): Ditto. + * minsyms.c (prim_record_minimal_symbol_and_info): Ditto. + * jv-exp.y (yylex): Ditto. + * f-exp.y (yylex): Ditto. + * event-top.c (command_line_handler): Ditto. + * environ.c (get_in_environ): Ditto. + (set_in_environ): Ditto. + * dwarfread.c (handle_producer): Ditto. + * dbxread.c (process_one_symbol): Ditto. + * c-typeprint.c (c_type_print_base): Ditto. + * c-exp.y (yylex): Ditto. + +2003-11-06 Andrew Cagney <cagney@redhat.com> + Jeff Johnston <jjohnstn@redhat.com> + + * target.c (add_target): Only set "to_xfer_partial" when NULL. + (init_dummy_target): Set "to_xfer_partial". + +2003-11-06 Andrew Cagney <cagney@redhat.com> + + * stack.c (return_command): Warn when STRUCT_CONVENTION, and not + REGISTER_CONVENTION. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (insert_bp_location, allocate_bp_location): Make + static. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (remove_breakpoint): Take an bp_location + instead of a breakpoint argument. Check the bp_location's type. + Fix a reversed condition for hardware breakpoints. + + (insert_bp_location): Update call to remove_breakpoint. + (remove_breakpoints): Likewise. Use ALL_BP_LOCATIONS. + (remove_hw_watchpoints): Likewise. + (reattach_breakpoints): Likewise. + (detach_breakpoints): Likewise. + (delete_breakpoint): Likewise. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (mark_breakpoints_out): Use ALL_BP_LOCATIONS. + (beakpoint_init_inferior): Likewise. + (breakpoint_here_p): Likewise. Only check addresses for software + or hardware breakpoints. + (breakpoint_inserted_here_p): Likewise. + (breakpoint_thread_match): Likewise. Correct comment. + (bpstat_have_active_hw_watchpoints): Likewise. + (check_duplicates): Likewise. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoints.c (insert_bp_location): New function, broken out + from insert_breakpoints. Work on an bp_location instead of a + breakpoint. + (insert_breakpoints): Use it. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.h (struct bp_location): Add section. + (struct breakpoint): Remove section. + * breakpoint.c (insert_breakpoints, remove_breakpoint) + (breakpoint_here_p, breakpoint_inserted_here_p) + (breakpoint_thread_match, bpstat_stop_status, print_one_breakpoint) + (describe_other_breakpoints, check_duplicates, set_raw_breakpoint) + (clear_command, delete_breakpoint, breakpoint_re_set_one): Access + section through loc. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (read_memory_nobpt): Use ALL_BP_LOCATIONS + instead of ALL_BREAKPOINTS. Check for software breakpoints only. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (allocate_bp_location): Take bpt and bp_type + arguments. Initialize owner and type for the new breakpoint + location item. + (set_raw_breakpoint): Update call to allocate_bp_location. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.h (struct bp_location): Add a chain pointer. + * breakpoint.c (ALL_BP_LOCATIONS, ALL_BP_LOCATIONS_SAFE): New + macros. + (bp_location_chain): New variable. + (allocate_bp_location): New function. + (set_raw_breakpoint): Use it. + (delete_breakpoint): Remove ->loc from the bp_location_chain. + +2003-11-06 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.h (enum bp_loc_type, struct bp_location): New. + (struct breakpoint): Remove address, shadow_contents, inserted, + requested_address, and duplicate. Add a struct bp_location. + * breakpoint.c (condition_command, read_memory_nobpt) + (insert_breakpoints, remove_breakpoints, remove_hw_watchpoints) + (reattach_breakpoints, update_breakpoints_after_exec) + (detach_breakpoints, remove_breakpoint, mark_breakpoints_out) + (breakpoint_init_inferior, breakpoint_here_p) + (breakpoint_inserted_here_p, deprecated_frame_in_dummy) + (breakpoint_thread_match, bpstat_stop_status) + (bpstat_have_active_hw_watchpoints, print_one_breakpoint) + (describe_other_breakpoints, check_duplicates) + (make_breakpoint_permanent, create_thread_event_breakpoint) + (disable_breakpoints_in_shlibs, re_enable_berakpoints_in_shlibs) + (set_longjmp_resume_breakpoint, mention, create_breakpoints) + (watch_command_1, print_one_exception_catchpoint) + (clear_command, breakpoint_re_set_one): Adjust member accesses to + use the breakpoint's ->loc. + (set_raw_breakpoint): Likewise. Initialize ->loc. + (delete_breakpoint): Likewise. Free ->loc. + +2003-11-05 Andrew Cagney <cagney@redhat.com> + + * config/sparc/tm-sparc.h (FRAME_STRUCT_ARGS_ADDRESS): Delete + macro. + * config/m68k/tm-sun3.h (SIG_PC_FP_OFFSET): Delete macro. + * config/i386/tm-cygwin.h + (LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES): Delete macro. + * config/powerpc/tm-linux.h + (AT_SUBROUTINE_CALL_INSTRUCTION_TARGET): Delete macro. + (at_subroutine_call_instruction_target): Delete declaration. + * config/sparc/tm-sp64linux.h (GDB_PTRACE_REGS64): Delete macro. + * config/m68k/tm-sun3.h (SIG_SP_FP_OFFSET): Delete macro. + * config/ns32k/tm-ns32k.h (NUM_GENERAL_REGS): Delete macro. + + * xcoffread.c (find_linenos): Replace "sec_ptr" and "bfd" with + "struct bfd_section" and "struct bfd". + * target.h (struct section_table): Ditto. + * rs6000-nat.c (xcoff_relocate_core): Ditto. + * solib-svr4.c (elf_locate_base): Ditto. + * pa64solib.c (dld_cache_t): Ditto. + * objfiles.h (struct obj_section): Ditto. + * objfiles.c (add_to_objfile_sections): Ditto. + * exec.c (bfdsec_to_vmap): Ditto. + (add_to_section_table): Ditto. + (build_section_table): Ditto. + * corelow.c (get_core_register_section): Ditto. + * coffread.c (find_linenos): Ditto. + * elfread.c (elf_interpreter): Delete #if0'd function. + + * mips-tdep.c (mips_dump_tdep): Delete code prinint VX_NUM_REGS. + * config/sparc/tm-vxsparc.h (VX_NUM_REGS): Delete macro. + * config/mips/tm-vxmips.h (VX_NUM_REGS): Delete macro. + * config/m68k/tm-vx68.h (VX_NUM_REGS): Delete macro. + + * arch-utils.h (generic_cannot_extract_struct_value_address): + Delete declaration. + * wince.c (_initialize_wince): Fix multi-line string. + * ia64-tdep.c (floatformat_valid): Convert to ISO C. + +2003-11-05 Elena Zannoni <ezannoni@redhat.com> + + * top.c (execute_command): Fix broken logic for command execution + while inferior is running in async mode. + +2003-11-06 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c (execute_cfa_program): Mark register as + REG_SAVED_REG for DW_CFA_register opcode. + +2003-11-05 Mark Kettenis <kettenis@gnu.org> + + * amd64fbsd-tdep.c (amd64fbsd_sc_reg_offset): Adjust offset of + %rsp, %rip and %eflags to match ABI-change. + +2003-11-05 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-tdep.c (struct gdbarch_tdep): Remove os_ident field. + (ia64_gdbarch_init): Don't bother calculating the os. + Instead use the gdbarch_info struct and look at the osabi field. + Also use gdbarch_list_lookup_by_info() to look for a + candidate gdbarch. + +2003-11-05 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (frv_register_byte): Delete. + (frv_extract_return_value, frv_store_return_value) + (frv_extract_struct_value_address): Don't call frv_register_byte(). + Convert to non-deprecated form. + (frv_gdbarch_init): Don't call set_gdbarch_deprecated_register_byte(). + Convert calls to set_gdbarch_deprecated_extract_return_value(), + set_gdbarch_deprecated_store_return_value(), and + set_gdbarch_deprecated_extract_struct_value_address() into + non-deprecated forms. + +2003-11-05 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_dump_tdep): Do not print + PRINT_EXTRA_FRAME_INFO. + * config/sparc/tm-sparc.h (DEPRECATED_PRINT_EXTRA_FRAME_INFO): + Rename PRINT_EXTRA_FRAME_INFO. + * mips-tdep.c (mips_print_extra_frame_info): Delete function. + * config/mips/tm-mips.h (PRINT_EXTRA_FRAME_INFO): Delete macro. + (mips_print_extra_frame_info): Delete declaration. + * stack.c (frame_info): Use DEPRECATED_PRINT_EXTRA_FRAME_INFO. + +2003-11-05 Elena Zannoni <ezannoni@redhat.com> + + * coffread.c (coff_symtab_read): Remove passing of info parameter + to prim_record_minimal_symbol_and_info. + +2003-11-05 Elena Zannoni <ezannoni@redhat.com> + + * coffread.c (process_coff_symbol): Delete CXUX_TARGET macro use. + (decode_base_type): Delete ifdeffed out code. + +2003-11-04 Andrew Cagney <cagney@redhat.com> + + * symtab.c (find_active_alias): Delete function. + (lookup_block_symbol): Delete alias code. + * stabsread.c (resolve_live_range): Delete function. + (add_live_range): Delete function. + (resolve_symbol_reference): Delete function. + (define_symbol): Delete live range and alias code. + (scan_file_globals): Delete alias code. + * symtab.h (SYMBOL_RANGES): Delete macro. + (struct range_list): Delete structure. + (struct symbol): Delete field "ranges". + (SYMBOL_ALIASES): Delete macro. + (struct alias_list): Delete structure. + (struct symbol): Delete field "aliases". + +2003-11-04 Michael Snyder <msnyder@redhat.com> + + * MAINTAINERS: Remove myself as owner of breakpoints and + of sparc/solaris. + +2003-11-03 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_sh4_nofpu_register_name): New function. + (sh_sh4al_dsp_register_name): Ditto. + (sh4_nofpu_show_regs): Ditto. + (sh_gdbarch_init): Add cases for bfd_mach_sh4al_dsp, bfd_mach_sh4a, + bfd_mach_sh4_nofpu and bfd_mach_sh4a_nofpu. + +2003-11-03 Andrew Cagney <cagney@redhat.com> + + * bcache.c: Include "gdb_assert.h". + (struct bcache): Add fields "expand_count" and + "expand_hash_count". + (expand_hash_table): Update the expand counts. + (print_bcache_statistics): Use XCALLOC, not alloca. Print stats + on object sizes and hashes. + * Makefile.in (bcache.o): Update dependencies. + +2003-11-03 Andrew Cagney <cagney@redhat.com> + + * exec.c (xfer_memory): Eliminate xfer_fn. + +2003-10-31 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (gdb_assert.h, sim-regno.h, gdb/sim-frv.h) + (opcodes/frv-desc.h): Include. + (iacc0h_regnum, iacc0l_regnum): Define. + (last_spr_regnum, frv_num_regs): Update. + (new_variant): Don't supply default names for holes in the SPRs. + Supply names for iacc0h_regnum and iacc0l_regnum. + (frv_register_type): Use symbolic constants first_fpr_regnum and + last_fpr_regnum instead of hardcoded constants 64 and 127. Use + builtin_type_int instead of builtin_type_int32. + (frv_register_sim_regno): New function. + (frv_gdbarch_init): Call set_gdbarch_register_sim_regno(). + * Makefile.in (gdb_sim_frv_h): Define. + (frv-tdep.o): Update dependencies. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * avr-tdep.c (avr_frame_this_id): Do not call + deprecated_inside_entry_file. + * m68hc11-tdep.c (m68hc11_frame_this_id): Ditto. + * m32r-tdep.c (m32r_frame_this_id): Ditto. + * d10v-tdep.c (d10v_frame_this_id): Ditto. + * arm-tdep.c (arm_prologue_this_id): Ditto. + * alpha-tdep.c (alpha_heuristic_frame_this_id): Ditto. + +2003-10-31 Jim Blandy <jimb@redhat.com> + + * elfread.c (elf_symtab_read): Allocate correct number of tail + elements to sectinfo structure. (Fix from Woody LaRue.) + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * stack.c (return_command): Use get_frame_type, instead of + CALL_DUMMY_HAS_COMPLETED. + * inferior.h (CALL_DUMMY_HAS_COMPLETED): Delete definition. + * config/pa/tm-hppa.h (CALL_DUMMY_HAS_COMPLETED): Delete macro. + +2003-10-31 Mark Kettenis <kettenis@gnu.org> + + * x86-64-linux-tdep.c (x86_64_linux_sc_reg_offset): Don't + explicitly specify size of array. + (x86_64_linux_init_abi): Use ARRAY_SIZE to initialize + TDEP->sc_num_regs. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * s390-tdep.c (s390_cannot_extract_struct_value_address): New + function. + (s390_gdbarch_init): Set extract_struct_value_address. + * arch-utils.c (generic_cannot_extract_struct_value_address): + Delete function. + * arch-utils.h (generic_cannot_extract_struct_value_address): + Delete definition. + +2003-10-31 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-nat.c (fetch_core_registers): Remove. + (linux_elf_core_fns): Remove. + (_initialize_i386_linux_nat): Remove. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * solib-svr4.c: Update copyright. Include "bfd-target.h" and + "exec.h". + (exec_entry_point): New function. + (enable_break): Create a "tmp_bfd_target", use that and + entry_point_address when computing the relocation offset. + (svr4_relocate_main_executable): Ditto with exec_bfd and exec_ops. + * Makefile.in (solib-svr4.o): Update dependencies. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * defs.h (XZALLOC): Define. + * target.h (struct target_ops): Add "to_data"; + * bfd-target.h, bfd-target.c: New files. + * Makefile.in (SFILES): Add "bfd-target.c". + (COMMON_OBS): Add "bfd-target.o". + (bfd-target.o): Specify dependencies. + (bfd_target_h): Define. + * defs.h (XZALLOC): Define. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * rs6000-tdep.c (rs6000_gdbarch_init): For 64-bit ABI, set + adjust_breakpoint_address. + * Makefile.in (ppc-sysv-tdep.o): Add $(target_h). + * ppc-tdep.h (ppc64_sysv_abi_adjust_breakpoint_address): Declare. + * ppc-sysv-tdep.c: Include "target.h". Update copyright. + (ppc64_sysv_abi_adjust_breakpoint_address): New function. + +2003-10-31 Andrew Cagney <cagney@redhat.com> + + * target.h (struct target_ops): Replace "to_read_partial" and + "to_write_partial" with "to_xfer_partial". Update comments. + * target.c (debug_to_write_partial): Delete function. + (debug_to_xfer_partial): Replace debug_to_read_partial. + (add_target, update_current_target, setup_target_debug): Set + "to_xfer_partial" instead of "to_read_partial" and + "to_write_partial". + (default_xfer_partial): Replace "default_write_partial". + (default_read_partial): Delete. + (target_read_partial, target_write_partial): Call + "to_xfer_partial". + * remote.c (init_remote_ops): Set "to_xfer_partial". + (init_remote_async_ops): Ditto. + (remote_xfer_partial): Replace "remote_read_partial". + +2003-10-31 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_supply_fpregset): Support floating-point + registers in `fxsave' format. + (i386_regset_from_core_section): Deal with ".reg-xfp" sections. + +2003-10-30 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-tdep.c (i386_linux_gregset_reg_offset): New variable. + (i386_linux_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs and tdep->sizeof_gregset. + + * i386-linux-tdep.c (i386_linux_sc_reg_offset): Don't explicitly + specify size of array. + (i386_linux_init_abi): Remove initialization of + TDEP->num_xmm_regs. Use I386_LINUX_NUM_REGS for number of + registers. Use ARRAY_SIZE to initialize TDEP->sc_num_regs. + + * config/i386/fbsd64.mt (TDEPFILES): Add corelow.o. + * config/i386/fbsd64.mh (NATDEPFILES): Remove corelow.o and + core-regset.o. + + * fbsd-proc.c (fbsd_make_corefile_notes): Put a "FreeBSD" label in + the ELF header. + +2003-10-29 Mark Kettenis <kettenis@gnu.org> + + * config/i386/fbsd.mt (TDEPFILES): Add corelow.o. + * config/i386/fbsd.mh (NATDEPFILES): Remove corelow.o and + core-regset.o. + + * fbsd-proc.c (fbsd_make_corefile_notes): Remove unecessary casts. + + * corelow.c: Include "arch-utils.h", "regset.h" and + "gdb_assert.h". + (core_gdbarch): New variable. + (sniff_core_bfd): Don't sniff if we have support for register sets + in CORE_GDBARCH. + (core_close): Reset CORE_GDBARCH. + (core_open): Initialize CORE_GDBARCH. + (get_core_register_section): Use register sets if they are + supported by CORE_GDBARCH. + (get_core_registers): Don't print error message if we have support + for register sets in CORE_GDBARCH. + +2003-10-29 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Instead of the + default PPC machine, register 32-bit and 64-bit PPC, and rs6k. + +2003-10-29 Mark Kettenis <kettenis@gnu.org> + + * objfiles.h (clear_objfile_data): New prototype. + * objfiles.c (clear_objfile_data): New function. + * symfile.c (reread_symbols): Clear per-objfile data. + +2003-10-28 Jeff Johnston <jjohnstn@redhat.com> + + * symfile.c (symbol_file_add_with_addrs_or_offsets): Switch to use + printf_unfiltered instead of printf_filtered for output messages. + (add_symbol_file_command): Ditto. + (reread_symbols): Ditto. + (overlay_auto_command): Ditto. + (overlay_manual_command): Ditto. + (overlay_off_command): Ditto. + +2003-10-27 Mark Kettenis <kettenis@gnu.org> + + * arch-utils.c (deprecated_select_gdbarch_hack): New function. + (gdbarch_from_bfd): New function. + (set_gdbarch_from_file): Re-implement using gdbarch_from_bfd and + deprecated_select_gdbarch_hack. + * arch-utils.h (gdbarch_from_bfd): New prototype. + +2003-10-27 Andrew Cagney <cagney@redhat.com> + + * osabi.c (gdbarch_init_osabi): Use info.bfd_arch_info instead of + arch_info. Use warning instead of fprintf_filtered. Do not use + deprecated bfd_printable_arch_mach. + +2003-10-26 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (frv_register_raw_size, frv_register_virtual_size): + Delete. + (frv_register_type): Rename from frv_register_virtual_type. Add + ``struct gdbarch *'' parameter. + (frv_gdbarch_init): Delete calls to the following functions: + set_gdbarch_deprecated_size(), + set_gdbarch_deprecated_register_bytes(), + set_gdbarch_deprecated_register_raw_size(), + set_gdbarch_deprecated_max_register_raw_size(), + set_gdbarch_deprecated_register_virtual_size(), + set_gdbarch_deprecated_max_register_virtual_size(), + set_gdbarch_deprecated_register_virtual_size(), + set_gdbarch_deprecated_register_virtual_type(). + Add call to function set_gdbarch_register_type(). + +2003-10-26 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.h (FCS_REGNUM, FCOFF_REGNUM, FDS_REGNUM, + FDOFF_REGNUM): Remove defines. + * win32-nat.c (do_child_fetch_inferior_registers): Include + "i387-tdep.h". + (do_child_fetch_inferior_registers): Use I387_FISEG_REGNUM and + I387_FOP_REGNUM instead of FCS_REGNUM and FOP_REGNUM. Define and + undefine I387_ST0_REGNUM. + + * i386-tdep.h (FPU_REG_RAW_SIZE): Remove define. + * x86-64-tdep.c (x86_64_store_return_value): Use + I386_MAX_REGISTER_SIZE instead of FPU_REG_RAW_SIZE. + + Change register numbers to enumartion values. + * i386-tdep.h (enum i386_regnum): New. + (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, + I386_EBP_REGNUM, I386_IP_REGNUM, I386_EFLAGS_REGNUM, + I386_ST0_REGNUM): Remove defines. + * i386-tdep.c (I386_EBX_REGNUM, I386_ECX_REGNUM, I386_ESI_REGNUM, + I386_EDI_REGNUM): Remove defines. + +2003-10-24 Andrew Cagney <cagney@redhat.com> + + * target.c: Include "gdbcore.h". + (get_target_memory, get_target_memory_unsigned): New functions. + * target.h (get_target_memory, get_target_memory_unsigned): Declare. + * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): + Use get_target_memory_unsigned. + * Makefile.in (target.o): Update dependencies. + +2003-10-24 Andrew Cagney <cagney@redhat.com> + + * osabi.c (gdbarch_init_osabi): Fix typos, and "fortunatly"[sic]. + * PROBLEMS, arch-utils.c, cli-out.c, command.h: Ditto. + * complaints.c, cris-tdep.c, disasm.c, dwarf2-frame.c: Ditto. + * frame.c, frame.h, infcall.c, infcmd.c, infrun.c: Ditto. + * kod.c, mips-tdep.c, regcache.c, regcache.h, remote.c: Ditto. + + * osabi.c (gdbarch_init_osabi): Add comment on 32-bit vs 64-bit. + (can_run_code_for): Use the OO term "singleton". + +2003-10-23 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (stack.o): Add $(regcache_h). + * stack.c: Include "regcache.h" + (return_command): Rewrite. Use get_frame_id and + get_selected_frame. Eliminate "deprecated_selected_frame". Warn + about unhandled return-values. + * value.h (set_return_value): Delete declaration. + * values.c (set_return_value): Delete function. + +2003-10-23 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-tdep.c: (ia64_frame_cache): Add new prev_cfm field. + (pseudo_regs): Add comment regarding register stack registers. + (ia64_alloc_frame_cache): Initialize new prev_cfm field to 0. + (floatformat_valid): New static routine. + (floatformat_ia64_ext): Add name field and set up is_valid routine + to floatformat_valid(). + (examine_prologue): For the previous cfm, use + frame_unwind_register() + if the cfm is not stored in a register-stack register. Save the + previous cfm value in the prev_cfm field. Add debug output. + (ia64_frame_this_id): Use frame_id_build_special() to also register + the bsp. Add debug output. + (ia64_sigtramp_frame_this_id): Ditto. + (ia64_frame_prev_register): Look at cache saved_regs for a few more + registers and also add some checks for framelessness before accepting + current register values for fields such as return address. For cfm, + use the cached prev_cfm field if available. Add comment to explain + PSR logic. Add debug output. + (ia64_sigtramp_frame_init_saved_regs): Save the bsp and sp addresses + as part of initialization. + (ia64_sigtramp_frame_cache): Hard-code stack size as it can't be + calculated. Cache the bsp and cfm values. + (ia64_sigtramp_frame_prev_register): Add logic to this routine out + instead of using ia64_frame_prev_register() which doesn't expect most + registers to be saved. The saved values for bsp and sp + can be taken from the cache. Add debug output. + (ia64_push_dummy_call): Use frame_id_build_special() to also register + the bsp. + +2003-10-23 Jim Blandy <jimb@redhat.com> + + * osabi.c (gdbarch_init_osabi): A handler is okay if it's for an + architecture the current arch can run code for --- but not if it's + a superset. + (can_run_code_for): New function. + +2003-10-22 James E Wilson <wilson@specifixinc.com> + + * MAINTAINERS: Move myself from paper trail section back to write + after approval section. + +2003-10-22 Andrew Cagney <cagney@redhat.com> + + * exec.h: New file. + * win32-nat.c: Include "exec.h". + * solib.c: Include "exec.h". + * target.h (build_section_table): Delete declaration. + * somsolib.c: Include "exec.h". + (exec_ops): Delete extern declaration. + * rs6000-nat.c: Update copyright. Include "exec.h". + (exec_ops): Delete extern declaration. + * pa64solib.c: Update copyright. Include "exec.h". + (exec_ops): Delete extern declaration. + * exec.c: Update copyright. Include "exec.h". + * corelow.c: Update dependencies. Include "exec.h". + * Makefile.in (exec_h): Define. + (exec.o, somsolib.o): Update dependencies. + (pa64solib.o, corelow.o): Update dependencies. + +2003-10-22 Andrew Cagney <cagney@redhat.com> + + * target.c: Include "gdb_assert.h" (target_read): Call + "target_read_partial", not "target_write_partial". + (default_read_partial, default_write_partial): New function. + (target_read_partial, target_write_partial): Simplify, assume that + there is always a read/write method. + (update_current_target, add_target): Always set "to_read_partial" + and "to_write_partial". + (target_write, target_read): Fail on a zero byte transfer. + * Makefile.in (target.o): Update dependencies. + * target.h: Update copyright date. + (target_object): Fix typo. + +2003-10-22 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (convert_from_func_ptr_addr): Convert to a pure + multi-arch method, add "targ" parameter. + (struct target_ops): Declare. + * gdbarch.h, gdbarch.c: Re-generate. + * Makefile.in (c-valprint.o): Update dependencies. + * arch-utils.h: Update copyright. + (convert_from_func_ptr_addr_identity): Declare. + * arch-utils.c (convert_from_func_ptr_addr_identity): New function. + * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. + * rs6000-tdep.c (rs6000_convert_from_func_ptr_addr): Upate. + * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Update. + * infcall.c (find_function_addr, call_function_by_hand): Update. + * c-valprint.c: Include "target.h". + (print_function_pointer_address): Update. + +2003-10-22 Andrew Cagney <cagney@redhat.com> + + * target.c (target_close): New function. + (debug_to_close): Use "target_close". + (push_target): Use "target_close". + (unpush_target): Use "target_close". + (pop_target): Use "target_close". + * target.h (struct target_ops): Add "to_xclose". + (target_open): Delete macro. Move comment to "to_open". + (target_close): Replace macro with function that takes a target. + * top.c (quit_target): Pass "current_target" to "target_close". + +2003-10-21 Elena Zannoni <ezannoni@redhat.com> + + * minsyms.c (lookup_minimal_symbol_text): Remove unused parameter. + Remove SOFUN_ADDRESS_MAYBE_MISSING ifdeffed code. + * symtab.h (lookup_minimal_symbol_text): Update. + * breakpoint.c (create_overlay_event_breakpoint, + create_longjmp_breakpoint): Update callers. + * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Update caller. + * symtab.c (find_pc_sect_line): Ditto. + +2003-10-21 Andrew Cagney <cagney@redhat.com> + + * target.c (errno): Delete extern declaration. + +2003-10-20 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-tdep.c: Change all occurrences of + DEPRECATED_REGISTER_RAW_SIZE to use register_size() instead. + (ia64_frame_prev_register): Minor whitespace change. + +2003-10-20 Michael Chastain <mec@shout.net> + + * config/djgpp/fnchange.lst: Add lines for: + sim/testsuite/sim/frv/interrupts/Ipipe-fr400.cgs, + sim/testsuite/sim/frv/interrupts/Ipipe-fr500.cgs, + sim/testsuite/sim/frv/interrupts/badalign-fr550.cgs, + sim/testsuite/sim/frv/interrupts/compound-fr550.cgs, + sim/testsuite/sim/frv/interrupts/data_store_error-fr550.cgs, + sim/testsuite/sim/frv/interrupts/fp_exception-fr550.cgs, + sim/testsuite/sim/frv/interrupts/insn_access_error-fr550.cgs. + +2003-10-20 Andrew Cagney <cagney@redhat.com> + + * values.c (register_value_being_returned): Update comments. Use + "gdbarch_return_value" when available. + (using_struct_return): Ditto. + (set_return_value): Ditto. Use "gdbarch_return_value" when + available.. Print a warning, and not an error, when an unhandled + return type is encountered. + * infcmd.c: Include "gdb_assert.h". + (print_return_value): When gdbarch_return_value_p, and using + struct return, assume that the value is not available. + * defs.h (return_value_convention): Define. + * gdbarch.sh (gdbarch_return_value): New predicate method. + * gdbarch.h, gdbarch.c: Re-generate + * ppc-sysv-tdep.c (return_value_convention): Delete definition. + +2003-10-20 Andrew Cagney <cagney@redhat.com> + + * symtab.c: Replace "struct sec" with "struct bfd_section". + * objfiles.c, linespec.c, blockframe.c, block.c: Ditto. + +2003-10-19 Michael Chastain <mec@shout.net> + + * config/djgpp/fnchange.lst: Add lines for: + gdb/amd64nbsd-nat.c, gdb/amd64nbsd-tdep.c, + gdb/i386fbsd-nat.c, gdb/i386fbsd-tdep.c, + gdb/sparc64fbsd-nat.c, gdb/sparc64bsd-tdep.c. + +2003-10-19 Mark Kettenis <kettenis@gnu.org> + + * amd64fbsd-nat.c (fetch_inferior_registers, + store_inferior_registers): Remove functions. + * config/i386/fbsd64.mh (NATDEPFILES): Add amd64bsd-nat.o. + +2003-10-18 Mark Kettenis <kettenis@gnu.org> + + Add NetBSD/amd64 native configuration: + * x86-64-tdep.h (amd64nbsd_r_reg_offset): Add extern declarations. + * amd64nbsd-tdep.c: New file. + * amd64nbsd-nat.c: New file. + * amd64bsd-nat.c: New file. + * config/i386/nbsd64.mh: New file. + * config/i386/nbsd64.mt: New file. + * configure.host: Add x86_64-*-netbsd*. + * configure.tgt: Add x86_64-*-netbsd*. + * Makefile.in (amd64bsd-nat.o, amd64nbsd-nat.o, amd64nbsd-tdep.o): + New targets. + * NEWS (New native configurations): Mention NetBSD/amd64. + +2003-10-17 Michael Chastain <mec@shout.net> + + * config/djgpp/fnchange.lst: Remove dead lines for: + bfd/elf32-i386qnx.c, bfd/elf32-ppcqnx.c, bfd/elf32-shqnx.c, + bfd/elf32-sh-lin.c, bfd/elf32-sh-nbsd.c, bfd/elf32-sh64-nbsd.c, + bfd/elf64-alpha-fbsd.c, bfd/elf64-sh64-nbsd.c, + gdb/alphanbsd-nat.c, gdb/config/i386/tm-i386mk.h, + gdb/config/i386/tm-i386v42mp.h, gdb/config/i386/xm-i386mach.h, + gdb/config/i386/xm-i386mk.h, gdb/config/i386/xm-i386v32.h, + gdb/config/m68k/apollo68v.mh, gdb/config/m68k/nm-apollo68v.h, + gdb/config/m68k/xm-apollo68v.h, gdb/config/m88k/tm-delta88v4.h, + gdb/config/mips/tm-bigmips64.h, gdb/config/mips/tm-embed64.h, + gdb/config/mips/tm-embedl.h, gdb/config/mips/tm-embedl64.h, + gdb/config/mips/tm-vr4300el.h, gdb/config/mips/tm-vr4xxxel.h, + gdb/config/mips/tm-vr5000el.h, gdb/config/sparc/tm-sparclet.h, + gdb/config/sparc/tm-sparclite.h, + gdb/gdbtk/generic/ChangeLog-2001, + gdb/gdbtk/library/ChangeLog-2001, gdb/remote-adapt.c, + gdb/remote-eb.c, gdb/remote-mm.c, gdb/remote-nrom.c, + gdb/remote-udi.c, gdb/remote-vx29k.c, gdb/remote-vx960.c, + gdb/sparclet-rom.c, gdb/sparclet-stub.c, + gdb/testsuite/gdb.mi/mi0-var-block.exp, + gdb/testsuite/gdb.mi/mi0-var-child.exp, + gdb/testsuite/gdb.mi/mi0-var-cmd.exp, + gdb/testsuite/gdb.mi/mi0-var-display.exp, + itcl/iwidgets3.0.0/demos/extfileselectionbox, + itcl/iwidgets3.0.0/demos/extfileselectiondialog, + itcl/iwidgets3.0.0/demos/fileselectionbox, + itcl/iwidgets3.0.0/demos/fileselectiondialog, + itcl/iwidgets3.0.0/demos/html/buttonbox.n.html, + itcl/iwidgets3.0.0/demos/html/canvasprintbox.n.html, + itcl/iwidgets3.0.0/demos/html/canvasprintdialog.n.html, + itcl/iwidgets3.0.0/demos/html/combobox.n.html, + itcl/iwidgets3.0.0/demos/html/dialog.n.html, + itcl/iwidgets3.0.0/demos/html/dialogshell.n.html, + itcl/iwidgets3.0.0/demos/html/entryfield.n.html, + itcl/iwidgets3.0.0/demos/html/feedback.n.html, + itcl/iwidgets3.0.0/demos/html/fileselectionbox.n.html, + itcl/iwidgets3.0.0/demos/html/fileselectiondialog.n.html, + itcl/iwidgets3.0.0/demos/html/hyperhelp.n.html, + itcl/iwidgets3.0.0/demos/html/iwidgets2.2.0UserCmds.html, + itcl/iwidgets3.0.0/demos/html/labeledwidget.n.html, + itcl/iwidgets3.0.0/demos/html/menubar.n.html, + itcl/iwidgets3.0.0/demos/html/messagedialog.n.html, + itcl/iwidgets3.0.0/demos/html/notebook.n.html, + itcl/iwidgets3.0.0/demos/html/optionmenu.n.html, + itcl/iwidgets3.0.0/demos/html/panedwindow.n.html, + itcl/iwidgets3.0.0/demos/html/promptdialog.n.html, + itcl/iwidgets3.0.0/demos/html/pushbutton.n.html, + itcl/iwidgets3.0.0/demos/html/radiobox.n.html, + itcl/iwidgets3.0.0/demos/html/scrolledcanvas.n.html, + itcl/iwidgets3.0.0/demos/html/scrolledframe.n.html, + itcl/iwidgets3.0.0/demos/html/scrolledhtml.n.html, + itcl/iwidgets3.0.0/demos/html/scrolledlistbox.n.html, + itcl/iwidgets3.0.0/demos/html/scrolledtext.n.html, + itcl/iwidgets3.0.0/demos/html/selectionbox.n.html, + itcl/iwidgets3.0.0/demos/html/selectiondialog.n.html, + itcl/iwidgets3.0.0/demos/html/shell.n.html, + itcl/iwidgets3.0.0/demos/html/spindate.n.html, + itcl/iwidgets3.0.0/demos/html/spinint.n.html, + itcl/iwidgets3.0.0/demos/html/spinner.n.html, + itcl/iwidgets3.0.0/demos/html/spintime.n.html, + itcl/iwidgets3.0.0/demos/html/tabnotebook.n.html, + itcl/iwidgets3.0.0/demos/html/tabset.n.html, + itcl/iwidgets3.0.0/demos/html/toolbar.n.html, + itcl/iwidgets3.0.0/demos/scrolledcanvas, + itcl/iwidgets3.0.0/demos/scrolledframe, + itcl/iwidgets3.0.0/demos/scrolledhtml, + itcl/iwidgets3.0.0/demos/scrolledlistbox, + itcl/iwidgets3.0.0/demos/scrolledtext, + itcl/iwidgets3.0.0/demos/selectionbox, + itcl/iwidgets3.0.0/demos/selectiondialog, + itcl/iwidgets3.0.0/doc/canvasprintbox.n, + itcl/iwidgets3.0.0/doc/canvasprintdialog.n, + itcl/iwidgets3.0.0/doc/extfileselectionbox.n, + itcl/iwidgets3.0.0/doc/extfileselectiondialog.n, + itcl/iwidgets3.0.0/doc/fileselectionbox.n, + itcl/iwidgets3.0.0/doc/fileselectiondialog.n, + itcl/iwidgets3.0.0/doc/scopedobject.n.backup, + itcl/iwidgets3.0.0/doc/scrolledcanvas.n, + itcl/iwidgets3.0.0/doc/scrolledframe.n, + itcl/iwidgets3.0.0/doc/scrolledhtml.n, + itcl/iwidgets3.0.0/doc/scrolledlistbox.n, + itcl/iwidgets3.0.0/doc/scrolledtext.n, + itcl/iwidgets3.0.0/doc/selectionbox.n, + itcl/iwidgets3.0.0/doc/selectiondialog.n, + itcl/iwidgets3.0.0/generic/canvasprintbox.itk, + itcl/iwidgets3.0.0/generic/canvasprintdialog.itk, + itcl/iwidgets3.0.0/generic/extfileselectionbox.itk, + itcl/iwidgets3.0.0/generic/extfileselectiondialog.itk, + itcl/iwidgets3.0.0/generic/fileselectionbox.itk, + itcl/iwidgets3.0.0/generic/fileselectiondialog.itk, + itcl/iwidgets3.0.0/generic/scrolledcanvas.itk, + itcl/iwidgets3.0.0/generic/scrolledframe.itk, + itcl/iwidgets3.0.0/generic/scrolledhtml.itk, + itcl/iwidgets3.0.0/generic/scrolledlistbox.itk, + itcl/iwidgets3.0.0/generic/scrolledtext.itk, + itcl/iwidgets3.0.0/generic/scrolledwidget.itk, + itcl/iwidgets3.0.0/generic/selectionbox.itk, + itcl/iwidgets3.0.0/generic/selectiondialog.itk, + itcl/iwidgets3.0.0/tests/canvasprintbox.test, + itcl/iwidgets3.0.0/tests/canvasprintdialog.test, + itcl/iwidgets3.0.0/tests/extfileselectionbox.test, + itcl/iwidgets3.0.0/tests/extfileselectiondialog.test, + itcl/iwidgets3.0.0/tests/fileselectionbox.test, + itcl/iwidgets3.0.0/tests/fileselectiondialog.test, + itcl/iwidgets3.0.0/tests/scrolledcanvas.test, + itcl/iwidgets3.0.0/tests/scrolledframe.test, + itcl/iwidgets3.0.0/tests/scrolledhtml.test, + itcl/iwidgets3.0.0/tests/scrolledlistbox.test, + itcl/iwidgets3.0.0/tests/scrolledtext.test, + itcl/iwidgets3.0.0/tests/selectionbox.test, + itcl/iwidgets3.0.0/tests/selectiondialog.test, + itcl/iwidgets3.0.0/unix/iwidgets.tcl.in, + itcl/iwidgets3.0.0/unix/pkgIndex.tcl.in, + tix/docs/Release-4.1.0.html, tix/docs/Release-4.1.0.txt, + tix/docs/Release-4.1a2.html, tix/docs/Release-4.1a2.txt, + tix/docs/Release-4.1a3.html, tix/docs/Release-4.1a3.txt, + tix/docs/Release-4.1b1.html, tix/docs/Release-4.1b1.txt, + tix/docs/Release-4.1b2.html, tix/docs/Release-4.1b2.txt, + tix/tixConfig.sh.in, tix/unix/tk4.2/pkgIndex.tcl.in, + tix/unix/tk8.0/pkgIndex.tcl.in, tix/unix/tk8.0/pkgIndex.tcl.in, + tix/unix/tk8.1/pkgIndex.tcl.in, tix/win/tkConsole41.c, + tix/win/tkConsole42.c, tix/win/tkConsole80a1.c, + tix/win/tkConsole80b1.c, tix/win/tkConsole81.c, tk/doc/tk4.0.ps, + tk/mac/tkMacProjects.sit.hqx. + +2003-10-17 Andrew Cagney <cagney@redhat.com> + + * target.c (target_section_by_addr): New function. + (do_xfer_memory): Use "target_section_by_addr". + * target.h (target_section_by_addr): Declare. + + * target.h (struct target_ops): Add "to_read_partial" and + "to_write_partial", delete "to_query". + (target_read_partial, target_write_partial): Declare. + (target_read, target_write): Declare. + (target_query): Delete macro. + * target.c (target_read_partial): New function. + (target_write_partial, target_read, target_write): New function. + (update_current_target): Delete inheritance of "to_query". Add + comments about "to_read_partial" and "to_write_partial". + (debug_to_partial_read, debug_to_partial_write): New functions. + (debug_to_query): Delete function. + (setup_target_debug): Set "to_read_partial" and "to_write_partial" + instead of "to_query". + * remote.c (remote_read_partial): Replace "remote_query". + (init_remote_ops): Set "to_read_partial" instead of "to_query". + (init_remote_async_ops): Ditto. + * kod.c (gdb_kod_query): Make "bufsize" a LONGEST. Use + "target_read_partial" instead of "target_query". + * avr-tdep.c (avr_io_reg_read_command): Make "bufsize" a LONGEST. + Use "target_read_partial" instead of "target_query". + +2003-10-17 Jeff Johnston <jjohnstn@redhat.com> + + * frame.h (struct frame_id): Add new field: special_addr. + (frame_id_build_special): New prototype. + * frame.c (frame_id_build_special): New function. + (frame_id_build): Change to call frame_id_build_special(). + (frame_id_eq): Change to also test special_addr field. + (frame_id_inner): Update comment. + +2003-10-17 Andrew Cagney <cagney@redhat.com> + + * target.c (update_current_target): Perform the target cleanup. + Put the target stack beneath the squashed "current_target". + (add_target): Delete disabled call to "cleanup_target". + (cleanup_target): Delete function. + (push_target, unpush_target): Do not call "cleanup_target". + +2003-10-17 Andrew Cagney <cagney@redhat.com> + + * target.c (target_stack): Change to a static target_ops. + (update_current_target): Walk the "struct target_ops" stack. + (pop_target, do_xfer_memory, target_info): Ditto. + (find_target_beneath): Ditto. + (push_target): Rewrite to use the "struct target_ops" stack. + (unpush_target): Ditto. + * target.h (struct target_stack_item): Delete definition. + (target_stack): Delete declaration. + (struct target_ops): Add field "beneath". + +2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com> + + * gdb/config/h8300/tm-h8300.h (h8300_normal_mode): Add external + declaration. + * gdb/h8300-tdep.c (BINWORD): Update BINWORD for h8300_normal_mode + (h8300_examine_prologue): Use h8300_normal_mode flag + (h8300_gdbarch_init): Set architecture info for normal mode + +2003-10-16 Daniel Jacobowitz <drow@mvista.com> + + * remote.c (remote_protocol_vcont): New variable. + (set_remote_protocol_vcont_packet_cmd): New function. + (show_remote_protocol_vcont_packet_cmd): New function. + (init_all_packet_configs): Handle remote_protocol_vcont. + (remote_vcont_probe): New function. + (remote_vcont_resume): New function. + (remote_resume): Use it. + (remote_async_resume): Call remote_resume. + (_initialize_remote): Add verbose-resume packet commands. + +2003-10-16 Andrew Cagney <cagney@redhat.com> + + * infrun.c (handle_inferior_event): Add comment about + "frame_id_inner" being too weak. + +2003-10-16 Elena Zannoni <ezannoni@redhat.com> + + * minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove + second parameter, which is always null. Remove + SOFUN_ADDRESS_MAYBE_MISSING ifdeffed code. + * symtab.h (lookup_minimal_symbol_solib_trampoline): Update + accordingly. + * somsolib.c (som_solib_create_inferior_hook, + som_solib_desire_dynamic_linker_symbols): Update callers. + * hppa-tdep.c (hppa_fix_call_dummy): Ditto. + +2003-10-16 Kei Sakamoto <sakamoto.kei@renesas.com> + + * remote-m32r-sdi.c : New file, interface to m32r on-chip + debug interface, SDI (Scalable Debug Interface). + * NEWS: Mention m32r SDI protocol was supported. + * Makefile.in (remote-m32r-sdi.o): Add build rule. + * config/m32r/m32r.mt (TDEPFILES) : Add remote-m32r-sdi.o. + +2003-10-15 Jeff Johnston <jjohnstn@redhat.com> + + * ia64-linux-tdep.c: Include gdbcore.h. + (IA64_LINUX_SIGCONTEXT_OFFSET): Magic constant removed. + (ia64_linux_sigcontext_register_addr): Find the address of the + sigcontext area stored in the sigframe instead of using + a magic offset constant. + +2003-10-15 Andrew Cagney <cagney@redhat.com> + + * remote.c (remote_search): Delete function. + * target.h (target_search): Delete disabled macro. + (struct target_ops): Delete disabled field "to_search". + +2003-10-14 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (frv_frame_this_id): Call inside_entry_func() + instead of deprecated_inside_entry_file(). + +2003-10-14 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c: Fix copy/paste hangover in comment. + (sh_push_dummy_call_fpu): Accomodate double passing in little endian + mode. + (sh3e_sh4_extract_return_value): Ditto. + +2003-10-13 Richard Henderson <rth@redhat.com> + + * f-typeprint.c (f_type_print_base): Handle TYPE_CODE_REF. + * f-valprint.c (f_val_print): Likewise. Tweak TYPE_CODE_PTR to + match c_val_print a bit closer. + +2003-10-13 Kevin Buettner <kevinb@redhat.com> + + * frv-tdep.c (max_instrs_per_bundle, frv_instr_size): New constants. + (frv_gdbarch_adjust_breakpoint_address): New function. + (frv_gdbarch_init): Initialize ``gdbarch_adjust_breakpoint_address'' + method. + +2003-10-13 Kevin Buettner <kevinb@redhat.com> + + * breakpoint.h (struct breakpoint): Add new member + ``requested_address''. + * breakpoint.c (breakpoint_adjustment_warning) + (adjust_breakpoint_address): New static functions. + (print_it_typical): Issue warning if breakpoint's address is different + from its requested address. + (set_raw_breakpoint, set_longjmp_resume_breakpoint, watch_command_1) + (breakpoint_re_set_one): Set breakpoint's + ``requested_address'' field. Set ``address'' field to the + result of calling adjust_breakpoint_address() on the requested + address. + +2003-10-13 Kevin Buettner <kevinb@redhat.com> + + * gdbarch.sh (ADJUST_BREAKPOINT_ADDRESS): New method. + * gdbarch.h, gdbarch.c: Regenerate. + +2003-10-11 Mark Kettenis <kettenis@gnu.org> + + * i386bsd-tdep.c (i386bsd_init_abi): Use ARRAY_SIZE to initialize + TDEP->sc_num_regs. + + * i386fbsd-tdep.c: New file. + (i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, + i386fbsd_sc_reg_offset, i386fbsdaout_init_abi, i386fbsd_init_abi, + i386fbsd4_sc_reg_offset, i386fbsd4_init_abi): Move here from + i386bsd-tdep.c. + (_initialize_i386fbsd_tdep): New function. + (i386fbsd_r_reg_offset, i386fbsd4_r_reg_offset): New varibles. + (i386fbsdaout_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs, TDEP->sizeof_gregset and + TDEP->sizeof_fpregset. Use ARRAY_SIZE to initialize + TDEP->sc_num_regs. + (i386fbsd4_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs and TDEP->sizeof_gregset. Use ARRAY_SIZE + to initialize TDEP->sc_num_regs. + * i386bsd-tdep.c (i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, + i386fbsd_sc_reg_offset, i386fbsdaout_init_abi, i386fbsd_init_abi, + i386fbsd4_sc_reg_offset, i386fbsd4_init_abi): Remove. + (_initialize_i386bsd_tdep): Don't register FreeBSD a.out and + FreeBSD ELF OS/ABI's here. + * Makefile.in (ALLDEPFILES): Add i386fbsd-tdep.c. + (i386fbsd-tdep.o): New target. + * config/i386/fbsd.mt (TDEPFILES): Add i386fbsd-tdep.o. + * config/i386/fbsd64.mt (TDEPFILES): Add i386fbsd-tdep.o. + + * amd64fbsd-tdep.c (amd64fbsd_r_reg_offset): New variable. + (amd64fbsd_init_abi): Set TDEP->gregset_reg_offset, + TDEP->gregset_num_regs and TDEP->sizeof_gregset. Use ARRAY_SIZE + in initialization of TDEP->sc_num_regs. + + * x86-64-tdep.c (x86_64_regset_from_core_section): New function. + (x86_64_init_abi): Initialize regset_from_core_section if + appropriate. + + * i386-tdep.c (i386_regset_from_core_section): New function. + (i386_gdbarch_init): Initialize regset_from_core_section if + appropriate. + * i386-tdep.h (i386_regset_from_core_section): New declaration. + + * i386-tdep.h (struct regset): Declare opaque. + + * gdbarch.sh (regset_from_core_section): New method. + (struct regset): Declare opaque. + * gdbarch.c, gdbarch.h: Regenerated. + +2003-10-11 Alan Modra <amodra@bigpond.net.au> + + * hppa-tdep.c (hppa_in_solib_call_trampoline): Don't refer directly to + _cooked_size and vma; Use bfd_section_size and bfd_get_section_vma. + Correct test for pc within section. + +2003-10-11 Mark Kettenis <kettenis@gnu.org> + + * gdbarch.sh: Remove trailing whitepsace from comments. + +2003-10-08 Roland McGrath <roland@redhat.com> + + * gcore.c (make_mem_sec): Function removed, folded into ... + (gcore_create_callback): ... here. To omit a section, clear its + SEC_LOAD bit rather than zeroing its size. + Omit read-only sections only if they correspond to a known disk file. + (gcore_copy_callback): Ignore sections without SEC_LOAD flag set. + +2003-10-10 Michael Snyder <msnyder@redhat.com> + + * d10v-tdep.c: Fix typo in comment. + +2003-10-10 Andrew Cagney <cagney@redhat.com> + + * rs6000-tdep.c (e500_store_return_value): Delete function. + (e500_extract_return_value): Delete function. + (rs6000_gdbarch_init): When SYSV, set "extract_return_value" and + "restore_return_value" to "ppc_sysv_abi_extract_return_value" and + "ppc_sysv_abi_restore_return_value" where applicable. + * ppc-tdep.h: (ppc_sysv_abi_store_return_value): Declare. + (ppc_sysv_abi_extract_return_value): Declare. + (ppc_sysv_abi_broken_store_return_value): Declare. + (ppc_sysv_abi_broken_extract_return_value): Declare. + (ppc_sysv_abi_broken_use_struct_convention:) Delete declaration. + * ppc-sysv-tdep.c (return_value_convention): Move definition to + start of file. + (do_ppc_sysv_return_value): New function. + (ppc_sysv_abi_extract_return_value): New function. + (ppc_sysv_abi_store_return_value): New function. + (ppc_sysv_abi_broken_extract_return_value): New function. + (ppc_sysv_abi_broken_store_return_value): New function. + (ppc_sysv_abi_use_struct_convention): Call + do_ppc_sysv_return_value. + +2003-10-10 J. Brobecker <brobecker@gnat.com> + + * blockframe.c (inside_main_func): No longer use symbol_lookup() + to lookup the main function symbol. + +2003-10-10 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_treat_as_flt_p): New function to recognize float + types correctly. + (sh_push_dummy_call_fpu): Fix argument passing rules. + (sh3e_sh4_extract_return_value): Call sh_treat_as_flt_p to recognize + float types. + (sh3e_sh4_store_return_value): Ditto. + +2003-10-10 Elena Zannoni <ezannoni@redhat.com> + + * sh-tdep.c (sh_use_struct_convention): Clarify one case in + comment. + +2003-10-10 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_use_struct_convention): Clean up to have a + more readable code. Accomodate passing of bitfields. + +2003-10-10 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (ppc-sysv-tdep.o): Add $(gdb_assert_h). + * rs6000-tdep.c (rs6000_gdbarch_init): When 64 bit SysV ABI, set + push_dummy_call to ppc64_sysv_abi_push_dummy_call. + * ppc-sysv-tdep.c: Include "gdb_assert.h". + (ppc64_sysv_abi_push_dummy_call): New function. + (ppc64_sysv_abi_broken_push_dummy_call): New function. + * ppc-tdep.h (ppc64_sysv_abi_push_dummy_call): Declare. + (ppc64_sysv_abi_broken_push_dummy_call): Declare. + +2003-10-10 Kei Sakamoto <sakamoto.kei@renesas.com> + + * NEWS: Replace "Hitachi" and "Mitsubishi" with "Renesas". + * README: Ditto. + * d10v-tdep.c: Ditto. + * h8300-tdep.c: Ditto. + * remote-e7000.c: Ditto. + * remote-hms.c: Ditto. + * ser-e7kpc.c: Ditto. + * sh-stub.c: Ditto. + * sh-tdep.c: Ditto. + * sh-tdep.h: Ditto. + * sh3-rom.c: Ditto. + * sh64-tdep.c: Ditto. + * top.c: Ditto. + * wince.c: Ditto. + * config/d10v/d10v.mt: Ditto. + * config/sh/embed.mt: Ditto. + * config/sh/linux.mt: Ditto. + * config/sh/tm-linux.h: Ditto. + * config/sh/tm-sh.h: Ditto. + * config/sh/wince.mt: Ditto. + +2003-10-09 Andrew Cagney <cagney@redhat.com> + + * ppc-tdep.h (struct type): Declare opaque. + * x86-64-tdep.h (struct regcache): Declare opaque. + * sh-tdep.c (sh_do_fp_register): Delete "register" attribute, fix + coding style. + +2003-10-09 Andrew Cagney <cagney@redhat.com> + + Changes from 2003-09-09 Jimi Xenidis <jimix@watson.ibm.com>: + * config/rs6000/tm-rs6000.h (SOFTWARE_SINGLE_STEP): Delete macro. + (SOFTWARE_SINGLE_STEP_P): Ditto. + * config/powerpc/tm-ppc-eabi.h (SOFTWARE_SINGLE_STEP_P): Ditto. + * config/powerpc/tm-linux.h (SOFTWARE_SINGLE_STEP): Ditto. + (SOFTWARE_SINGLE_STEP_P): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): When AIX, set + software_single_step to rs6000_software_single_step. + +2003-10-09 Andrew Cagney <cagney@redhat.com> + + * MAINTAINERS: Mark m32r-elf as buildable with -Werror. + +2003-10-09 Michael Snyder <msnyder@redhat.com> + + * frame.h: Fix typo in comment. + * dummy-frame.c: Fix typo in comment. + * d10v-tdep.c: Random whitespace/comment tweaks. + +2003-10-09 Elena Zannoni <ezannoni@redhat.com> + + * sh-tdep.c (sh_gdbarch_init): Delete setting of push_dummy_code. + (sh_push_dummy_code): Delete function, it's only used for dummy calls + on stack. + + Based on input by Stephen Clarke (stephen.clarke@superh.com): + * sh-tdep.c (sh_use_struct_convention): Add comment explaining ABI + in detail. + +2003-10-09 Daniel Jacobowitz <drow@mvista.com> + + * remote-mips.c (mips_initialize): Remove unneeded call to + get_selected_frame. Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>. + +2003-10-09 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2expr.c (execute_stack_op): Don't treat the frame base as + a memory pointer. + +2003-10-08 Jeff Johnston <jjohnstn@redhat.com> + + * lin-lwp.c (stop_and_resume_callback): Set the resumed flag + for any lwp we resume. + (running_callback): Add lwps that have pending status events + against them to be considered running. + +2003-10-08 Kei Sakamoto <sakamoto.kei@renesas.com> + + * m32r-tdep.c : Include "dis-asm.h". + * Makefile.in (m32r-tdep.o): Update dependencies. + +2003-10-06 J. Brobecker <brobecker@gnat.com> + + * completer.h (get_gdb_completer_word_break_characters): Delete. + * completer.c: include language.h. + (gdb_completer_word_break_characters): Delete. + (get_gdb_completer_word_break_characters): Delete. + (location_completer): Use the word break characters of the current + language. + (complete_line): Likewise. + (line_completion_function): Likewise. + (skip_quoted_chars): Likewise. + * Makefile.in (completer.o): Add dependency on language.h. + * top.c (init_main): Set the readline word break characters + to GDB's default word break characters. + +2003-10-06 J. Brobecker <brobecker@gnat.com> + + * language.h (language_defn): new field, la_word_break_characters. + * language.c (unknown_language_defn): Set new field to + default_word_break_characters. + (auto_language_defn): Likewise. + (local_language_defn): Likewise. + * ada-lang.c (ada_language_defn): Likewise. + * c-lang.c (c_language_defn): Likewise. + (cplus_language_defn): Likewise. + (asm_language_defn): Likewise. + (minimal_language_defn): Likewise. + * f-lang.c (f_language_defn): Likewise. + * jv-lang.c (java_language_defn): Likewise. + * m2-lang.c (m2_language_defn): Likewise. + * objc-lang.c (objc_language_defn): Likewise. + * p-lang.c (pascal_language_defn): Likewise. + * scm-lang.c (scm_language_defn): Likewise. + +2003-10-06 Andrew Cagney <cagney@redhat.com> + + * ppc-sysv-tdep.c: Re-indent. + +2003-10-06 J. Brobecker <brobecker@gnat.com> + + * language.h (default_word_break_characters): Add prototype. + * language.c (default_word_break_characters): New function. + +2003-10-06 Andreas Schwab <schwab@suse.de> + + * i386-tdep.c (i386_analyze_frame_setup): Also handle xorl/subl + with %eax. + +2003-10-06 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (ALLDEPFILES): Remove "z8k-tdep.c" and + "h8500-tdep.c". + (z8k-tdep.o): Delete custom build rule. + +2003-10-06 Andrew Cagney <cagney@redhat.com> + + * Makefile.in: Update all dependencies. + + * MAINTAINERS: Mention that h8500, mn10200, and z8k were deleted. + No longer list PA as as obsolete candidate. List m32r as + broken instead of obsolete. + + * config/nm-m3.h, config/h8500/h8500.mt: Delete obsolete files. + * config/h8500/tm-h8500.h, config/i386/nm-ptx4.h: Ditto. + * config/i386/nm-symmetry.h, config/i386/ptx.mh: Ditto. + * config/i386/ptx.mt, config/i386/ptx4.mh: Ditto. + * config/i386/ptx4.mt, config/i386/symmetry.mh: Ditto. + * config/i386/symmetry.mt, config/i386/tm-ptx.h: Ditto. + * config/i386/tm-ptx4.h, config/i386/tm-symmetry.h: Ditto. + * config/i386/xm-ptx.h, config/i386/xm-ptx4.h: Ditto. + * config/i386/xm-symmetry.h, config/mips/mipsm3.mh: Ditto. + * config/mips/mipsm3.mt, config/mips/tm-mipsm3.h: Ditto. + * config/mips/xm-mipsm3.h, config/mn10200/mn10200.mt: Ditto. + * config/mn10200/tm-mn10200.h, config/pa/hppabsd.mh: Ditto. + * config/pa/hppabsd.mt, config/pa/hppaosf.mh: Ditto. + * config/pa/hppaosf.mt, config/pa/hppapro.mt: Ditto. + * config/pa/nm-hppab.h, config/pa/nm-hppao.h: Ditto. + * config/pa/tm-hppab.h, config/pa/tm-hppao.h: Ditto. + * config/pa/tm-pro.h, config/pa/xm-hppab.h: Ditto. + * config/pa/xm-pa.h, config/sparc/sparclet.mt: Ditto. + * config/sparc/sparclite.mt, config/sparc/tm-sparclet.h: Ditto. + * config/sparc/tm-sparclite.h, config/z8k/tm-z8k.h: Ditto. + * config/z8k/z8k.mt: Ditto. + + * NEWS: Mention that z8k-zilog-none, z8ksim, mn10200-*-*, + h8500hms, hppa*-*-bsd*, hppa*-*-osf*, hppa*-*-pro*, + mips*-*-mach3*, i[3456]86-sequent-sysv4*, i[3456]86-sequent-sysv*, + i[3456]86-sequent-bsd*, sparclet-*-*, sparclite-fujitsu-none, and + sparclite were removed. + * configure.host, configure.tgt: Remove corresponding tuples. + + * breakpoint.c, breakpoint.h: Remove obsolete code. + * buildsym.c, dbxread.c, gdbtypes.c, mdebugread.c: Ditto. + * monitor.c, sparc-tdep.c, stabsread.c: Ditto. + * stabsread.h, xcoffread.c: Ditto. + + * z8k-tdep.c, symm-tdep.c, symm-nat.c: Delete obsolete file. + * sparclet-stub.c, sparclet-rom.c: Delete obsolete file. + * sparcl-tdep.c, sparcl-stub.c, h8500-tdep.c: Delete obsolete file. + * m3-nat.c, mipsm3-nat.c, mn10200-tdep.c: Delete obsolete file. + +2003-10-06 David Lecomber <dsl@sources.redhat.com> + + * f-valprint.c: Reformatting + +2003-10-06 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c: Remove duplicate comment. + + * x86-64-tdep.c (x86_64_store_return_value): Don't use + DEPRECATED_REGISTER_RAW_SIZE. Use symbolic names for register + names for return values. This fixes a bug since we looked at %rbx + instead of %rdx. + +2003-10-05 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c: Include "regset.h". + + * i386-tdep.h (struct gdbarch_tdep): Add members gregset, + gregset_reg_offset, gregset_num_regs, sizeof_gregset, fpregset, + sizeof_fpregset. + * i386-tdep.c: Include "regset.h". + (i386_supply_gregset): New function. + (i386_supply_fpregset): New function. + (i386_gdbarch_init): Initialze register set-related members of + TDEP. + * x86-64-tdep.c (x86_64_supply_fpregset): New function. + (x86_64_init_abi): Initialize TDEP->sizeof_fpregset. + +2003-10-03 Andrew Cagney <cagney@redhat.com> + + * rs6000-tdep.c (rs6000_gdbarch_init): When the 64 bit SysV ABI, + set extract_return_value, store_return_value and + use_struct_convention to ppc64_sysv_abi_extract_return_value, + ppc64_sysv_abi_store_return_value and + ppc64_sysv_abi_use_struct_convention. + * ppc-tdep.h (ppc64_sysv_abi_extract_return_value): Declare. + (ppc64_sysv_abi_store_return_value): Declare. + (ppc64_sysv_abi_use_struct_convention): Declare. + * ppc-sysv-tdep.c (enum return_value_convention): Define. + (ppc64_sysv_abi_extract_return_value): New function. + (ppc64_sysv_abi_store_return_value): New function. + (ppc64_sysv_abi_use_struct_convention): New function. + (ppc64_sysv_abi_return_value): New function. + +2003-10-03 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Only + convert a descriptor to a function when it's in the ".opd" + section. + +2003-10-03 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_push_dummy_call_fpu): Initialize flt_argreg and + reg_size to keep GCC silent. + +2003-10-03 Corinna Vinschen <vinschen@redhat.com> + + * dwarf2-frame.c (struct comp_unit): Add tbase member to store + base for DW_EH_PE_textrel encodings. + (read_encoded_value): Add a DW_EH_PE_textrel case. + (dwarf2_build_frame_info): Set unit.tbase to beginning of text + section. + +2003-10-03 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c (dwarf2_build_frame_info): Fix comment. + +2003-10-02 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_REGISTER_RAW_SIZE): Rename + REGISTER_RAW_SIZE. + * gdbarch.h, gdbarch.c: Re-generate. + * aix-thread.c, alpha-tdep.h, arm-tdep.c, core-sol2.c: Update. + * cris-tdep.c, dve3900-rom.c, findvar.c, frame.c: Update. + * hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update. + * hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update. + * ia64-linux-nat.c, ia64-tdep.c, infcmd.c, infptrace.c: Update. + * infrun.c, irix5-nat.c, lynx-nat.c, mips-linux-tdep.c: Update. + * mips-nat.c, mips-tdep.c, mipsv4-nat.c, mn10300-tdep.c: Update. + * monitor.c, ns32k-tdep.c, ppc-linux-nat.c, regcache.c: Update. + * remote-e7000.c, remote-mips.c, remote-sim.c: Update. + * remote-vxmips.c, remote-vxsparc.c, remote.c: Update. + * rom68k-rom.c, rs6000-nat.c, rs6000-tdep.c, s390-tdep.c: Update. + * sh64-tdep.c, sparc-nat.c, sparc-tdep.c, stack.c: Update. + * target.c, tracepoint.c, v850-tdep.c, v850ice.c, valops.c: Update. + * vax-tdep.c, vax-tdep.h, x86-64-tdep.c, xstormy16-tdep.c: Update. + * config/m68k/tm-delta68.h, config/m68k/tm-vx68.h: Update. + * config/sparc/tm-sparc.h, config/sparc/tm-sparclynx.h: Update. + +2003-10-02 Jim Blandy <jimb@redhat.com> + + * dwarf2read.c (struct die_info): Doc fix. + +2003-10-02 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c: Running thru gdb_indent.sh. + +2003-10-02 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (sh_justify_value_in_reg): New function. + (sh_stack_allocsize): Ditto. + (flt_argreg_array): New array used for floating point argument + passing. + (sh_init_flt_argreg): New function. + (sh_next_flt_argreg): Ditto. + (sh_push_dummy_call_fpu): Simplify. Rename "odd_sized_struct" to + "pass_on_stack". Use new helper functions. Accomodate Renesas ABI. + Fix argument passing strategy. + (sh_push_dummy_call_nofpu): Ditto. + +2003-10-01 Andrew Cagney <cagney@redhat.com> + + * value.h (register_value_being_returned): Declare. Replace + "value_being_returned". + * infcall.c (call_function_by_hand): Use + register_value_being_returned. + * infcmd.c (print_return_value): Call + "register_value_being_returned", handle struct return locally. + * values.c (register_value_being_returned): New function. Replace + "value_being_returned". + +2003-09-30 Elena Zannoni <ezannoni@redhat.com> + + * linux-proc.c (linux_do_registers): New function. + (linux_make_note_section): Use linux_do_registers in case of + single threaded inferior programs. + +2003-10-01 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): When STRUCT_RETURN, always + use STRUCT_ADDR. When not using "struct return convention", pass + "0" to "value_being_returned". Add FIXMEs. + * infcmd.c (print_return_value): Pass an explicit 0/1 to + value_being_returned. Add comments. + * values.c (value_being_returned): Add fixme. + * hppa-tdep.c (hppa_extract_struct_value_address): Add FIXME. + (hppa_value_returned_from_stack): Add FIXME. + +2003-09-30 David Carlton <carlton@kealia.com> + + * dwarf2read.c (struct die_info): Add 'parent' field; replace + 'has_children' and 'next' by 'child' and 'sibling'. + (read_comp_unit): Rework algorithm, breaking body into + read_die_and_children and read_die_and_siblings. + (read_die_and_children, read_die_and_siblings): New. + (read_full_die): Add 'has_children' argument; set it instead of + the die's 'has_children' field. Minor formatting cleanup. + (free_die_list): Use die->child and die->sibling instead of + die->next. + (dump_die_list): Ditto. + (sibling_die): Use die->sibling. + (psymtab_to_symtab_1): Use die's 'child' field in place of its + 'has_children' and 'next' fields. + (process_die, read_file_scope, read_func_scope) + (read_lexical_block_scope, read_structure_scope) + (read_enumeration, read_array_type, read_common_block) + (read_namespace, read_subroutine_type, dump_die): Ditto. + +2003-09-30 Andrew Cagney <cagney@redhat.com> + + * rs6000-tdep.c (rs6000_gdbarch_init): Set the PowerOpen red zone + to 224, not 220. + +2003-09-30 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_REGISTER_VIRTUAL_SIZE): Rename + REGISTER_VIRTUAL_SIZE. + * gdbarch.h, gdbarch.c: Regenerate. + * vax-tdep.h, sparc-tdep.c, regcache.h: Update. + * regcache.c, mn10300-tdep.c, mips-tdep.c: Update. + * infcmd.c, frame.c, findvar.c, cris-tdep.c: Update. + +2003-09-29 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_REGISTER_VIRTUAL_TYPE): Rename + DEPRECATED_REGISTER_VIRTUAL_TYPE. + * gdbarch.h, gdbarch.c: Regenerate. + * arch-utils.c, hppa-tdep.c, regcache.c, regcache.h: Update. + * sh64-tdep.c, sparc-tdep.c: Update. + + * remote-vxsparc.c (vx_read_register): Replace bzero with memset. + * remote-vxmips.c (vx_read_register): Ditto. + * remote-vx68.c (vx_read_register): Ditto. + * gnu-nat.c (inf_validate_procs): Ditto. + +2003-09-29 J. Brobecker <brobecker@gnat.com> + + * infcall.c (call_function_by_hand): Fix build failure + introduced in the previous change to this file. + +2003-09-29 Andrew Cagney <cagney@redhat.com> + + * NEWS: Mention Objective-C. + +2003-09-29 Jerome Guitton <guitton@act-europe.fr> + + * arm-tdep.c (arm_make_prologue_cache): Use trad_frame_addr_p to + test if the register has been saved on the stack. + (arm_scan_prologue_cache): When analysing the instruction + "str lr, [sp, #-4]", save the address where lr has been stored. + +2003-09-28 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_read_unsigned_register): Delete function. + * frame.h (frame_read_unsigned_register): Delete declaration. + * sparc-tdep.c (sparc_init_extra_frame_info): Use + get_frame_register_unsigned. + (sparc_frame_saved_pc, sparc_pop_frame): Ditto. + * m68hc11-tdep.c (m68hc11_print_register): Ditto. + * d10v-tdep.c (d10v_print_registers_info): Ditto. + + * frame.h (frame_read_register): Delete declaration. + * frame.c (frame_read_register): Delete function. + * arch-utils.c (legacy_register_to_value): Use get_frame_register. + * sparc-tdep.c (sparc_fetch_pointer_argument): Ditto. + * rs6000-tdep.c (rs6000_fetch_pointer_argument): Ditto. + * mips-tdep.c (mips_register_to_value): Ditto. + * hppa-tdep.c (hppa_fetch_pointer_argument): Ditto. + * d10v-tdep.c (d10v_print_registers_info): Ditto. + + * frame.c (frame_read_signed_register): Delete function. + (frame_read_unsigned_register): Update comments. + * frame.h (frame_read_signed_register): Delete declaration. + * h8300-tdep.c (h8300_print_register): Use + get_frame_register_signed. + * m68hc11-tdep.c (m68hc11_print_register): Ditto. + + * config/pa/tm-hppa.h (DEPRECATED_VALUE_RETURNED_FROM_STACK): + Rename VALUE_RETURNED_FROM_STACK. + * infcmd.c (print_return_value): Update. + * infcall.c (call_function_by_hand): Update. + +2003-09-28 Mark Kettenis <kettenis@gnu.org> + + * i387-tdep.c (i387_supply_fsave, i387_supply_fxsave): Add + regcache argument and reverse the order of the other two + arguments. Remove local regcache variable. Determine + architecture from REGCACHE. Update comments. + * x86-64-tdep.c (x86_64_supply_fxsave): Add regcache argument and + reverse the order of the other two arguments. Remove local + regcache variable. Determine architecture from REGCACHE. Update + comments. + * i387-tdep.h (i387_supply_fsave, i387_supply_fxsave): Adjust + prototypes. Update comments. + * x86-64-tdep.c (x86_64_supply_fxsave): Adjust prototype. Adjust + comment. + * amd64fbsd-nat.c (supply_fpregset, fetch_inferior_registers): + Update. + * go32-nat.c (fetch_register, go32_fetch_registers): Update. + * i386-interix-nat.c (supply_fpregset): Update. + * i386-linux-nat.c (supply_fpregset, supply_fpxregset): Update. + * i386-nto-tdep.c (i386nto_supply_fpregset): Update. + * i386gnu-nat.c (fetch_fpregs, supply_fpregset): Update. + * i386bsd-nat.c (supply_fpregset, fetch_inferior_registers): Update. + * i386nbsd-tdep.c (fetch_core_registers, fetch_elfcore_registers): + Update. + * i386obsd-tdep.c (fetch_core_registers): Update. + * i386v4-nat.c (supply_fpregset): Update. + * x86-64-linux-nat.c (supply_fpregset): Update. + * x86-64-linux-tdep.c (fetch_core_registers): Update. + +2003-09-27 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.h: Put opaque declarations in alphabetical + order. Remove spurious whitespace. + (struct gdbarch_tdep): add st0_regnum and mm0_regnum members. + (i386_sse_regnum_p, i386_mxcsr_regnum_p): Remove prototypes. + * i386-tdep.c (MM0_REGNUM): Remove define. + (i386_mmx_regnum_p): Add gdbarch argument. + (i386_sse_regnum_p, i386_mxcsr_regnum_p): Add gdbarch argument. + Rewrite using new macro definitions for FPU/SSE registers. + (i386_fp_regnum_p, i386_fpc_regnum_p): Rewrite using new macro + definitions from i387-tdep.h. + (i386_register_name): Update. + (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Update to use + new macro definitions for FPU/SSE registers. + (i386_extract_return_value): Determine whether floating-point + registers are present by examining REGCACHE's architecture. + (i386_store_return_value): Likewise. Use I386_MAX_REGISTER_SIZE + instead of FPU_REG_RAW_SIZE. Use new macro definitions for + FPU/SSE registers. + (i386_register_type): Update. + (i386_mmx_regnum_to_fp_regnum): Rewrite using new macro + definitions for FPU registers. Use REGCACHE's architecture to + determine the appropriate register numbers. + (i386_pseudo_register_read, i386_pseudo_register_write, + i386_register_reggroup_p): Update. + (i386_gdbarch_init): Initialize TDEP->st0_regnum and + TDEP->mm0_regnum. + * i387-tdep.h (I387_FCTRL_REGNUM, I387_FSTAT_REGNUM, + I387_FTAG_REGNUM, I387_FISEG_REGNUM, I387_FIOFF_REGNUM, + I387_FOSEG_REGNUM, I387_FOOFF_REGNUM, I387_FOP_REGNUM, + I387_XMM0_REGNUM, I387_MXCSR_REGNUM): New defines. + (i387_supply_fsave, i387_fill_fsave, i387_supply_fxsave, + i387_fill_fxsave): Change type of fsave/fxsave argument from `char + *' to `void *'. + * i387-tdep.c (i387_print_float_info, fsave_offset, FSAVE_ADDR, + i387_supply_fsave, i387_fill_fsave, fxsave_offset, FXSAVE_ADDR, + i387_supply_fxsave, i387_fill_fxsave): Update to use new macro + definitions for FPU/SSE registers. + (FXSAVE_MXCSR_ADDR): New define. + * x86-64-tdep.c (x86_64_init_abi): Override TDEP->st0_regnum and + TDEP->mm0_regnum. + (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): Remove defines. + (I387_ST0_REGNUM): Define. + + * regcache.h (get_regcache_arch): New prototype. + * regcache.c (get_regcache_arch): New function. + + * x86-64-tdep.c (x86_64_store_return_value): Remove spurious + whitespace. + + * i386-tdep.c (i386_num_register_names, i386_num_mmx_regs): + Initialize using ARRAY_SIZE. + +2003-09-27 Andrew Cagney <cagney@redhat.com> + + * arch-utils.c (deprecated_init_frame_pc_default): Rename + "init_frame_pc_default". + * arch-utils.h (deprecated_init_frame_pc_default): Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sh64-tdep.c (sh64_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * config/pa/tm-hppa.h (DEPRECATED_INIT_FRAME_PC): Update. + +2003-09-26 Mark Kettenis <kettenis@gnu.org> + + * regset.h: New file. + * Makefile.in (regset_h): Add. + +2003-09-25 Andrew Cagney <cagney@redhat.com> + + * frame.h (deprecated_frame_saved_regs): Rename + get_frame_saved_regs. + * cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update. + * mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update. + * ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update. + * s390-tdep.c, sh64-tdep.c, stack.c: Update. + * v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update. + +2003-09-25 Andrew Cagney <cagney@redhat.com> + + * NEWS: Mention the new backtrace mechanism, DWARF 2 CFI, hosted + file I/O, multi-arch, TLS and NPTL, DWARF 2 Location Expressions, + and Java. + * PROBLEMS: Mention that mips*-*-*, powerpc*-*-*, sparc*-*-* and + arm*-*-* do not use the new frame code. + +2003-09-25 David Carlton <carlton@kealia.com> + + * c-exp.y: Remove 'register' declarations. + * f-exp.y, jv-exp.y, m2-exp.y, objc-exp.y, p-exp.y: Ditto. + +2003-09-25 David Carlton <carlton@kealia.com> + + * c-exp.y: Include cp-support.h. Add qualified_type. + (yylex): Delete nested type hack; add comments. + * cp-namespace.c (cp_lookup_nested_type): New function. + * cp-support.h: Declare cp_lookup_nested_type. + * eval.c (evaluate_subexp_standard): Call value_aggregate_elt + instead of value_struct_elt_for_reference. + * valops.c: Include cp-support.h. + (value_aggregate_elt): New function. + (value_namespace_elt): Ditto. + (value_struct_elt_for_reference): Make static. + * value.h: Delete declaration of value_struct_elt_for_reference; + add declaration for value_aggregate_elt. + * Makefile.in (c-exp.tab.o): Depend on $(cp_support_h). + (valops.o): Ditto. + +2003-09-25 Daniel Jacobowitz <drow@mvista.com> + + * stack.c: Include "reggroups.h". + (frame_info): Only display registers in all_reggroup. + * Makefile.in (stack.o): Update dependencies. + +2003-09-25 Jerome Guitton <guitton@act-europe.fr> + + * arm-tdep.c (arm_skip_prologue): Handle "sub ip, sp #n" and + "add ip, sp #n" in the prologue. + (arm_scan_prologue): Ditto. + +2003-09-25 Jerome Guitton <guitton@act-europe.fr> + + * MAINTAINERS (write after approval): Add myself. + +2003-09-25 Andreas Schwab <schwab@suse.de> + + * m68k-tdep.c: Include "dwarf2-frame.h". + (m68k_gdbarch_init): Add the DWARF CFI frame unwinder. + * Makefile.in (m68k-tdep.o): Update dependencies. + +2003-09-25 Corinna Vinschen <vinschen@redhat.com> + + * sh-tdep.c (struct frame_extra_info): Remove. + (struct sh_frame_cache): New structure. + (GET_SOURCE_REG): New macro extracting source register of an opcode. + (GET_TARGET_REG): Ditto but target register. + (GET_PUSHED_REG): Remove. + (IS_MOV_ARG_TO_REG): New macro. + (IS_MOV_ARG_TO_IND_R14): New macro. + (IS_MOV_ARG_TO_IND_R14_WITH_DISP): New macro. + (IS_MOVW_PCREL_TO_REG): New macro. + (IS_MOVL_PCREL_TO_REG): New macro. + (IS_SUB_REG_FROM_SP): New macro. + (IS_ARG_MOV): Remove. + (IS_MOV_TO_R14): Remove. + (IS_RESTORE_FP): New macro. + (IS_RTS): New macro. + (IS_LDS): New macro. + (IS_MOV_FP_SP): New macro. + (IS_ADD_REG_TO_FP): New macro. + (IS_ADD_IMM_FP): New macro. + (sh_skip_prologue_hard_way): Remove. + (sh_saved_pc_after_call): Remove. + (sh_frame_chain): Remove. + (sh_find_callers_reg): Remove. + (sh_nofp_frame_init_saved_regs): Remove. + (sh_fp_frame_init_saved_regs): Remove. + (sh_init_extra_frame_info): Remove. + (sh_analyze_prologue): New function. + (sh_skip_prologue): Remove deprecated code. Rely on new function + sh_analyze_prologue when after_prologue fails. + (sh_frame_saved_pc): Remove. + (sh_alloc_frame_cache): New function. + (sh_frame_cache): Ditto. + (sh_frame_prev_register): Ditto. + (sh_frame_this_id): Ditto. + (sh_frame_unwind): New structure defining the heuristic frame + sniffer interface. + (sh_frame_sniffer): New function. + (sh_unwind_sp): Ditto. + (sh_unwind_pc): Ditto. + (sh_unwind_dummy_id): Ditto. + (sh_frame_base_address): Ditto. + (sh_frame_base): New structure defining new frame base code. + (sh_in_function_epilogue_p): New function. + (sh_gdbarch_init): Restructure and simplify to eliminate deprecated + code and to call all new code instead. Initialize dwarf2 and + heuristic frame sniffer. + +2003-09-24 Paul N. Hilfinger <hilfingr@nile.gnat.com> + + * parser-defs.h (struct exp_descriptor): New definition, containing + language-specific info for printing, prefixifying, dumping, and + evaluating expressions. + (exp_descriptor_standard): Declare new variable. + (print_subexp): Make global and declare here (from expprint.c). + (dump_subexp): Ditto. + (dump_subexp_body_standard): Declare. + (operator_length_standard): Declare. + (op_name_standard): Declare. + (print_subexp): Declare. + (print_subexp_standard): Declare. + + * language.h (struct language_defn): Add la_exp_desc field to hold + pointer to table for language-specific operators. + Remove evaluate_exp field, which is now in struct exp_descriptor. + + * parse.c (operator_length): Move most code to new + operator_length_standard function. Use language-specific information. + (operator_length_standard): New function taking most code from + operator_length. + (exp_descriptor_standard): New constant. + + * expression.h (enum exp_opcode): Add definitions of OP_EXTENDED0 + and OP_EXTENDED_LAST. + + * expprint.c (print_subexp): Use language-specific print_subexp. + Make global; remove static declaration. + Move most code to print_subexp_standard. + (print_subexp_standard): New function, containing code formerly in + print_subexp. + (op_name): Add expression to argument signature. + Use langauge-specific op_name. + Move most code to op_name_standard. + (op_name_standard): New function, containing code formerly in op_name. + (dump_subexp): Use new version of op_name function. + Use language-specific dump_subexp_body, and move most existing code to + dump_subexp_body_standard. + (dump_raw_expression): Use new op_name interface. + (dump_subexp_body): Move most code to dump_subexp_body_standard. + (dump_subexp_body_standard): New function, containing code formerly + in dump_subexp_body. + + * language.c (unknown_language): Add default la_exp_desc field and + remove evaluate_exp field. + (auto_language): Ditto. + (local_language): Ditto. + * f-lang.c (f_language_defn): Ditto. + * c-lang.c (c_language_defn): Ditto. + (cplus_language_defn): Ditto. + (asm_language_defn): Ditto. + (minimal_language_defn): Ditto. + * p-lang.c (pascal_language_defn): Ditto. + * m2-lang.c (m2_language_defn): Ditto. + * objc-lang.c (objc_language_defn): Ditto. + + * jv-lang.c (exp_descriptor_java): New variable, containing + Java-specific expression evaluator. + (java_language_defn): Add la_exp_desc field and remove evaluate_exp + field. + * scm-lang.c (exp_descriptor_scm): New variable, containing + Scheme-specific expression evaluator. + (scm_language_defn): Add la_exp_desc field and remove evaluate_exp + field. + * objc-lang.c (print_object_command): Take evaluate_exp from the + la_exp_desc field. + + * Makefile.in (eval.o): Add dependency on parser-defs.h. + + * eval.c: Include parser-defs.h for the full declaration of + la_exp_desc's type. + (evaluate_subexp): Get evaluate_exp out of la_exp_desc field. + +2003-09-23 Paul N. Hilfinger <hilfingr@nile.gnat.com> + + * parser-defs.h (operator_length): Declare. + + * parse.c (length_of_subexp): Use operator_length to get operator + lengths and arities for operators. + Move most code to new operator_length function. + (operator_length): New function absorbing most code from + length_of_subexp. + (prefixify_subexp): Remove large case and use operator_length instead. + (parse_exp_1): Use renamings: + dump_prefix_expression => dump_raw_expression and + dump_postfix_expression => dump_prefix_expression. + + * expression.h (dump_prefix_expression): Rename to ... + (dump_raw_expression): New name. + (dump_postfix_expression): Rename to ... + (dump_prefix_expression): New name. + + * expprint.c (dump_subexp): Make global. Add comment. + Move most existing code to dump_subexp_body. + (dump_subexp_body): New function. + (dump_prefix_expression): Rename to dump_raw_expression. + Remove attempt to print the expression via print_expression: it can't + work before the expression is prefixified. + (dump_raw_expression): Renamed from dump_prefix_expression. + (dump_postfix_expression): Rename to dump_prefix_expression, since + that's what it does. + Remove 'note' parameter, since this routine must be used on + prefixified expression. + (dump_prefix_expression): Renamed from dump_postfix_expression. + +2003-09-22 Jim Blandy <jimb@redhat.com> + + * dwarf2read.c (read_array_type): When building the type for an + array of unspecified length, make sure to choose the upper bound + so that the array's total length comes out to be zero --- that's + how we represent such arrays. + +2003-09-22 Michael Chastain <mec@shout.net> + + * MAINTAINERS: Rename gdb.c++ to gdb.cp. + +2003-09-22 Jeff Johnston <jjohnstn@redhat.com> + + * top.c (quit_force): Fix indirect call to quit_target so + a struct qt_args pointer is passed. + +2003-09-22 Andrew Cagney <cagney@redhat.com> + + * arch-utils.h (init_frame_pc_noop): Delete declaration. + * arch-utils.c (init_frame_pc_noop): Delete function. + * mn10300-tdep.c (mn10300_gdbarch_init): Do not set + "init_frame_pc". + * mips-tdep.c (mips_gdbarch_init): Ditto. + * i386-interix-tdep.c (i386_interix_init_abi): Ditto. + * config/sparc/tm-sparc.h (init_frame_pc_noop): Delete + declaration. + (DEPRECATED_INIT_FRAME_PC): Delete macro. + * config/rs6000/tm-rs6000.h (init_frame_pc_noop): Delete + declaration. + (DEPRECATED_INIT_FRAME_PC): Delete macro. + +2003-09-22 Anthony Green <green@redhat.com> + + * monitor.c (monitor_expect): Delete unused conflicting targ_ops + declaration. + +2003-09-20 Andrew Cagney <cagney@redhat.com> + + * breakpoint.c: Eliminate ARGSUSED. + * buildsym.c, cli/cli-cmds.c, cli/cli-script.c: Ditto. + * coffread.c, corelow.c, dwarf2read.c, event-top.c: Ditto. + * exec.c, gcore.c, hpux-thread.c, infcmd.c, inflow.c: Ditto. + * infrun.c, inftarg.c, maint.c, ocd.c, printcmd.c: Ditto. + * procfs.c, regcache.c, remote-rdi.c, remote-sds.c: Ditto. + * remote.c, sol-thread.c, source.c, stabsread.c: Ditto. + * stack.c, symfile.c, target.c, top.c, typeprint.c: Ditto. + * utils.c, v850ice.c, valprint.c, values.c, win32-nat.c: Ditto. + * wince.c, remote-vx.c: Ditto. + + * cli/cli-script.c: Remove "register" attributes. + * config/pa/tm-hppa.h: Ditto. + * cli/cli-decode.c: Ditto. + * cli/cli-cmds.c: Ditto. + +2003-09-19 Andrew Cagney <cagney@redhat.com> + + * sparcnbsd-nat.c (getregs_supplies): Rename NPC_REGNUM to + DEPRECATED_NPC_REGNUM. + * sparc64nbsd-nat.c (getregs_supplies): Ditto. + +2003-09-19 Christopher Faylor <cgf@redhat.com> + + * win32-nat.c (mappings): Remove HAVE_SSE conditional. + +2003-09-19 Jim Blandy <jimb@redhat.com> + + * macrotab.c (macro_include): Use the correct comparison to find + the appropriate place for this inclusion in the list. + +2003-09-19 Andrew Cagney <cagney@redhat.com> + + * config/pa/nm-hppah.h (NEED_TEXT_START_END): Delete. + (DEPRECATED_HPUX_TEXT_END): Define. + (deprecated_hpux_text_end): Declare. + (struct target_ops): Declare opaque. + * hppah-nat.c (text_end): Make static. + (deprecated_hpux_text_end): New function. + * exec.c (text_end): Delete global variable. + (NEED_TEXT_START_END): Do not define. + (exec_file_attach): Replace code computing "text_end" code with + call to DEPRECATED_HPUX_TEXT_END. + +2003-09-19 Andrew Cagney <cagney@redhat.com> + + * utils.c (align_up, align_down): New functions. + * defs.h (align_up, align_down): Declare. + * ppc-sysv-tdep.c (align_up, align_down): Delete functions. + * s390-tdep.c: Replace "round_up" and "round_down" with "align_up" + and "align_down". + (round_up, round_down): Delete functions. + * mips-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and + "align_down". + (ROUND_DOWN, ROUND_UP): Delete macros. + (mips_dump_tdep): Do not print "ROUND_UP" or "ROUND_DOWN". + * h8300-tdep.c: Replace "round_up" and "round_down" with + "align_up" and "align_down". + (round_up, round_down): Delete macros. + * frv-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and + "align_down". + (ROUND_UP, ROUND_DOWN): Delete macros. + +2003-09-18 J. Brobecker <brobecker@gnat.com> + + * hppa-hpux-tdep.c (_initialize_hppa_hpux_tdep): Remove a + hard-coded constant. Use the proper machine name instead. + +2003-09-17 Andrew Cagney <cagney@redhat.com> + + * sparc-tdep.c (legacy_register_name): Delete function. + * mips-tdep.c (mips_dump_tdep): Do not print REGISTER_NAME. + (mips_gdbarch_init): Refer to MIPS_REGISTER_NAME in comments. + * infcmd.c (gdb_register_name): Delete variable. + * gdbarch.sh (SDB_REG_TO_REGNUM): Delete reference to + REGISTER_NAME and "tm.h". + * gdbarch.h, gdbarch.c: Regenerate. + * dpx2-nat.c (regmap): Refer to REGISTER_NAME and not + REGISTER_NAMES in comments. + * remote-st.c (get_reg_name), i386b-nat.c (tregmap): Ditto. + * m68klinux-nat.c (regmap): Ditto. + +2003-09-17 Jim Blandy <jimb@redhat.com> + + * Makefile.in (dis_asm_h): Note that this #includes "bfd.h". + +2003-09-17 Andrew Cagney <cagney@redhat.com> + + * ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function. + (ppcnbsd_init_abi): Set "use_struct_convention" to + "ppcnbsd_use_struct_convention". + +2003-09-17 Mark Kettenis <kettenis@gnu.org> + + * gdbarch.sh (DEPRECATED_REG_STRUCT_HAS_ADDR): Add comment. + * gdbarch.h, gdbarch.c: Regenerate. + (stabs_argument_has_addr): New architecture method. + * arch-utils.h (default_stabs_argument_has_addr): New prototype. + * arch-utils.c: Include "buildsym.h". + (default_stabs_argument_has_addr): New function. + * stabsread.c (define_symbol): Use stabs_argument_has_addr + instead of DEPRECATED_REG_STRUCT_HAS_ADDR. + 2003-09-30 David Carlton <carlton@kealia.com> * Makefile.in (c-exp.tab.o): Depend on cp_support_h. @@ -56,7 +2288,7 @@ * regcache.c, remote-vxsparc.c, sparc-linux-nat.c: Update. * sparc-nat.c, sparc-tdep.c, sparc64-tdep.c: Update. * sparcnbsd-tdep.c: Update. - + 2003-09-17 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE. @@ -185,7 +2417,7 @@ * symmisc.c, symtab.c, top.c, tracepoint.c: Ditto. * typeprint.c, utils.c, valarith.c, valops.c: Ditto. * values.c, vax-tdep.c, xcoffread.c: Ditto. - + 2003-09-13 Andrew Cagney <cagney@redhat.com> * config/pa/tm-hppa64.h (struct frame_info): Declare opaque. @@ -236,7 +2468,7 @@ * gdbarch.c, gdbarch.h: Updated. * infcall.c (call_function_by_hand): Update. * stabsread.c (define_symbol): Updated. - + * Makefile.in (xm-i386-sv32.h, tm-i386gas.h): Remove. 2003-09-12 Christopher Faylor <cgf@redhat.com> @@ -638,7 +2870,7 @@ set_gdbarch_frame_align(), frame_unwind_append_sniffer(), and frame_base_set_default(). * Makefile.in (frv-tdep.o): Update dependencies. - + 2003-09-09 Mark Kettenis <kettenis@gnu.org> * dwarf2-frame.c (read_encoded_value): Add support for @@ -669,13 +2901,13 @@ * configure.tgt: Add FIXME to sh-*-linux*. * sh-tdep.c: Move sh64 support to sh64-tdep.c. (sh_gdbarch_init): Always set correct sh_show_regs function - pointer. Call sh64_gdbarch_init() if machine type is sh5. + pointer. Call sh64_gdbarch_init() if machine type is sh5. * sh-tdep.h: Move sh64 support to sh64-tdep.c. * sh64-tdep.c: New file, containing all sh64 related code from sh-tdep.c. * config/sh/embed.mt (TDEPFILES): Add sh64-tdep.o. * config/sh/linux.mt (TDEPFILES): Ditto. - * config/sh/nbsd.mt (TDEPFILES): Ditto. + * config/sh/nbsd.mt (TDEPFILES): Ditto. * config/sh/tm-sh.h: Drop REGISTER_TYPE definition. * config/sh/wince.mt (TDEPFILES): Ditto. @@ -895,7 +3127,7 @@ * config/h8300/tm-h8300.h (GDB_MULTI_ARCH): Delete definition. * config/frv/tm-frv.h (GDB_MULTI_ARCH): Delete definition. * config/alpha/tm-alpha.h (GDB_MULTI_ARCH): Delete definition. - + 2003-08-30 Michael Chastain <mec@shout.net> * Makefile.in: Remove tm-hp300bsd.h, tm-hp300hpux.h. @@ -1038,7 +3270,7 @@ (_initialize_mips_tdep): Do not set deprecated_tm_print_insn. (mips_gdbarch_init): Set "print_insn". Delete initialization of deprecated_tm_print_insn_info. - + 2003-08-27 Andrew Cagney <cagney@redhat.com> * s390-tdep.c (s390_readinstruction): Delete "info" parameter. @@ -1117,7 +3349,7 @@ 2003-08-26 Jeff Johnston <jjohnstn@redhat.com> * ia64-tdep.c (examine_prologue): Only stop at predicated insns if - we are frameless or the return address register is already known. + we are frameless or the return address register is already known. 2003-08-26 Andrew Cagney <cagney@redhat.com> @@ -1127,7 +3359,7 @@ 2003-08-26 Jeff Johnston <jjohnstn@redhat.com> * ia64-tdep.c (ia64_convert_from_func_addr): New function. - (ia64_gdbarch_init): Call set_gdbarch_convert_from_func_addr(). + (ia64_gdbarch_init): Call set_gdbarch_convert_from_func_addr(). 2003-08-26 Jason Merrill <jason@redhat.com> @@ -1143,21 +3375,21 @@ 2003-08-25 Jeff Johnston <jjohnstn@redhat.com> - * ia64-tdep.c (pseudo_regs): New enum that lists gr32-gr127, p0-p63, + * ia64-tdep.c (pseudo_regs): New enum that lists gr32-gr127, p0-p63, bof, and nat0-nat127 as pseudo-registers. (ia64_frame_cache): New struct used to cache frame info. (ia64_register_reggroup_p): New routine used to override default - register grouping so registers without names are still saved and + register grouping so registers without names are still saved and restored. - (ia64_dwarf_reg_to_regnum): New routine to map gr32-gr127 to their + (ia64_dwarf_reg_to_regnum): New routine to map gr32-gr127 to their pseudo values. (ia64_pseudo_register_read): New routine to read pseudo-registers. (ia64_pseudo_register_write): New routine to write pseudo-registers. - (ia64_alloc_frame_cache): New routine to create a new + (ia64_alloc_frame_cache): New routine to create a new ia64_frame_cache. (examine_prologue): Change prototype to add next_frame pointer. Assume frameless until otherwise proven. Verify that the cfm for - current frame matches the cfm that should occur for the prologues + current frame matches the cfm that should occur for the prologues alloc insn and if equal, mark as not frameless. At end of routine, if not frameless, calculate registers for the previous frame and store in the cache, if a cache is provided. @@ -1178,7 +3410,7 @@ (ia64_extract_struct_value_address): Change to issue error message. (ia64_frame_align): New routine to align sp. (ia64_push_dummy_call): New routine based on ia64_push_arguments(). - (ia64_push_arguments): Removed. Logic moved to + (ia64_push_arguments): Removed. Logic moved to ia64_push_dummy_call(). (ia64_push_return_address): Ditto. (ia64_unwind_dummy_id): New function. @@ -1319,7 +3551,7 @@ prototype. (i387_supply_register): remove prototype. Update comments. - + 2003-08-22 Michael Chastain <mec@shout.net> * config/djgpp/fnchange.lst: Remove gdb/testsuite/gdb.c++/*. @@ -1345,7 +3577,7 @@ call set_height_command. Remove redundant code that turns off pagination if output isn't a terminal. Remove redundant call to set_width_command. - + 2003-08-22 Mark Kettenis <kettenis@gnu.org> * sparc64-tdep.h (sparc64_regnum): Fix comment. @@ -1463,14 +3695,14 @@ is subject to DECR_PC_AFTER_BREAK. (set_traceframe_context): Make "trace_line" an int. Fixes suggested by Mark Newman <mark.newman@lmco.com> - + 2003-08-20 Michael Snyder <msnyder@redhat.com> * sh-tdep.h (struct gdbarch_tdep): New member FLOAT_ARGLAST_REG. - * sh-tdep.c (sh_gdbarch_init): For sh2e, sh3e, and sh4, set - FLOAT_ARG0_REGNUM and FLOAT_ARGLAST_REGNUM, to be used for + * sh-tdep.c (sh_gdbarch_init): For sh2e, sh3e, and sh4, set + FLOAT_ARG0_REGNUM and FLOAT_ARGLAST_REGNUM, to be used for argument passing. - (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu): New + (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu): New functions, replace sh_push_dummy_call. (sh_gdbarch_init): Set push_dummy_call to one of new methods. @@ -1509,7 +3741,7 @@ 2003-08-19 Shrinivas Atre <shrinivasa@kpitcummins.com> * MAINTAINERS (write after approval): Add myself. - + 2003-08-18 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_RED_ZONE_SIZE): New architecture method. @@ -1544,7 +3776,7 @@ Define. * i386-linux-nat.c: Include "linux-nat.h". (child_post_startup_inferior): New function. - + 2003-08-18 Mark Kettenis <kettenis@gnu.org> * i386-tdep.c (i386_analyze_register_saves): Handle register saves @@ -1651,7 +3883,7 @@ (hppa64_hpux_frame_find_saved_regs_in_sigtramp): New function. * config/pa/tm-hppa64.h: Remove macros that are no longer necessary now that the gdbarch vector is properly setup. - Transform some macros into function calls. Some minor cleanup. + Transform some macros into function calls. Some minor cleanup. * config/pa/tm-hppah.h: Update function calls in macros following the function renaming in hppa-hpux-tdep.c. * Makefile.in (hppa_tdep_h): New variable. @@ -1999,7 +4231,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> * configure.tgt: Recognize m32r-*-*. * config/m32r/tm-m32r.h: Delete file. * config/m32r/m32r.mt: New file. - * m32r-rom.c (m32r_upload_command): Use hostent only when + * m32r-rom.c (m32r_upload_command): Use hostent only when gethostname succeeds, in order to avoid a compilation warning. * m32r-tdep.c (m32r_store_return_value): Add a cast to remove a @@ -2039,7 +4271,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> 2003-07-30 Michael Snyder <msnyder@redhat.com> * value.h (value_being_returned): Add a struct_addr argument. - * infcall.c (call_function_by_hand): Pass struct_addr to + * infcall.c (call_function_by_hand): Pass struct_addr to value_being_returned. * infcmd.c (print_return_value): Pass zero as struct_addr. * values.c (value_being_returned): If struct_addr is passed, @@ -2212,7 +4444,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> 2003-07-23 Michal Ludvig <mludvig@suse.cz> Elena Zannoni <ezannoni@redhat.com> - * linespec.c (decode_line_2): Avoid crash if + * linespec.c (decode_line_2): Avoid crash if find_function_start_sal() returns empty record. 2003-07-23 Andreas Schwab <schwab@suse.de> @@ -2248,7 +4480,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> (struct gdbarch_data): Delete member "free". (register_gdbarch_data): Do not initialize "free". * gdbarch.h, gdbarch.c: Re-generate. - + 2003-07-22 Andrew Cagney <cagney@redhat.com> * configure.in (build_warnings): Add -Wformat-nonliteral. @@ -2294,7 +4526,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> 2003-07-20 Stephane Carrez <stcarrez@nerim.fr> - * m68hc11-tdep.c (m68hc11_pseudo_register_read): Use + * m68hc11-tdep.c (m68hc11_pseudo_register_read): Use regcache_cooked_read_unsigned instead of read_register. (m68hc11_saved_pc_after_call): Likewise. (m68hc11_pseudo_register_write): Use regcache_cooked_write_unsigned @@ -2374,7 +4606,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> Update a comment. Save the computed prev_sp. (avr_saved_regs_unwinder): Remove function. - (avr_frame_prev_register): Use PC unwind logic from + (avr_frame_prev_register): Use PC unwind logic from avr_saved_regs_unwinder(), otherwise use trad_frame_prev_register(). 2003-07-16 Andrew Cagney <cagney@redhat.com> @@ -2554,7 +4786,7 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> 2003-07-15 Michal Ludvig <mludvig@suse.cz> * x86-64-linux-nat.c (regmap): Removed. - (supply_gregset, fill_gregset): Call + (supply_gregset, fill_gregset): Call x86_64_linux_(fill,supply)_gregset functions. * x86-64-linux-tdep.c (USER_*): New defines. (user_to_gdb_regmap, x86_64_core_fns): New structure. @@ -2631,19 +4863,19 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> * gdbarch.sh: Simplify predicate methods. Remove need to provide pre-default. Note: re-generate has no effect. - + 2003-07-10 Andrew Cagney <cagney@redhat.com> * gdbarch.sh: When a variable, but not a function, compare against 0. Fix problem in previous patch. * gdbarch.c: Re-generate. - + 2003-07-10 Andrew Cagney <cagney@redhat.com> * gdbarch.sh: Use gdb_assert instead of internal_error. Compare functions against NULL, not 0. * gdbarch.c: Re-generate. - + 2003-07-10 Fred Fish <fnf@ninemoons.com> * coff-solib.h (SOLIB_LOADED_LIBRARY_PATHNAME): Default to a @@ -2675,9 +4907,9 @@ Fri Aug 8 00:28:38 UTC 2003 Brendan Conoboy <blc@redhat.com> * m68klinux-tdep.c (m68k_linux_init_abi): Set struct_return to reg_struct_return. -2003-07-09 Joel Brobecker <brobecker@gnat.com> +2003-07-09 Joel Brobecker <brobecker@gnat.com> - * somread.c (som_symfile_offsets): Fix compilation error. + * somread.c (som_symfile_offsets): Fix compilation error. 2003-07-09 Andrew Cagney <cagney@redhat.com> diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index d47dbbc..ecf0df0 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -85,7 +85,7 @@ maintainer works with the native maintainer when resolving API issues. h8300 --target=h8300hms ,-Werror Maintenance only - h8500 (--target=h8500hms OBSOLETE) + h8500 Deleted. i386 --target=i386-elf ,-Werror Mark Kettenis kettenis@gnu.org @@ -96,7 +96,7 @@ maintainer works with the native maintainer when resolving API issues. (--target=ia64-elf broken) Kevin Buettner kevinb@redhat.com - m32r (--target=m32r-elf OBSOLETE) + m32r --target=m32r-elf ,-Werror m68hc11 --target=m68hc11-elf ,-Werror , Stephane Carrez stcarrez@nerim.fr @@ -112,7 +112,7 @@ maintainer works with the native maintainer when resolving API issues. mips --target=mips-elf ,-Werror Andrew Cagney cagney@redhat.com - mn10200 (--target=mn10200-elf OBSOLETE) + mn10200 Deleted. mn10300 --target=mn10300-elf ,-Werror Maintenance only @@ -122,7 +122,6 @@ maintainer works with the native maintainer when resolving API issues. pa (--target=hppa-elf broken) Maintenance only - OBSOLETE candidate, not multi-arch powerpc --target=powerpc-eabi ,-Werror Kevin Buettner kevinb@redhat.com @@ -152,7 +151,7 @@ maintainer works with the native maintainer when resolving API issues. xstormy16 --target=xstormy16-elf ,-Werror Corinna Vinschen vinschen@redhat.com - z8k (--target=z8k-coff OBSOLETE) + z8k Deleted. All developers recognized by this file can make arbitrary changes to OBSOLETE targets. @@ -200,7 +199,7 @@ GNU/Linux ARM native Scott Bambrough scottb@netwinder.org Solaris/x86 native & host (devolved) Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de Solaris/SPARC native & host (devolved) - Michael Snyder msnyder@redhat.com + (Global Maintainers) @@ -234,7 +233,7 @@ tracing bytecode stuff Jim Blandy jimb@redhat.com tracing Michael Snyder msnyder@redhat.com threads Michael Snyder msnyder@redhat.com Mark Kettenis kettenis@gnu.org -breakpoints Michael Snyder msnyder@redhat.com +breakpoints (Global Maintainers) language support (Blanket Write Privs Maintainers) C++ Daniel Jacobowitz dan@debian.org Java support (Global Maintainers) @@ -254,7 +253,7 @@ testsuite (Global Maintainers) 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 + c++ (gdb.cp) Michael Chastain mec.gnu@mindspring.com David Carlton carlton@kealia.com mi tests (gdb.mi) Elena Zannoni ezannoni@redhat.com Andrew Cagney cagney@redhat.com @@ -321,7 +320,7 @@ Kevin Buettner kevinb@redhat.com Andrew Cagney ac131313@redhat.com David Carlton carlton@kealia.com Stephane Carrez stcarrez@nerim.fr -Michael Chastain mec@shout.net +Michael Chastain mec.gnu@mindspring.com Eric Christopher echristo@redhat.com Nick Clifton nickc@redhat.com Brendan Conoboy blc@redhat.com @@ -335,6 +334,7 @@ Ben Elliston bje@wasabisystems.com Raoul Gough RaoulGough@yahoo.co.uk Anthony Green green@redhat.com Matthew Green mrg@eterna.com.au +Jerome Guitton guitton@act-europe.fr Chris Faylor cgf@redhat.com Adam Fedor fedor@gnu.org Fred Fish fnf@ninemoons.com @@ -399,6 +399,7 @@ D Venkatasubramanian dvenkat@noida.hcltech.com Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com Kris Warkentin kewarken@qnx.com +Jim Wilson wilson@specifixinc.com Elena Zannoni ezannoni@redhat.com Eli Zaretskii eliz@gnu.org @@ -422,7 +423,6 @@ Anthony Green (Java) green at redhat dot com Folks that have been caught up in a paper trail: Jim Kingdon jkingdon@engr.sgi.com -Jim Wilson wilson@specifixinc.com -- diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 270007e..dac5496 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -511,7 +511,9 @@ TARGET_FLAGS_TO_PASS = \ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ ax-general.c ax-gdb.c \ - bcache.c block.c blockframe.c breakpoint.c buildsym.c \ + bcache.c \ + bfd-target.c \ + block.c blockframe.c breakpoint.c buildsym.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 \ @@ -576,7 +578,7 @@ 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 +dis_asm_h = $(INCLUDE_DIR)/dis-asm.h $(bfd_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) @@ -588,9 +590,11 @@ demangle_h = $(INCLUDE_DIR)/demangle.h obstack_h = $(INCLUDE_DIR)/obstack.h opcode_m68hc11_h = $(INCLUDE_DIR)/opcode/m68hc11.h readline_h = $(READLINE_SRC)/readline.h +frv_desc_h = $(OPCODES_SRC)/frv-desc.h sh_opc_h = $(OPCODES_SRC)/sh-opc.h gdb_sim_arm_h = $(INCLUDE_DIR)/gdb/sim-arm.h gdb_sim_d10v_h = $(INCLUDE_DIR)/gdb/sim-d10v.h +gdb_sim_frv_h = $(INCLUDE_DIR)/gdb/sim-frv.h gdb_sim_sh_h = $(INCLUDE_DIR)/gdb/sim-sh.h splay_tree_h = $(INCLUDE_DIR)/splay-tree.h @@ -634,6 +638,7 @@ arm_tdep_h = arm-tdep.h ax_gdb_h = ax-gdb.h ax_h = ax.h $(doublest_h) bcache_h = bcache.h +bfd_target_h = bfd-target.h block_h = block.h breakpoint_h = breakpoint.h $(frame_h) $(value_h) $(gdb_events_h) buildsym_h = buildsym.h @@ -662,6 +667,7 @@ dwarf2loc_h = dwarf2loc.h environ_h = environ.h event_loop_h = event-loop.h event_top_h = event-top.h +exec_h = exec.h $(target_h) expression_h = expression.h $(symtab_h) $(doublest_h) f_lang_h = f-lang.h frame_base_h = frame-base.h @@ -686,6 +692,7 @@ gdbthread_h = gdbthread.h $(breakpoint_h) $(frame_h) gdbtypes_h = gdbtypes.h gdb_vfork_h = gdb_vfork.h gdb_wait_h = gdb_wait.h +glibc_tdep_h = glibc-tdep.h gnu_nat_h = gnu-nat.h gregset_h = gregset.h hppa_tdep_h = hppa-tdep.h @@ -730,6 +737,7 @@ ppc_tdep_h = ppc-tdep.h proc_utils_h = proc-utils.h regcache_h = regcache.h reggroups_h = reggroups.h +regset_h = regset.h remote_fileio_h = remote-fileio.h remote_h = remote.h remote_utils_h = remote-utils.h $(target_h) @@ -865,8 +873,10 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \ $(SUBDIR_CLI_SRCS) TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) -COMMON_OBS = version.o block.o blockframe.o breakpoint.o findvar.o regcache.o \ - charset.o dictionary.o disasm.o dummy-frame.o \ +COMMON_OBS = version.o \ + bfd-target.o \ + blockframe.o breakpoint.o findvar.o regcache.o \ + charset.o disasm.o dummy-frame.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ block.o symtab.o symfile.o symmisc.o linespec.o dictionary.o \ infcall.o \ @@ -1259,12 +1269,13 @@ ALLDEPFILES = \ coff-solib.c \ core-sol2.c core-regset.c core-aout.c corelow.c \ dcache.c delta68-nat.c dpx2-nat.c exec.c fork-child.c \ - go32-nat.c h8300-tdep.c h8500-tdep.c \ + glibc-tdep.c \ + go32-nat.c h8300-tdep.c \ 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 i386-cygwin-tdep.c \ - i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c \ + i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c i386fbsd-tdep.c \ i387-tdep.c \ i386-linux-tdep.c i386-nat.c \ i386gnu-nat.c i386gnu-tdep.c \ @@ -1286,7 +1297,7 @@ ALLDEPFILES = \ ppcnbsd-nat.o ppcnbsd-tdep.o \ procfs.c \ remote-e7000.c \ - remote-hms.c remote-mips.c \ + remote-hms.c remote-m32r-sdi.c remote-mips.c \ remote-rdp.c remote-sim.c \ remote-st.c remote-utils.c dcache.c \ remote-vx.c \ @@ -1303,8 +1314,7 @@ ALLDEPFILES = \ vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \ win32-nat.c \ xcoffread.c xcoffsolib.c \ - xstormy16-tdep.c \ - z8k-tdep.c + xstormy16-tdep.c # Some files need explict build rules (due to -Werror problems) or due # to sub-directory fun 'n' games. @@ -1362,13 +1372,6 @@ v850ice.o: $(srcdir)/v850ice.c valprint.o: $(srcdir)/valprint.c $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $(srcdir)/valprint.c -# FIXME: z8k-tdep.c calls _initialize_gdbtypes(). Since that isn't -# declared -Wimplicit fails. It should be using the GDBARCH framework. -# cagney 1999-09-02. -z8k-tdep.o: $(srcdir)/z8k-tdep.c - $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \ - $(srcdir)/z8k-tdep.c - # # YACC/LEX dependencies # @@ -1561,20 +1564,27 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(doublest_h) $(frame_h) \ $(symfile_h) $(objfiles_h) $(gdb_string_h) $(linespec_h) \ $(regcache_h) $(reggroups_h) $(arch_utils_h) $(osabi_h) $(block_h) \ $(elf_bfd_h) $(alpha_tdep_h) +amd64bsd-nat.o: amd64bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ + $(gdb_assert_h) $(x86_64_tdep_h) $(amd64_nat_h) amd64fbsd-nat.o: amd64fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(gdb_assert_h) $(gregset_h) $(x86_64_tdep_h) $(amd64_nat_h) +amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) \ + $(x86_64_tdep_h) $(amd64_nat_h) amd64fbsd-tdep.o: amd64fbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ $(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) \ $(x86_64_tdep_h) +amd64nbsd-tdep.o: amd64nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ + $(gdbcore_h) $(osabi_h) $(gdb_assert_h) $(nbsd_tdep_h) \ + $(x86_64_tdep_h) amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \ $(gdb_assert_h) $(i386_tdep_h) $(x86_64_tdep_h) annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \ $(gdbtypes_h) $(breakpoint_h) -arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) \ - $(inferior_h) $(gdb_string_h) $(regcache_h) $(gdb_assert_h) \ - $(sim_regno_h) $(version_h) $(floatformat_h) +arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \ + $(gdbcmd_h) $(inferior_h) $(gdb_string_h) $(regcache_h) \ + $(gdb_assert_h) $(sim_regno_h) $(version_h) $(floatformat_h) arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ - $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h) + $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(glibc_tdep_h) $(gregset_h) arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ $(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \ $(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) $(symtab_h) \ @@ -1598,7 +1608,10 @@ ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) \ $(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h) $(block_h) \ $(regcache_h) ax-general.o: ax-general.c $(defs_h) $(ax_h) $(value_h) $(gdb_string_h) -bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(gdb_string_h) +bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) \ + $(gdb_string_h) $(gdb_assert_h) +bfd-target.o: bfd-target.c $(defs_h) $(target_h) $(bfd_target_h) \ + $(gdb_assert_h) $(gdb_string_h) block.o: block.c $(defs_h) $(block_h) $(symtab_h) $(symfile_h) \ $(gdb_obstack_h) $(cp_support_h) blockframe.o: blockframe.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \ @@ -1638,7 +1651,8 @@ coff-solib.o: coff-solib.c $(defs_h) $(frame_h) $(bfd_h) $(gdbcore_h) \ complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \ $(command_h) $(gdbcmd_h) completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ - $(filenames_h) $(cli_decode_h) $(gdbcmd_h) $(completer_h) + $(filenames_h) $(cli_decode_h) $(gdbcmd_h) $(completer_h) \ + $(language_h) copying.o: copying.c $(defs_h) $(command_h) $(gdbcmd_h) core-aout.o: core-aout.c $(defs_h) $(gdbcore_h) $(value_h) $(regcache_h) \ $(gdb_dirent_h) $(gdb_stat_h) @@ -1647,7 +1661,7 @@ corefile.o: corefile.c $(defs_h) $(gdb_string_h) $(inferior_h) $(symtab_h) \ $(dis_asm_h) $(gdb_stat_h) $(completer_h) corelow.o: corelow.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(command_h) $(bfd_h) $(target_h) $(gdbcore_h) \ - $(gdbthread_h) $(regcache_h) $(symfile_h) + $(gdbthread_h) $(regcache_h) $(symfile_h) $(exec_h) core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(gdb_string_h) $(gregset_h) core-sol2.o: core-sol2.c $(defs_h) $(gdb_string_h) $(regcache_h) \ @@ -1675,8 +1689,8 @@ c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ $(gdb_string_h) c-valprint.o: c-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \ - $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \ - $(c_lang_h) $(cp_abi_h) + $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) \ + $(language_h) $(c_lang_h) $(cp_abi_h) $(target_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) \ @@ -1689,7 +1703,7 @@ dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \ $(gdb_stat_h) $(symtab_h) $(breakpoint_h) $(target_h) $(gdbcore_h) \ $(libaout_h) $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \ $(gdb_stabs_h) $(demangle_h) $(language_h) $(complaints_h) \ - $(cp_abi_h) $(aout_aout64_h) $(aout_stab_gnu_h) $(gdb_assert_h) + $(cp_abi_h) $(gdb_assert_h) $(aout_aout64_h) $(aout_stab_gnu_h) dcache.o: dcache.c $(defs_h) $(dcache_h) $(gdbcmd_h) $(gdb_string_h) \ $(gdbcore_h) $(target_h) delta68-nat.o: delta68-nat.c $(defs_h) @@ -1735,7 +1749,8 @@ elfread.o: elfread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(elf_bfd_h) \ environ.o: environ.c $(defs_h) $(environ_h) $(gdb_string_h) eval.o: eval.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(expression_h) $(target_h) $(frame_h) $(language_h) \ - $(f_lang_h) $(cp_abi_h) $(infcall_h) $(objc_lang_h) $(block_h) + $(f_lang_h) $(cp_abi_h) $(infcall_h) $(objc_lang_h) $(block_h) \ + $(parser_defs_h) event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \ $(gdb_string_h) event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \ @@ -1743,7 +1758,8 @@ event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \ $(gdbcmd_h) exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \ $(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \ - $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h) + $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h) \ + $(exec_h) expprint.o: expprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(value_h) $(language_h) $(parser_defs_h) $(user_regs_h) $(target_h) \ $(gdb_string_h) $(block_h) @@ -1769,15 +1785,17 @@ frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(gdb_assert_h) $(dummy_frame_h) frv-tdep.o: frv-tdep.c $(defs_h) $(gdb_string_h) $(inferior_h) $(symfile_h) \ $(gdbcore_h) $(arch_utils_h) $(regcache_h) $(frame_h) \ - $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(dis_asm_h) + $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(dis_asm_h) \ + $(gdb_assert_h) $(sim_regno_h) $(gdb_sim_frv_h) $(frv_desc_h) f-typeprint.o: f-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(f_lang_h) $(gdb_string_h) f-valprint.o: f-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \ $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h) $(block_h) -gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \ - $(elf_bfd_h) $(symfile_h) $(objfiles_h) $(infcall_h) +gcore.o: gcore.c $(defs_h) $(elf_bfd_h) $(infcall_h) $(inferior_h) \ + $(gdbcore_h) $(objfiles_h) $(symfile_h) $(cli_decode_h) \ + $(gdb_assert_h) gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \ $(symcat_h) $(floatformat_h) $(gdb_assert_h) $(gdb_string_h) \ $(gdb_events_h) $(reggroups_h) $(osabi_h) $(symfile_h) \ @@ -1804,7 +1822,6 @@ go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) $(gdb_wait_h) $(gdbcore_h) \ h8300-tdep.o: h8300-tdep.c $(defs_h) $(value_h) $(inferior_h) $(symfile_h) \ $(arch_utils_h) $(regcache_h) $(gdbcore_h) $(objfiles_h) $(gdbcmd_h) \ $(gdb_assert_h) $(dis_asm_h) -# OBSOLETE h8500-tdep.o: h8500-tdep.c hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \ $(gdbtypes_h) $(gdbcore_h) $(cp_abi_h) hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) @@ -1816,10 +1833,9 @@ hppam3-nat.o: hppam3-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ $(regcache_h) hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \ $(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \ - $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(infcall_h) \ + $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(infcall_h) $(dis_asm_h) \ $(a_out_encap_h) $(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) \ - $(gdbcmd_h) $(target_h) $(symfile_h) $(objfiles_h) $(hppa_tdep_h) \ - $(dis_asm_h) + $(gdbcmd_h) $(target_h) $(symfile_h) $(objfiles_h) $(hppa_tdep_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) \ @@ -1835,6 +1851,8 @@ i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \ $(i386_tdep_h) i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(i386_tdep_h) +i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ + $(i386_tdep_h) $(i387_tdep_h) i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ $(regcache_h) $(gdb_assert_h) $(i386_tdep_h) $(gnu_nat_h) \ $(i387_tdep_h) $(gregset_h) @@ -1852,7 +1870,7 @@ i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \ $(value_h) $(regcache_h) $(inferior_h) $(reggroups_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(solib_svr4_h) $(osabi_h) $(i386_tdep_h) \ - $(i386_linux_tdep_h) + $(i386_linux_tdep_h) $(glibc_tdep_h) i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(target_h) $(osabi_h) $(i386_tdep_h) i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h) @@ -1872,9 +1890,9 @@ i386-tdep.o: i386-tdep.c $(defs_h) $(arch_utils_h) $(command_h) \ $(dummy_frame_h) $(dwarf2_frame_h) $(doublest_h) $(floatformat_h) \ $(frame_h) $(frame_base_h) $(frame_unwind_h) $(inferior_h) \ $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(osabi_h) $(regcache_h) \ - $(reggroups_h) $(symfile_h) $(symtab_h) $(target_h) $(value_h) \ - $(dis_asm_h) $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) \ - $(i387_tdep_h) + $(reggroups_h) $(regset_h) $(symfile_h) $(symtab_h) $(target_h) \ + $(value_h) $(dis_asm_h) $(gdb_assert_h) $(gdb_string_h) \ + $(i386_tdep_h) $(i387_tdep_h) i386v4-nat.o: i386v4-nat.c $(defs_h) $(value_h) $(inferior_h) $(regcache_h) \ $(i386_tdep_h) $(i387_tdep_h) $(gregset_h) i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \ @@ -1924,8 +1942,6 @@ infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_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) -irix4-nat.o: irix4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) \ - $(gregset_h) irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(regcache_h) $(gdb_string_h) $(gregset_h) jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ @@ -1973,8 +1989,7 @@ m32r-tdep.o: m32r-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) $(symfile_h) $(objfiles_h) \ $(language_h) $(arch_utils_h) $(regcache_h) $(trad_frame_h) \ - $(gdb_assert_h) -# OBSOLETE m3-nat.o: m3-nat.c + $(gdb_assert_h) $(dis_asm_h) m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(frame_base_h) $(dwarf2_frame_h) $(trad_frame_h) $(symtab_h) \ $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \ @@ -1993,10 +2008,11 @@ m68knbsd-nat.o: m68knbsd-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ $(regcache_h) m68knbsd-tdep.o: m68knbsd-tdep.c $(defs_h) $(gdbtypes_h) $(regcache_h) m68k-stub.o: m68k-stub.c -m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(frame_base_h) \ - $(frame_unwind_h) $(symtab_h) $(gdbcore_h) $(value_h) \ - $(gdb_string_h) $(gdb_assert_h) $(inferior_h) $(regcache_h) \ - $(arch_utils_h) $(osabi_h) $(dis_asm_h) $(m68k_tdep_h) $(gregset_h) +m68k-tdep.o: m68k-tdep.c $(defs_h) $(dwarf2_frame_h) $(frame_h) \ + $(frame_base_h) $(frame_unwind_h) $(symtab_h) $(gdbcore_h) \ + $(value_h) $(gdb_string_h) $(gdb_assert_h) $(inferior_h) \ + $(regcache_h) $(arch_utils_h) $(osabi_h) $(dis_asm_h) $(m68k_tdep_h) \ + $(gregset_h) macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) $(macroscope_h) \ $(command_h) $(gdbcmd_h) macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \ @@ -2034,7 +2050,6 @@ mips-linux-nat.o: mips-linux-nat.c $(defs_h) mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ $(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \ $(gdb_assert_h) -# OBSOLETE mipsm3-nat.o: mipsm3-nat.c mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(mipsnbsd_tdep_h) @@ -2053,7 +2068,6 @@ mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \ $(elf_bfd_h) $(symcat_h) $(sim_regno_h) $(dis_asm_h) mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(regcache_h) $(gregset_h) -# OBSOLETE mn10200-tdep.o: mn10200-tdep.c mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \ $(symfile_h) $(regcache_h) $(arch_utils_h) $(gdb_assert_h) \ @@ -2098,7 +2112,7 @@ osabi.o: osabi.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(osabi_h) \ pa64solib.o: pa64solib.c $(defs_h) $(frame_h) $(bfd_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) $(exec_h) parse.o: parse.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(frame_h) $(expression_h) $(value_h) $(command_h) $(language_h) \ $(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \ @@ -2125,7 +2139,8 @@ ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ $(target_h) $(breakpoint_h) $(value_h) $(osabi_h) $(ppc_tdep_h) \ $(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h) ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ - $(regcache_h) $(value_h) $(gdb_string_h) $(ppc_tdep_h) + $(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \ + $(ppc_tdep_h) $(target_h) printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \ $(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \ $(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \ @@ -2169,6 +2184,8 @@ remote-fileio.o: remote-fileio.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \ $(remote_fileio_h) remote-hms.o: remote-hms.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(regcache_h) +remote-m32r-sdi.o: remote-m32r-sdi.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ + $(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(serial_h) remote-mips.o: remote-mips.c $(defs_h) $(inferior_h) $(bfd_h) $(symfile_h) \ $(gdbcmd_h) $(gdbcore_h) $(serial_h) $(target_h) $(remote_utils_h) \ $(gdb_string_h) $(gdb_stat_h) $(regcache_h) @@ -2252,22 +2269,23 @@ ser-unix.o: ser-unix.c $(defs_h) $(serial_h) $(ser_unix_h) $(terminal_h) \ sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h) \ $(sh_tdep_h) +sh64-tdep.o: sh64-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ + $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) \ + $(inferior_h) $(gdb_string_h) $(arch_utils_h) $(floatformat_h) \ + $(regcache_h) $(doublest_h) $(osabi_h) $(elf_bfd_h) $(solib_svr4_h) \ + $(elf_sh_h) $(gdb_sim_sh_h) shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(sh_tdep_h) \ $(shnbsd_tdep_h) shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \ $(osabi_h) $(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) \ $(shnbsd_tdep_h) sh-stub.o: sh-stub.c -sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ - $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) \ - $(inferior_h) $(gdb_string_h) $(arch_utils_h) $(floatformat_h) \ - $(regcache_h) $(doublest_h) $(osabi_h) $(sh_tdep_h) $(elf_bfd_h) \ - $(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h) -sh64-tdep.o: sh64-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(symfile_h) \ - $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) \ - $(inferior_h) $(gdb_string_h) $(arch_utils_h) $(floatformat_h) \ - $(regcache_h) $(doublest_h) $(osabi_h) $(elf_bfd_h) \ - $(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h) +sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ + $(dwarf2_frame_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) $(gdbcmd_h) \ + $(gdbcore_h) $(value_h) $(dis_asm_h) $(inferior_h) $(gdb_string_h) \ + $(gdb_assert_h) $(arch_utils_h) $(floatformat_h) $(regcache_h) \ + $(doublest_h) $(osabi_h) $(sh_tdep_h) $(elf_bfd_h) $(solib_svr4_h) \ + $(elf_sh_h) $(gdb_sim_sh_h) solib-aix5.o: solib-aix5.c $(defs_h) $(gdb_string_h) $(elf_external_h) \ $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(gdbcore_h) \ $(command_h) $(target_h) $(frame_h) $(gdb_regex_h) $(inferior_h) \ @@ -2275,7 +2293,7 @@ solib-aix5.o: solib-aix5.c $(defs_h) $(gdb_string_h) $(elf_external_h) \ solib.o: solib.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) $(symfile_h) \ $(objfiles_h) $(gdbcore_h) $(command_h) $(target_h) $(frame_h) \ $(gdb_regex_h) $(inferior_h) $(environ_h) $(language_h) $(gdbcmd_h) \ - $(completer_h) $(filenames_h) $(solist_h) + $(completer_h) $(filenames_h) $(solist_h) $(exec_h) solib-irix.o: solib-irix.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \ $(objfiles_h) $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) solib-legacy.o: solib-legacy.c $(defs_h) $(gdbcore_h) $(solib_svr4_h) @@ -2286,17 +2304,18 @@ solib-sunos.o: solib-sunos.c $(defs_h) $(gdb_string_h) $(symtab_h) $(bfd_h) \ $(bcache_h) $(regcache_h) solib-svr4.o: solib-svr4.c $(defs_h) $(elf_external_h) $(elf_common_h) \ $(elf_mips_h) $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) \ - $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) $(solib_svr4_h) + $(gdbcore_h) $(target_h) $(inferior_h) $(solist_h) $(solib_svr4_h) \ + $(bfd_target_h) $(exec_h) sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) \ $(inferior_h) $(gdb_stat_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) \ - $(symfile_h) $(gregset_h) + $(symfile_h) $(gdb_string_h) $(gregset_h) somread.o: somread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(buildsym_h) $(stabsread_h) $(gdb_stabs_h) \ $(complaints_h) $(gdb_string_h) $(demangle_h) $(som_h) $(libhppa_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) $(gdb_assert_h) + $(regcache_h) $(gdb_assert_h) $(exec_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) \ @@ -2314,12 +2333,8 @@ sparc64-tdep.o: sparc64-tdep.c $(defs_h) $(arch_utils_h) $(floatformat_h) \ $(gdb_assert_h) $(gdb_string_h) $(sparc64_tdep_h) sparcbsd-nat.o: sparcbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(sparc64_tdep_h) $(sparcbsd_nat_h) -# OBSOLETE sparclet-rom.o: sparclet-rom.c -# OBSOLETE sparclet-stub.o: sparclet-stub.c sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(sparc_tdep_h) \ $(gregset_h) -# OBSOLETE sparcl-stub.o: sparcl-stub.c -# OBSOLETE sparcl-tdep.o: sparcl-tdep.c sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(regcache_h) $(sparc_tdep_h) $(gdb_wait_h) sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ @@ -2341,7 +2356,7 @@ stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(language_h) $(frame_h) $(gdbcmd_h) \ $(gdbcore_h) $(target_h) $(source_h) $(breakpoint_h) $(demangle_h) \ $(inferior_h) $(annotate_h) $(ui_out_h) $(block_h) $(stack_h) \ - $(gdb_assert_h) $(dictionary_h) + $(gdb_assert_h) $(dictionary_h) $(reggroups_h) $(regcache_h) standalone.o: standalone.c $(gdb_stat_h) $(defs_h) $(symtab_h) $(frame_h) \ $(inferior_h) $(gdb_wait_h) std-regs.o: std-regs.c $(defs_h) $(user_regs_h) $(frame_h) $(gdbtypes_h) \ @@ -2359,8 +2374,6 @@ 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) $(block_h) $(gdb_regex_h) \ $(dictionary_h) $(gdb_string_h) -# OBSOLETE symm-nat.o: symm-nat.c -# OBSOLETE symm-tdep.o: symm-tdep.c 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) \ @@ -2370,7 +2383,8 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(cp_support_h) target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \ $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \ - $(gdb_wait_h) $(dcache_h) $(regcache_h) + $(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) \ + $(gdbcore_h) thread.o: thread.c $(defs_h) $(symtab_h) $(frame_h) $(inferior_h) \ $(environ_h) $(value_h) $(target_h) $(gdbthread_h) $(command_h) \ $(gdbcmd_h) $(regcache_h) $(gdb_h) $(gdb_string_h) $(ui_out_h) @@ -2406,6 +2420,8 @@ utils.o: utils.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(event_top_h) \ $(filenames_h) $(inferior_h) $(mmalloc_h) uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \ $(regcache_h) $(gregset_h) +glibc-tdep.o: glibc-tdep.c $(defs_h) $(frame_h) $(symtab_h) \ + $(symfile_h) $(objfiles_h) $(glibc_tdep_h) v850ice.o: v850ice.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \ $(inferior_h) $(breakpoint_h) $(symfile_h) $(target_h) $(objfiles_h) \ $(gdbcore_h) $(value_h) $(command_h) $(regcache_h) @@ -2418,7 +2434,8 @@ valarith.o: valarith.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \ valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \ $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \ $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(block_h) $(infcall_h) \ - $(dictionary_h) $(cp_support_h) $(gdb_string_h) $(gdb_assert_h) + $(dictionary_h) $(cp_support_h) $(gdb_string_h) $(gdb_assert_h) \ + $(cp_support_h) valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \ $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h) @@ -2433,10 +2450,10 @@ vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \ $(gdb_string_h) $(osabi_h) $(dis_asm_h) $(vax_tdep_h) w89k-rom.o: w89k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(xmodem_h) $(regcache_h) -win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \ - $(target_h) $(gdbcore_h) $(command_h) $(completer_h) $(regcache_h) \ - $(top_h) $(i386_tdep_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \ - $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) +win32-nat.o: win32-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ + $(gdbcore_h) $(command_h) $(completer_h) $(regcache_h) $(top_h) \ + $(i386_tdep_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \ + $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) wince.o: wince.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(command_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \ $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(wince_stub_h) \ @@ -2453,7 +2470,8 @@ x86-64-linux-tdep.o: x86-64-linux-tdep.c $(defs_h) $(inferior_h) \ x86-64-tdep.o: x86-64-tdep.c $(defs_h) $(arch_utils_h) $(block_h) \ $(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \ - $(symfile_h) $(gdb_assert_h) $(x86_64_tdep_h) $(i387_tdep_h) + $(regset_h) $(symfile_h) $(gdb_assert_h) $(x86_64_tdep_h) \ + $(i387_tdep_h) xcoffread.o: xcoffread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(gdb_stat_h) \ $(coff_internal_h) $(libcoff_h) $(coff_xcoff_h) $(libxcoff_h) \ $(coff_rs6000_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \ @@ -2465,7 +2483,6 @@ xmodem.o: xmodem.c $(defs_h) $(serial_h) $(target_h) $(xmodem_h) xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(value_h) $(inferior_h) \ $(symfile_h) $(arch_utils_h) $(regcache_h) $(gdbcore_h) \ $(objfiles_h) $(dis_asm_h) -# OBSOLETE z8k-tdep.o: z8k-tdep.c # # gdb/cli/ dependencies @@ -3,6 +3,14 @@ *** Changes since GDB 6.0: +* New native configurations + +NetBSD/amd64 x86_64-*-netbsd* + +* New debugging protocols + +M32R with SDI protocol m32r-*-elf* + * "set prompt-escape-char" command deleted. The command "set prompt-escape-char" has been deleted. This command, @@ -13,9 +21,83 @@ tested, nor mentioned in the NEWS file. SGI Irix-4.x mips-sgi-irix4 or iris4 SGI Iris (MIPS) running Irix V3: mips-sgi-irix or iris +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 *** Changes in GDB 6.0: +* Objective-C + +Support for debugging the Objective-C programming language has been +integrated into GDB. + +* New backtrace mechanism (includes DWARF 2 Call Frame Information). + +DWARF 2's Call Frame Information makes available compiler generated +information that more exactly describes the program's run-time stack. +By using this information, GDB is able to provide more robust stack +backtraces. + +The i386, amd64 (nee, x86-64), Alpha, m68hc11, ia64, and m32r targets +have been updated to use a new backtrace mechanism which includes +DWARF 2 CFI support. + +* Hosted file I/O. + +GDB's remote protocol has been extended to include support for hosted +file I/O (where the remote target uses GDB's file system). See GDB's +remote protocol documentation for details. + +* All targets using the new architecture framework. + +All of GDB's targets have been updated to use the new internal +architecture framework. The way is now open for future GDB releases +to include cross-architecture native debugging support (i386 on amd64, +ppc32 on ppc64). + +* GNU/Linux's Thread Local Storage (TLS) + +GDB now includes support for for the GNU/Linux implementation of +per-thread variables. + +* GNU/Linux's Native POSIX Thread Library (NPTL) + +GDB's thread code has been updated to work with either the new +GNU/Linux NPTL thread library or the older "LinuxThreads" library. + +* Separate debug info. + +GDB, in conjunction with BINUTILS, now supports a mechanism for +automatically loading debug information from a separate file. Instead +of shipping full debug and non-debug versions of system libraries, +system integrators can now instead ship just the stripped libraries +and optional debug files. + +* DWARF 2 Location Expressions + +DWARF 2 Location Expressions allow the compiler to more completely +describe the location of variables (even in optimized code) to the +debugger. + +GDB now includes preliminary support for location expressions (support +for DW_OP_piece is still missing). + +* Java + +A number of long standing bugs that caused GDB to die while starting a +Java application have been fixed. GDB's Java support is now +considered "useable". + * GNU/Linux support for fork, vfork, and exec. The "catch fork", "catch exec", "catch vfork", and "set follow-fork-mode" @@ -67,7 +149,7 @@ FreeBSD/amd64 x86_64-*-freebsd* * Multi-arched targets. HP/PA HPUX11 hppa*-*-hpux* -Mitsubishi M32R/D w/simulator m32r-*-elf* +Renesas M32R/D w/simulator m32r-*-elf* * OBSOLETE configurations and files diff --git a/gdb/PROBLEMS b/gdb/PROBLEMS index 7480633..cf60d53 100644 --- a/gdb/PROBLEMS +++ b/gdb/PROBLEMS @@ -3,6 +3,26 @@ See also: http://www.gnu.org/software/gdb/bugs/ +mips*-*-* +powerpc*-*-* +sparc*-*-* + +GDB's SPARC, MIPS and PowerPC targets, in 6.0, have not been updated +to use the new frame mechanism. + +People encountering problems with these targets should consult GDB's +web pages and mailing lists (http://www.gnu.org/software/gdb/) to see +if there is an update. + +arm-*-* + +GDB's ARM target, in 6.0, has not been updated to use the new frame +mechanism. + +Fortunately the ARM target, in the GDB's mainline sources, has been +updated so people encountering problems should consider downloading a +more current GDB (http://www.gnu.org/software/gdb/current). + gdb/1091: Constructor breakpoints ignored gdb/1193: g++ 3.3 creates multiple constructors: gdb 5.3 can't set breakpoints @@ -462,9 +462,9 @@ Linux. There are a number of remote interfaces for talking to existing ROM monitors and other hardware: - remote-e7000.c Hitachi E7000 ICE + remote-e7000.c Renesas E7000 ICE remote-est.c EST emulator - remote-hms.c Hitachi Micro Systems H8/300 monitor + remote-hms.c Renesas Micro Systems H8/300 monitor remote-mips.c MIPS remote debugging protocol remote-rdi.c ARM with Angel monitor remote-rdp.c ARM with Demon monitor diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 13d393d..4ebbf44 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -8036,6 +8036,7 @@ const struct language_defn ada_language_defn = { 1, /* c-style arrays (FIXME?) */ 0, /* String lower bound (FIXME?) */ &builtin_type_ada_char, + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index da75f21..18ee0b1 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -852,7 +852,7 @@ pd_enable (void) return; /* Check application word size. */ - arch64 = REGISTER_RAW_SIZE (0) == 8; + arch64 = DEPRECATED_REGISTER_RAW_SIZE (0) == 8; /* Check whether the application is pthreaded. */ stub_name = NULL; @@ -1281,7 +1281,7 @@ fill_sprs64 (uint64_t *iar, uint64_t *msr, uint32_t *cr, they're not, then either GDB has been built incorrectly, or there's some other kind of internal error. To be really safe, we should check all of the sizes. */ - gdb_assert (sizeof (*iar) == REGISTER_RAW_SIZE (PC_REGNUM)); + gdb_assert (sizeof (*iar) == DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM)); if (register_cached (PC_REGNUM)) regcache_collect (PC_REGNUM, iar); @@ -1316,7 +1316,7 @@ fill_sprs32 (unsigned long *iar, unsigned long *msr, unsigned long *cr, built incorrectly. In order to make use of many of the header files in /usr/include/sys, GDB needs to be configured so that sizeof (long) == 4). */ - gdb_assert (sizeof (*iar) == REGISTER_RAW_SIZE (PC_REGNUM)); + gdb_assert (sizeof (*iar) == DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM)); if (register_cached (PC_REGNUM)) regcache_collect (PC_REGNUM, iar); diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index ddf2744..325cf19 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1136,11 +1136,6 @@ alpha_heuristic_frame_this_id (struct frame_info *next_frame, struct alpha_heuristic_unwind_cache *info = alpha_heuristic_frame_unwind_cache (next_frame, this_prologue_cache, 0); - /* This is meant to halt the backtrace at "_start". Make sure we - don't halt it at a generic dummy frame. */ - if (deprecated_inside_entry_file (info->start_pc)) - return; - *this_id = frame_id_build (info->vfp, info->start_pc); } diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index 9afe7be..828a3c6 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -23,8 +23,9 @@ #define ALPHA_TDEP_H /* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ + used in push_word and a few other places; + DEPRECATED_REGISTER_RAW_SIZE is the real way to know how big a + register is. */ #define ALPHA_REGISTER_SIZE 8 /* Number of machine registers. */ diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c index ed2d39b..2354fa3 100644 --- a/gdb/amd64fbsd-nat.c +++ b/gdb/amd64fbsd-nat.c @@ -129,7 +129,7 @@ fill_gregset (gregset_t *gregsetp, int regnum) void supply_fpregset (fpregset_t *fpregsetp) { - x86_64_supply_fxsave ((const char *) fpregsetp, -1); + x86_64_supply_fxsave (current_regcache, -1, fpregsetp); } /* Fill register REGNUM (if it is a floating-point register) in @@ -141,77 +141,6 @@ fill_fpregset (fpregset_t *fpregsetp, int regnum) { x86_64_fill_fxsave ((char *) fpregsetp, regnum); } - -/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this - for all registers (including the floating point registers). */ - -void -fetch_inferior_registers (int regnum) -{ - if (regnum == -1 || amd64_native_gregset_supplies_p (regnum)) - { - struct reg regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - amd64_supply_native_gregset (current_regcache, ®s, -1); - if (regnum != -1) - return; - } - - if (regnum == -1 || regnum >= FP0_REGNUM) - { - struct fpreg fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point status"); - - x86_64_supply_fxsave ((const char *) &fpregs, -1); - } -} - -/* Store register REGNUM back into the inferior. If REGNUM is -1, do - this for all registers (including the floating point registers). */ - -void -store_inferior_registers (int regnum) -{ - if (regnum == -1 || amd64_native_gregset_supplies_p (regnum)) - { - struct reg regs; - - if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't get registers"); - - amd64_collect_native_gregset (current_regcache, ®s, regnum); - - if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) ®s, 0) == -1) - perror_with_name ("Couldn't write registers"); - - if (regnum != -1) - return; - } - - if (regnum == -1 || regnum >= FP0_REGNUM) - { - struct fpreg fpregs; - - if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't get floating point status"); - - x86_64_fill_fxsave ((char *) &fpregs, regnum); - - if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) - perror_with_name ("Couldn't write floating point status"); - } -} /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c index 9f6c217..bb44ec0 100644 --- a/gdb/amd64fbsd-tdep.c +++ b/gdb/amd64fbsd-tdep.c @@ -1,4 +1,5 @@ /* Target-dependent code for FreeBSD/amd64. + Copyright 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -48,6 +49,26 @@ amd64fbsd_sigcontext_addr (struct frame_info *next_frame) /* FreeBSD 5.1-RELEASE or later. */ +/* Mapping between the general-purpose registers in `struct reg' + format and GDB's register cache layout. + + Note that some registers are 32-bit, but since we're little-endian + we get away with that. */ + +/* From <machine/reg.h>. */ +static int amd64fbsd_r_reg_offset[] = +{ + 14 * 8, 11 * 8, /* %rax, %rbx */ + 13 * 8, 12 * 8, /* %rcx, %rdx */ + 9 * 8, 8 * 8, /* %rsi, %rdi */ + 10 * 8, 20 * 8, /* %rbp, %rsp */ + 7 * 8, 6 * 8, 5 * 8, 4 * 8, /* %r8 ... */ + 3 * 8, 2 * 8, 1 * 8, 0 * 8, /* ... %r15 */ + 17 * 8, 19 * 8, /* %rip, %eflags */ + -1, -1, /* %ds, %es */ + -1, -1 /* %fs, %gs */ +}; + /* Location of the signal trampoline. */ CORE_ADDR amd64fbsd_sigtramp_start = 0x7fffffffffc0; CORE_ADDR amd64fbsd_sigtramp_end = 0x7fffffffffe0; @@ -62,7 +83,7 @@ int amd64fbsd_sc_reg_offset[X86_64_NUM_GREGS] = 24 + 1 * 8, /* %rsi */ 24 + 0 * 8, /* %rdi */ 24 + 8 * 8, /* %rbp */ - 24 + 21 * 8, /* %rsp */ + 24 + 22 * 8, /* %rsp */ 24 + 4 * 8, /* %r8 */ 24 + 5 * 8, /* %r9 */ 24 + 9 * 8, /* %r10 */ @@ -71,8 +92,8 @@ int amd64fbsd_sc_reg_offset[X86_64_NUM_GREGS] = 24 + 12 * 8, /* %r13 */ 24 + 13 * 8, /* %r14 */ 24 + 14 * 8, /* %r15 */ - 24 + 18 * 8, /* %rip */ - 24 + 20 * 8, /* %eflags */ + 24 + 19 * 8, /* %rip */ + 24 + 21 * 8, /* %eflags */ -1, /* %ds */ -1, /* %es */ -1, /* %fs */ @@ -87,13 +108,17 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Obviously FreeBSD is BSD-based. */ i386bsd_init_abi (info, gdbarch); + tdep->gregset_reg_offset = amd64fbsd_r_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (amd64fbsd_r_reg_offset); + tdep->sizeof_gregset = 22 * 8; + x86_64_init_abi (info, gdbarch); tdep->sigtramp_start = amd64fbsd_sigtramp_start; tdep->sigtramp_end = amd64fbsd_sigtramp_end; tdep->sigcontext_addr = amd64fbsd_sigcontext_addr; tdep->sc_reg_offset = amd64fbsd_sc_reg_offset; - tdep->sc_num_regs = X86_64_NUM_GREGS; + tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset); } diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index e344ec0..8d5720c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -23,6 +23,7 @@ #include "defs.h" #include "arch-utils.h" +#include "buildsym.h" #include "gdbcmd.h" #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */ #include "gdb_string.h" @@ -30,6 +31,8 @@ #include "gdb_assert.h" #include "sim-regno.h" +#include "osabi.h" + #include "version.h" #include "floatformat.h" @@ -99,6 +102,12 @@ generic_skip_trampoline_code (CORE_ADDR pc) return 0; } +CORE_ADDR +generic_skip_solib_resolver (CORE_ADDR pc) +{ + return 0; +} + int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name) { @@ -199,23 +208,15 @@ deprecated_register_convertible_not (int num) } -/* Under some ABI's that specify the `struct convention' for returning - structures by value, by the time we've returned from the function, - the return value is sitting there in the caller's buffer, but GDB - has no way to find the address of that buffer. - - On such architectures, use this function as your - extract_struct_value_address method. When asked to a struct - returned by value in this fashion, GDB will print a nice error - message, instead of garbage. */ CORE_ADDR -generic_cannot_extract_struct_value_address (char *dummy) +core_addr_identity (CORE_ADDR addr) { - return 0; + return addr; } CORE_ADDR -core_addr_identity (CORE_ADDR addr) +convert_from_func_ptr_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr, + struct target_ops *targ) { return addr; } @@ -227,14 +228,7 @@ no_op_reg_to_regnum (int reg) } CORE_ADDR -init_frame_pc_noop (int fromleaf, struct frame_info *prev) -{ - /* Do nothing, implies return the same PC value. */ - return get_frame_pc (prev); -} - -CORE_ADDR -init_frame_pc_default (int fromleaf, struct frame_info *prev) +deprecated_init_frame_pc_default (int fromleaf, struct frame_info *prev) { if (fromleaf && DEPRECATED_SAVED_PC_AFTER_CALL_P ()) return DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev)); @@ -300,7 +294,7 @@ generic_register_size (int regnum) /* FIXME: cagney/2003-03-01: Once all architectures implement gdbarch_register_type(), this entire function can go away. It is made obsolete by register_size(). */ - return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); /* OK */ + return TYPE_LENGTH (DEPRECATED_REGISTER_VIRTUAL_TYPE (regnum)); /* OK */ } /* Assume all registers are adjacent. */ @@ -344,7 +338,7 @@ legacy_register_to_value (struct frame_info *frame, int regnum, struct type *type, void *to) { char from[MAX_REGISTER_SIZE]; - frame_read_register (frame, regnum, from); + get_frame_register (frame, regnum, from); DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to); } @@ -359,6 +353,23 @@ legacy_value_to_register (struct frame_info *frame, int regnum, put_frame_register (frame, regnum, to); } +int +default_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) +{ + if (DEPRECATED_REG_STRUCT_HAS_ADDR_P () + && DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation, type)) + { + CHECK_TYPEDEF (type); + + return (TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION + || TYPE_CODE (type) == TYPE_CODE_SET + || TYPE_CODE (type) == TYPE_CODE_BITSTRING); + } + + return 0; +} + /* Functions to manipulate the endianness of the target. */ @@ -478,17 +489,72 @@ set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c) show_architecture (NULL, from_tty); } +/* Try to select a global architecture that matches "info". Return + non-zero if the attempt succeds. */ +int +gdbarch_update_p (struct gdbarch_info info) +{ + struct gdbarch *new_gdbarch = gdbarch_find_by_info (info); + + /* If there no architecture by that name, reject the request. */ + if (new_gdbarch == NULL) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " + "Architecture not found\n"); + return 0; + } + + /* If it is the same old architecture, accept the request (but don't + swap anything). */ + if (new_gdbarch == current_gdbarch) + { + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " + "Architecture 0x%08lx (%s) unchanged\n", + (long) new_gdbarch, + gdbarch_bfd_arch_info (new_gdbarch)->printable_name); + return 1; + } + + /* It's a new architecture, swap it in. */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " + "New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + gdbarch_bfd_arch_info (new_gdbarch)->printable_name); + deprecated_current_gdbarch_select_hack (new_gdbarch); + + return 1; +} + +/* Return the architecture for ABFD. If no suitable architecture + could be find, return NULL. */ + +struct gdbarch * +gdbarch_from_bfd (bfd *abfd) +{ + struct gdbarch *old_gdbarch = current_gdbarch; + struct gdbarch *new_gdbarch; + struct gdbarch_info info; + + gdbarch_info_init (&info); + info.abfd = abfd; + return gdbarch_find_by_info (info); +} + /* Set the dynamic target-system-dependent parameters (architecture, byte-order) using information found in the BFD */ void set_gdbarch_from_file (bfd *abfd) { - struct gdbarch_info info; - gdbarch_info_init (&info); - info.abfd = abfd; - if (! gdbarch_update_p (info)) + struct gdbarch *gdbarch; + + gdbarch = gdbarch_from_bfd (abfd); + if (gdbarch == NULL) error ("Architecture of file not recognized.\n"); + deprecated_current_gdbarch_select_hack (gdbarch); } /* Initialize the current architecture. Update the ``set @@ -608,7 +674,7 @@ initialize_current_architecture (void) /* Initialize a gdbarch info to values that will be automatically overridden. Note: Originally, this ``struct info'' was initialized - using memset(0). Unfortunatly, that ran into problems, namely + using memset(0). Unfortunately, that ran into problems, namely BFD_ENDIAN_BIG is zero. An explicit initialization function that can explicitly set each field to a well defined value is used. */ @@ -620,6 +686,54 @@ gdbarch_info_init (struct gdbarch_info *info) info->osabi = GDB_OSABI_UNINITIALIZED; } +/* Similar to init, but this time fill in the blanks. Information is + obtained from the specified architecture, global "set ..." options, + and explicitly initialized INFO fields. */ + +void +gdbarch_info_fill (struct gdbarch *gdbarch, struct gdbarch_info *info) +{ + /* "(gdb) set architecture ...". */ + if (info->bfd_arch_info == NULL + && !target_architecture_auto + && gdbarch != NULL) + info->bfd_arch_info = gdbarch_bfd_arch_info (gdbarch); + if (info->bfd_arch_info == NULL + && info->abfd != NULL + && bfd_get_arch (info->abfd) != bfd_arch_unknown + && bfd_get_arch (info->abfd) != bfd_arch_obscure) + info->bfd_arch_info = bfd_get_arch_info (info->abfd); + if (info->bfd_arch_info == NULL + && gdbarch != NULL) + info->bfd_arch_info = gdbarch_bfd_arch_info (gdbarch); + + /* "(gdb) set byte-order ...". */ + if (info->byte_order == BFD_ENDIAN_UNKNOWN + && !target_byte_order_auto + && gdbarch != NULL) + info->byte_order = gdbarch_byte_order (gdbarch); + /* From the INFO struct. */ + if (info->byte_order == BFD_ENDIAN_UNKNOWN + && info->abfd != NULL) + info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG + : bfd_little_endian (info->abfd) ? BFD_ENDIAN_LITTLE + : BFD_ENDIAN_UNKNOWN); + /* From the current target. */ + if (info->byte_order == BFD_ENDIAN_UNKNOWN + && gdbarch != NULL) + info->byte_order = gdbarch_byte_order (gdbarch); + + /* "(gdb) set osabi ...". Handled by gdbarch_lookup_osabi. */ + if (info->osabi == GDB_OSABI_UNINITIALIZED) + info->osabi = gdbarch_lookup_osabi (info->abfd); + if (info->osabi == GDB_OSABI_UNINITIALIZED + && gdbarch != NULL) + info->osabi = gdbarch_osabi (gdbarch); + + /* Must have at least filled in the architecture. */ + gdb_assert (info->bfd_arch_info != NULL); +} + /* */ extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index d2e6829..fbc7aa2 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -1,6 +1,7 @@ /* Dynamic architecture support for GDB, the GNU debugger. - Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -75,9 +76,10 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); extern const struct floatformat *default_float_format (struct gdbarch *gdbarch); extern const struct floatformat *default_double_format (struct gdbarch *gdbarch); -/* Identity function on a CORE_ADDR. Just returns its parameter. */ +/* Identity functions on a CORE_ADDR. Just return the "addr". */ extern CORE_ADDR core_addr_identity (CORE_ADDR addr); +extern gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr_identity; /* No-op conversion of reg to regnum. */ @@ -85,9 +87,7 @@ extern int no_op_reg_to_regnum (int reg); /* Versions of init_frame_pc(). Do nothing; do the default. */ -extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); - -extern CORE_ADDR init_frame_pc_default (int fromleaf, struct frame_info *prev); +extern CORE_ADDR deprecated_init_frame_pc_default (int fromleaf, struct frame_info *prev); /* Do nothing version of elf_make_msymbol_special. */ @@ -110,6 +110,8 @@ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); +extern CORE_ADDR generic_skip_solib_resolver (CORE_ADDR pc); + extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); extern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name); @@ -138,6 +140,9 @@ extern void legacy_register_to_value (struct frame_info *frame, int regnum, extern void legacy_value_to_register (struct frame_info *frame, int regnum, struct type *type, const void *from); +extern int default_stabs_argument_has_addr (struct gdbarch *gdbarch, + struct type *type); + /* For compatibility with older architectures, returns (LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid name. */ @@ -148,4 +153,15 @@ extern int legacy_register_sim_regno (int regnum); default values are not zero. */ extern void gdbarch_info_init (struct gdbarch_info *info); +/* Similar to init, but this time fill in the blanks. Information is + obtained from the specified architecture, global "set ..." options, + and explicitly initialized INFO fields. */ +extern void gdbarch_info_fill (struct gdbarch *gdbarch, + struct gdbarch_info *info); + +/* Return the architecture for ABFD. If no suitable architecture + could be find, return NULL. */ + +extern struct gdbarch *gdbarch_from_bfd (bfd *abfd); + #endif diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index b5fb496..c91c0fd 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -31,11 +31,7 @@ #include "osabi.h" #include "arm-tdep.h" - -/* For shared library handling. */ -#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" +#include "glibc-tdep.h" /* Under ARM GNU/Linux the traditional way of performing a breakpoint is to execute a particular software interrupt, rather than use a @@ -348,36 +344,6 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp, with. Before the fixup/resolver code returns, it actually calls the requested function and repairs &GOT[n+3]. */ -/* Find the minimal symbol named NAME, and return both the minsym - struct and its objfile. This probably ought to be in minsym.c, but - everything there is trying to deal with things like C++ and - SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may - be considered too special-purpose for general consumption. */ - -static struct minimal_symbol * -find_minsym_and_objfile (char *name, struct objfile **objfile_p) -{ - struct objfile *objfile; - - ALL_OBJFILES (objfile) - { - struct minimal_symbol *msym; - - ALL_OBJFILE_MSYMBOLS (objfile, msym) - { - if (DEPRECATED_SYMBOL_NAME (msym) - && strcmp (DEPRECATED_SYMBOL_NAME (msym), name) == 0) - { - *objfile_p = objfile; - return msym; - } - } - } - - return 0; -} - - /* Fetch, and possibly build, an appropriate link_map_offsets structure for ARM linux targets using the struct offsets defined in <link.h>. Note, however, that link.h is not actually referred to in this file. @@ -421,61 +387,10 @@ arm_linux_svr4_fetch_link_map_offsets (void) return lmp; } -static CORE_ADDR -skip_hurd_resolver (CORE_ADDR pc) -{ - /* The HURD dynamic linker is part of the GNU C library, so many - GNU/Linux distributions use it. (All ELF versions, as far as I - know.) An unresolved PLT entry points to "_dl_runtime_resolve", - which calls "fixup" to patch the PLT, and then passes control to - the function. - - We look for the symbol `_dl_runtime_resolve', and find `fixup' in - the same objfile. If we are at the entry point of `fixup', then - we set a breakpoint at the return address (at the top of the - stack), and continue. - - It's kind of gross to do all these checks every time we're - called, since they don't change once the executable has gotten - started. But this is only a temporary hack --- upcoming versions - of GNU/Linux will provide a portable, efficient interface for - debugging programs that use shared libraries. */ - - struct objfile *objfile; - struct minimal_symbol *resolver - = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile); - - if (resolver) - { - struct minimal_symbol *fixup - = lookup_minimal_symbol ("fixup", NULL, objfile); - - if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) - return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ())); - } - - return 0; -} - -/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c. - This function: - 1) decides whether a PLT has sent us into the linker to resolve - a function reference, and - 2) if so, tells us where to set a temporary breakpoint that will - trigger when the dynamic linker is done. */ - CORE_ADDR arm_linux_skip_solib_resolver (CORE_ADDR pc) { - CORE_ADDR result; - - /* Plug in functions for other kinds of resolvers here. */ - result = skip_hurd_resolver (pc); - - if (result) - return result; - - return 0; + return glibc_skip_solib_resolver (pc); } /* The constants below were determined by examining the following files diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3ba072d1..6faca9f 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -455,6 +455,12 @@ arm_skip_prologue (CORE_ADDR pc) if (inst == 0xe1a0c00d) /* mov ip, sp */ continue; + if ((inst & 0xfffff000) == 0xe28dc000) /* add ip, sp #n */ + continue; + + if ((inst & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */ + continue; + /* Some prologues begin with "str lr, [sp, #-4]!". */ if (inst == 0xe52de004) /* str lr, [sp, #-4]! */ continue; @@ -707,7 +713,7 @@ thumb_scan_prologue (CORE_ADDR prev_pc, struct arm_prologue_cache *cache) static void arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache) { - int regno, sp_offset, fp_offset; + int regno, sp_offset, fp_offset, ip_offset; CORE_ADDR prologue_start, prologue_end, current_pc; CORE_ADDR prev_pc = frame_pc_unwind (next_frame); @@ -808,7 +814,7 @@ arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cac in which case it is often (but not always) replaced by "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ - sp_offset = fp_offset = 0; + sp_offset = fp_offset = ip_offset = 0; for (current_pc = prologue_start; current_pc < prologue_end; @@ -818,11 +824,29 @@ arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cac if (insn == 0xe1a0c00d) /* mov ip, sp */ { + ip_offset = 0; + continue; + } + else if ((insn & 0xfffff000) == 0xe28dc000) /* add ip, sp #n */ + { + unsigned imm = insn & 0xff; /* immediate value */ + unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ + imm = (imm >> rot) | (imm << (32 - rot)); + ip_offset = imm; + continue; + } + else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */ + { + unsigned imm = insn & 0xff; /* immediate value */ + unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ + imm = (imm >> rot) | (imm << (32 - rot)); + ip_offset = -imm; continue; } else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */ { - /* Function is frameless: extra_info defaults OK? */ + sp_offset -= 4; + cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset; continue; } else if ((insn & 0xffff0000) == 0xe92d0000) @@ -859,7 +883,7 @@ arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cac unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); - fp_offset = -imm; + fp_offset = -imm + ip_offset; cache->framereg = ARM_FP_REGNUM; } else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */ @@ -944,7 +968,7 @@ arm_make_prologue_cache (struct frame_info *next_frame) /* Calculate actual addresses of saved registers using offsets determined by arm_scan_prologue. */ for (reg = 0; reg < NUM_REGS; reg++) - if (cache->saved_regs[reg].addr != 0) + if (trad_frame_addr_p (cache->saved_regs, reg)) cache->saved_regs[reg].addr += cache->prev_sp; return cache; @@ -970,7 +994,7 @@ arm_prologue_this_id (struct frame_info *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 <= LOWEST_PC || deprecated_inside_entry_file (func)) + if (func <= LOWEST_PC) return; /* If we've hit a wall, stop. */ @@ -1079,7 +1103,7 @@ arm_make_sigtramp_cache (struct frame_info *next_frame) cache->framereg = ARM_SP_REGNUM; cache->prev_sp = read_memory_integer (cache->saved_regs[cache->framereg].addr, - REGISTER_RAW_SIZE (cache->framereg)); + DEPRECATED_REGISTER_RAW_SIZE (cache->framereg)); return cache; } diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 90bf910..9ef84c0 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -970,11 +970,6 @@ avr_frame_this_id (struct frame_info *next_frame, /* 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 (deprecated_inside_entry_file (func)) - 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". */ @@ -1359,7 +1354,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) static void avr_io_reg_read_command (char *args, int from_tty) { - int bufsiz = 0; + LONGEST bufsiz = 0; char buf[400]; char query[400]; char *p; @@ -1367,22 +1362,23 @@ avr_io_reg_read_command (char *args, int from_tty) unsigned int val; int i, j, k, step; - if (!current_target.to_query) + /* Just get the maximum buffer size. */ + bufsiz = target_read_partial (¤t_target, TARGET_OBJECT_AVR, + NULL, NULL, 0, 0); + if (bufsiz < 0) { fprintf_unfiltered (gdb_stderr, "ERR: info io_registers NOT supported by current " "target\n"); return; } - - /* Just get the maximum buffer size. */ - target_query ((int) 'R', 0, 0, &bufsiz); if (bufsiz > sizeof (buf)) bufsiz = sizeof (buf); /* Find out how many io registers the target has. */ strcpy (query, "avr.io_reg"); - target_query ((int) 'R', query, buf, &bufsiz); + target_read_partial (¤t_target, TARGET_OBJECT_AVR, query, buf, 0, + bufsiz); if (strncmp (buf, "", bufsiz) == 0) { @@ -1413,7 +1409,8 @@ avr_io_reg_read_command (char *args, int from_tty) j = nreg - i; /* last block is less than 8 registers */ snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j); - target_query ((int) 'R', query, buf, &bufsiz); + target_read_partial (¤t_target, TARGET_OBJECT_AVR, query, buf, + 0, bufsiz); p = buf; for (k = i; k < (i + j); k++) diff --git a/gdb/bcache.c b/gdb/bcache.c index 5a310f3..ec8b777 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -2,7 +2,7 @@ Written by Fred Fish <fnf@cygnus.com> Rewritten by Jim Blandy <jimb@cygnus.com> - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -25,6 +25,7 @@ #include "gdb_obstack.h" #include "bcache.h" #include "gdb_string.h" /* For memcpy declaration */ +#include "gdb_assert.h" #include <stddef.h> #include <stdlib.h> @@ -37,8 +38,15 @@ struct bstring { + /* Hash chain. */ struct bstring *next; - size_t length; + /* Assume the data length is no more than 64k. */ + unsigned short length; + /* The half hash hack. This contains the upper 16 bits of the hash + value and is used as a pre-check when comparing two strings and + avoids the need to do length or memcmp calls. It proves to be + roughly 100% effective. */ + unsigned short half_hash; union { @@ -71,6 +79,17 @@ struct bcache long unique_size; /* size of unique strings, in bytes */ long total_size; /* total number of bytes cached, including dups */ long structure_size; /* total size of bcache, including infrastructure */ + /* Number of times that the hash table is expanded and hence + re-built, and the corresponding number of times that a string is + [re]hashed as part of entering it into the expanded table. The + total number of hashes can be computed by adding TOTAL_COUNT to + expand_hash_count. */ + unsigned long expand_count; + unsigned long expand_hash_count; + /* Number of times that the half-hash compare hit (compare the upper + 16 bits of hash values) hit, but the corresponding combined + length/data compare missed. */ + unsigned long half_hash_miss_count; }; /* The old hash function was stolen from SDBM. This is what DB 3.0 uses now, @@ -117,6 +136,11 @@ expand_hash_table (struct bcache *bcache) struct bstring **new_buckets; unsigned int i; + /* Count the stats. Every unique item needs to be re-hashed and + re-entered. */ + bcache->expand_count++; + bcache->expand_hash_count += bcache->unique_count; + /* Find the next size. */ new_num_buckets = bcache->num_buckets * 2; for (i = 0; i < (sizeof (sizes) / sizeof (sizes[0])); i++) @@ -174,6 +198,8 @@ expand_hash_table (struct bcache *bcache) void * bcache (const void *addr, int length, struct bcache *bcache) { + unsigned long full_hash; + unsigned short half_hash; int hash_index; struct bstring *s; @@ -184,13 +210,24 @@ bcache (const void *addr, int length, struct bcache *bcache) bcache->total_count++; bcache->total_size += length; - hash_index = hash (addr, length) % bcache->num_buckets; + full_hash = hash (addr, length); + half_hash = (full_hash >> 16); + hash_index = full_hash % bcache->num_buckets; - /* Search the hash bucket for a string identical to the caller's. */ + /* Search the hash bucket for a string identical to the caller's. + As a short-circuit first compare the upper part of each hash + values. */ for (s = bcache->bucket[hash_index]; s; s = s->next) - if (s->length == length - && ! memcmp (&s->d.data, addr, length)) - return &s->d.data; + { + if (s->half_hash == half_hash) + { + if (s->length == length + && ! memcmp (&s->d.data, addr, length)) + return &s->d.data; + else + bcache->half_hash_miss_count++; + } + } /* The user's string isn't in the list. Insert it after *ps. */ { @@ -199,6 +236,7 @@ bcache (const void *addr, int length, struct bcache *bcache) memcpy (&new->d.data, addr, length); new->length = length; new->next = bcache->bucket[hash_index]; + new->half_hash = half_hash; bcache->bucket[hash_index] = new; bcache->unique_count++; @@ -265,12 +303,16 @@ print_bcache_statistics (struct bcache *c, char *type) int occupied_buckets; int max_chain_length; int median_chain_length; + int max_entry_size; + int median_entry_size; - /* Count the number of occupied buckets, and measure chain lengths. */ + /* Count the number of occupied buckets, tally the various string + lengths, and measure chain lengths. */ { unsigned int b; - int *chain_length - = (int *) alloca (c->num_buckets * sizeof (*chain_length)); + int *chain_length = XCALLOC (c->num_buckets + 1, int); + int *entry_size = XCALLOC (c->unique_count + 1, int); + int stringi = 0; occupied_buckets = 0; @@ -286,7 +328,10 @@ print_bcache_statistics (struct bcache *c, char *type) while (s) { + gdb_assert (b < c->num_buckets); chain_length[b]++; + gdb_assert (stringi < c->unique_count); + entry_size[stringi++] = s->length; s = s->next; } } @@ -295,6 +340,8 @@ print_bcache_statistics (struct bcache *c, char *type) /* To compute the median, we need the set of chain lengths sorted. */ qsort (chain_length, c->num_buckets, sizeof (chain_length[0]), compare_ints); + qsort (entry_size, c->unique_count, sizeof (entry_size[0]), + compare_ints); if (c->num_buckets > 0) { @@ -306,6 +353,19 @@ print_bcache_statistics (struct bcache *c, char *type) max_chain_length = 0; median_chain_length = 0; } + if (c->unique_count > 0) + { + max_entry_size = entry_size[c->unique_count - 1]; + median_entry_size = entry_size[c->unique_count / 2]; + } + else + { + max_entry_size = 0; + median_entry_size = 0; + } + + xfree (chain_length); + xfree (entry_size); } printf_filtered (" Cached '%s' statistics:\n", type); @@ -321,6 +381,15 @@ print_bcache_statistics (struct bcache *c, char *type) print_percentage (c->total_size - c->unique_size, c->total_size); printf_filtered ("\n"); + printf_filtered (" Max entry size: %d\n", max_entry_size); + printf_filtered (" Average entry size: "); + if (c->unique_count > 0) + printf_filtered ("%ld\n", c->unique_size / c->unique_count); + else + printf_filtered ("(not applicable)\n"); + printf_filtered (" Median entry size: %d\n", median_entry_size); + printf_filtered ("\n"); + printf_filtered (" Total memory used by bcache, including overhead: %ld\n", c->structure_size); printf_filtered (" Percentage memory overhead: "); @@ -330,6 +399,12 @@ print_bcache_statistics (struct bcache *c, char *type) printf_filtered ("\n"); printf_filtered (" Hash table size: %3d\n", c->num_buckets); + printf_filtered (" Hash table expands: %lu\n", + c->expand_count); + printf_filtered (" Hash table hashes: %lu\n", + c->total_count + c->expand_hash_count); + printf_filtered (" Half hash misses: %lu\n", + c->half_hash_miss_count); printf_filtered (" Hash table population: "); print_percentage (occupied_buckets, c->num_buckets); printf_filtered (" Median hash chain length: %3d\n", diff --git a/gdb/bcache.h b/gdb/bcache.h index 61fbbe6..6c3a63d 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -2,7 +2,7 @@ Written by Fred Fish <fnf@cygnus.com> Rewritten by Jim Blandy <jimb@cygnus.com> - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -48,20 +48,95 @@ You shouldn't modify the strings you get from a bcache, because: - You don't necessarily know who you're sharing space with. If I - stick eight bytes of text in a bcache, and then stick an - eight-byte structure in the same bcache, there's no guarantee - those two objects don't actually comprise the same sequence of - bytes. If they happen to, the bcache will use a single byte - string for both of them. Then, modifying the structure will - change the string. In bizarre ways. + stick eight bytes of text in a bcache, and then stick an eight-byte + structure in the same bcache, there's no guarantee those two + objects don't actually comprise the same sequence of bytes. If + they happen to, the bcache will use a single byte string for both + of them. Then, modifying the structure will change the string. In + bizarre ways. - Even if you know for some other reason that all that's okay, - there's another problem. A bcache stores all its strings in a - hash table. If you modify a string's contents, you will probably - change its hash value. This means that the modified string is - now in the wrong place in the hash table, and future bcache - probes will never find it. So by mutating a string, you give up - any chance of sharing its space with future duplicates. */ + there's another problem. A bcache stores all its strings in a hash + table. If you modify a string's contents, you will probably change + its hash value. This means that the modified string is now in the + wrong place in the hash table, and future bcache probes will never + find it. So by mutating a string, you give up any chance of + sharing its space with future duplicates. + + + Size of bcache VS hashtab: + + For bcache, the most critical cost is size (or more exactly the + overhead added by the bcache). It turns out that the bcache is + remarkably efficient. + + Assuming a 32-bit system (the hash table slots are 4 bytes), + ignoring alignment, and limit strings to 255 bytes (1 byte length) + we get ... + + bcache: This uses a separate linked list to track the hash chain. + The numbers show roughly 100% occupancy of the hash table and an + average chain length of 4. Spreading the slot cost over the 4 + chain elements: + + 4 (slot) / 4 (chain length) + 1 (length) + 4 (chain) = 6 bytes + + hashtab: This uses a more traditional re-hash algorithm where the + chain is maintained within the hash table. The table occupancy is + kept below 75% but we'll assume its perfect: + + 4 (slot) x 4/3 (occupancy) + 1 (length) = 6 1/3 bytes + + So a perfect hashtab has just slightly larger than an average + bcache. + + It turns out that an average hashtab is far worse. Two things + hurt: + + - Hashtab's occupancy is more like 50% (it ranges between 38% and + 75%) giving a per slot cost of 4x2 vs 4x4/3. + + - the string structure needs to be aligned to 8 bytes which for + hashtab wastes 7 bytes, while for bcache wastes only 3. + + This gives: + + hashtab: 4 x 2 + 1 + 7 = 16 bytes + + bcache 4 / 4 + 1 + 4 + 3 = 9 bytes + + The numbers of GDB debugging GDB support this. ~40% vs ~70% overhead. + + + Speed of bcache VS hashtab (the half hash hack): + + While hashtab has a typical chain length of 1, bcache has a chain + length of round 4. This means that the bcache will require + something like double the number of compares after that initial + hash. In both cases the comparison takes the form: + + a.length == b.length && memcmp (a.data, b.data, a.length) == 0 + + That is lengths are checked before doing the memcmp. + + For GDB debugging GDB, it turned out that all lengths were 24 bytes + (no C++ so only psymbols were cached) and hence, all compares + required a call to memcmp. As a hack, two bytes of padding + (mentioned above) are used to store the upper 16 bits of the + string's hash value and then that is used in the comparison vis: + + a.half_hash == b.half_hash && a.length == b.length && memcmp + (a.data, b.data, a.length) + + The numbers from GDB debugging GDB show this to be a remarkable + 100% effective (only necessary length and memcmp tests being + performed). + + Mind you, looking at the wall clock, the same GDB debugging GDB + showed only marginal speed up (0.780 vs 0.773s). Seems GDB is too + busy doing something else :-( + +*/ struct bcache; diff --git a/gdb/block.c b/gdb/block.c index 8729a24..28b1181 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -71,7 +71,7 @@ block_function (const struct block *bl) is NULL, we don't pass this information back to the caller. */ struct blockvector * -blockvector_for_pc_sect (CORE_ADDR pc, struct sec *section, +blockvector_for_pc_sect (CORE_ADDR pc, struct bfd_section *section, int *pindex, struct symtab *symtab) { struct block *b; @@ -136,7 +136,7 @@ blockvector_for_pc (CORE_ADDR pc, int *pindex) in the specified section, or 0 if there is none. */ struct block * -block_for_pc_sect (CORE_ADDR pc, struct sec *section) +block_for_pc_sect (CORE_ADDR pc, struct bfd_section *section) { struct blockvector *bl; int index; diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 9da0086..381a61a 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -83,22 +83,35 @@ deprecated_inside_entry_file (CORE_ADDR addr) int inside_main_func (CORE_ADDR pc) { + struct minimal_symbol *msymbol; + if (pc == 0) return 1; if (symfile_objfile == 0) return 0; + msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile); + /* 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) + if (msymbol != NULL + && symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC + && symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC) { - struct symbol *mainsym; + /* brobecker/2003-10-10: We used to rely on lookup_symbol() to search + the symbol associated to the main function. Unfortunately, + lookup_symbol() uses the current-language la_lookup_symbol_nonlocal + function to do the global symbol search. Depending on the language, + this can introduce certain side-effects, because certain languages + such as Ada for instance may find more than one match. So we prefer + to search the main function symbol using its address rather than + its name. */ + struct symbol *mainsym + = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); - mainsym = lookup_symbol_linkage (main_name ()); if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK) { symfile_objfile->ei.main_func_lowpc = @@ -111,8 +124,6 @@ inside_main_func (CORE_ADDR pc) /* Not in the normal symbol tables, see if "main" is in the partial symbol table. If it's not, then give up. */ { - struct minimal_symbol *msymbol - = lookup_minimal_symbol (main_name (), NULL, symfile_objfile); if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_text) { struct obj_section *osect @@ -283,7 +294,7 @@ get_frame_function (struct frame_info *frame) Returns 0 if function is not known. */ struct symbol * -find_pc_sect_function (CORE_ADDR pc, struct sec *section) +find_pc_sect_function (CORE_ADDR pc, struct bfd_section *section) { struct block *b = block_for_pc_sect (pc, section); if (b == 0) @@ -306,7 +317,7 @@ find_pc_function (CORE_ADDR pc) static CORE_ADDR cache_pc_function_low = 0; static CORE_ADDR cache_pc_function_high = 0; static char *cache_pc_function_name = 0; -static struct sec *cache_pc_function_section = NULL; +static struct bfd_section *cache_pc_function_section = NULL; /* Clear cache, e.g. when symbol table is discarded. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 152aa3c..1cbd006 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -97,6 +97,10 @@ struct breakpoint *set_raw_breakpoint (struct symtab_and_line, enum bptype); static void check_duplicates (struct breakpoint *); +static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); + +static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr); + static void describe_other_breakpoints (CORE_ADDR, asection *); static void breakpoints_info (char *, int); @@ -124,7 +128,7 @@ typedef enum } insertion_state_t; -static int remove_breakpoint (struct breakpoint *, insertion_state_t); +static int remove_breakpoint (struct bp_location *, insertion_state_t); static enum print_stop_action print_it_typical (bpstat); @@ -231,6 +235,15 @@ static int overlay_events_enabled; B ? (TMP=B->next, 1): 0; \ B = TMP) +/* Similar iterators for the low-level breakpoints. */ + +#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->next) + +#define ALL_BP_LOCATIONS_SAFE(B,TMP) \ + for (B = bp_location_chain; \ + B ? (TMP=B->next, 1): 0; \ + B = TMP) + /* True if SHIFT_INST_REGS defined, false otherwise. */ int must_shift_inst_regs = @@ -245,10 +258,12 @@ int must_shift_inst_regs = int show_breakpoint_hit_counts = 1; -/* Chain of all breakpoints defined. */ +/* Chains of all breakpoints defined. */ struct breakpoint *breakpoint_chain; +struct bp_location *bp_location_chain; + /* Number of last breakpoint made. */ int breakpoint_count; @@ -548,7 +563,7 @@ condition_command (char *arg, int from_tty) /* I don't know if it matters whether this is the string the user typed in or the decompiled expression. */ b->cond_string = savestring (arg, strlen (arg)); - b->cond = parse_exp_1 (&arg, block_for_pc (b->address), 0); + b->cond = parse_exp_1 (&arg, block_for_pc (b->loc->address), 0); if (*arg) error ("Junk at end of expression"); } @@ -560,7 +575,6 @@ condition_command (char *arg, int from_tty) error ("No breakpoint number %d.", bnum); } -/* ARGSUSED */ static void commands_command (char *arg, int from_tty) { @@ -611,7 +625,7 @@ int read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len) { int status; - struct breakpoint *b; + struct bp_location *b; CORE_ADDR bp_addr = 0; int bp_size = 0; @@ -619,19 +633,14 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len) /* No breakpoints on this machine. */ return target_read_memory (memaddr, myaddr, len); - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) { - if (b->type == bp_none) - warning ("reading through apparently deleted breakpoint #%d?", - b->number); + if (b->owner->type == bp_none) + warning ("reading through apparently deleted breakpoint #%d?", + b->owner->number); - /* memory breakpoint? */ - if (b->type == bp_watchpoint - || b->type == bp_hardware_watchpoint - || b->type == bp_read_watchpoint - || b->type == bp_access_watchpoint) + if (b->loc_type != bp_loc_software_breakpoint) continue; - /* bp in memory? */ if (!b->inserted) continue; /* Addresses and length of the part of the breakpoint that @@ -732,373 +741,396 @@ insert_catchpoint (struct ui_out *uo, void *args) return 0; } -/* insert_breakpoints is used when starting or continuing the program. - remove_breakpoints is used when the program stops. - Both return zero if successful, - or an `errno' value if could not write the inferior. */ +/* Insert a low-level "breakpoint" of some type. BPT is the breakpoint. + Any error messages are printed to TMP_ERROR_STREAM; and DISABLED_BREAKS, + PROCESS_WARNING, and HW_BREAKPOINT_ERROR are used to report problems. -int -insert_breakpoints (void) + NOTE drow/2003-09-09: This routine could be broken down to an object-style + method for each breakpoint or catchpoint type. */ +static int +insert_bp_location (struct bp_location *bpt, + struct ui_file *tmp_error_stream, + int *disabled_breaks, int *process_warning, + int *hw_breakpoint_error) { - struct breakpoint *b, *temp; - int return_val = 0; /* return success code. */ int val = 0; - int disabled_breaks = 0; - int hw_breakpoint_error = 0; -#ifdef ONE_PROCESS_WRITETEXT - int process_warning = 0; -#endif - - struct ui_file *tmp_error_stream = mem_fileopen (); - make_cleanup_ui_file_delete (tmp_error_stream); - /* Explicitly mark the warning -- this will only be printed if - there was an error. */ - fprintf_unfiltered (tmp_error_stream, "Warning:\n"); + /* Permanent breakpoints cannot be inserted or removed. Disabled + breakpoints should not be inserted. */ + if (bpt->owner->enable_state != bp_enabled) + return 0; - ALL_BREAKPOINTS_SAFE (b, temp) - { - /* Permanent breakpoints cannot be inserted or removed. Disabled - breakpoints should not be inserted. */ - if (b->enable_state != bp_enabled) - continue; + if (bpt->inserted || bpt->duplicate) + return 0; - if ((b->type == bp_watchpoint - || b->type == bp_hardware_watchpoint - || b->type == bp_read_watchpoint - || b->type == bp_access_watchpoint) && (!b->val)) - { - struct value *val; - val = evaluate_expression (b->exp); - release_value (val); - if (VALUE_LAZY (val)) - value_fetch_lazy (val); - b->val = val; - } - if (b->type != bp_watchpoint - && b->type != bp_hardware_watchpoint - && b->type != bp_read_watchpoint - && b->type != bp_access_watchpoint - && b->type != bp_catch_fork - && b->type != bp_catch_vfork - && b->type != bp_catch_exec - && b->type != bp_catch_throw - && b->type != bp_catch_catch - && !b->inserted - && !b->duplicate) - { - /* "Normal" instruction breakpoint: either the standard - trap-instruction bp (bp_breakpoint), or a - bp_hardware_breakpoint. */ - - /* First check to see if we have to handle an overlay. */ - if (overlay_debugging == ovly_off - || b->section == NULL - || !(section_is_overlay (b->section))) - { - /* No overlay handling: just set the breakpoint. */ + if (bpt->loc_type == bp_loc_software_breakpoint + || bpt->loc_type == bp_loc_hardware_breakpoint) + { + /* First check to see if we have to handle an overlay. */ + if (overlay_debugging == ovly_off + || bpt->section == NULL + || !(section_is_overlay (bpt->section))) + { + /* No overlay handling: just set the breakpoint. */ - if (b->type == bp_hardware_breakpoint) - val = target_insert_hw_breakpoint (b->address, - b->shadow_contents); - else - val = target_insert_breakpoint (b->address, b->shadow_contents); - } - else - { - /* This breakpoint is in an overlay section. - Shall we set a breakpoint at the LMA? */ - if (!overlay_events_enabled) - { - /* Yes -- overlay event support is not active, - so we must try to set a breakpoint at the LMA. - This will not work for a hardware breakpoint. */ - if (b->type == bp_hardware_breakpoint) - warning ("hardware breakpoint %d not supported in overlay!\n", - b->number); - else - { - CORE_ADDR addr = overlay_unmapped_address (b->address, - b->section); - /* Set a software (trap) breakpoint at the LMA. */ - val = target_insert_breakpoint (addr, b->shadow_contents); - if (val != 0) - fprintf_unfiltered (tmp_error_stream, - "Overlay breakpoint %d failed: in ROM?", - b->number); - } - } - /* Shall we set a breakpoint at the VMA? */ - if (section_is_mapped (b->section)) - { - /* Yes. This overlay section is mapped into memory. */ - if (b->type == bp_hardware_breakpoint) - val = target_insert_hw_breakpoint (b->address, - b->shadow_contents); - else - val = target_insert_breakpoint (b->address, - b->shadow_contents); - } - else - { - /* No. This breakpoint will not be inserted. - No error, but do not mark the bp as 'inserted'. */ - continue; - } - } + if (bpt->loc_type == bp_loc_hardware_breakpoint) + val = target_insert_hw_breakpoint (bpt->address, + bpt->shadow_contents); + else + val = target_insert_breakpoint (bpt->address, + bpt->shadow_contents); + } + else + { + /* This breakpoint is in an overlay section. + Shall we set a breakpoint at the LMA? */ + if (!overlay_events_enabled) + { + /* Yes -- overlay event support is not active, + so we must try to set a breakpoint at the LMA. + This will not work for a hardware breakpoint. */ + if (bpt->loc_type == bp_loc_hardware_breakpoint) + warning ("hardware breakpoint %d not supported in overlay!\n", + bpt->owner->number); + else + { + CORE_ADDR addr = overlay_unmapped_address (bpt->address, + bpt->section); + /* Set a software (trap) breakpoint at the LMA. */ + val = target_insert_breakpoint (addr, bpt->shadow_contents); + if (val != 0) + fprintf_unfiltered (tmp_error_stream, + "Overlay breakpoint %d failed: in ROM?", + bpt->owner->number); + } + } + /* Shall we set a breakpoint at the VMA? */ + if (section_is_mapped (bpt->section)) + { + /* Yes. This overlay section is mapped into memory. */ + if (bpt->loc_type == bp_loc_hardware_breakpoint) + val = target_insert_hw_breakpoint (bpt->address, + bpt->shadow_contents); + else + val = target_insert_breakpoint (bpt->address, + bpt->shadow_contents); + } + else + { + /* No. This breakpoint will not be inserted. + No error, but do not mark the bp as 'inserted'. */ + return 0; + } + } - if (val) - { - /* Can't set the breakpoint. */ + if (val) + { + /* Can't set the breakpoint. */ #if defined (DISABLE_UNSETTABLE_BREAK) - if (DISABLE_UNSETTABLE_BREAK (b->address)) - { - /* See also: disable_breakpoints_in_shlibs. */ - val = 0; - b->enable_state = bp_shlib_disabled; - if (!disabled_breaks) - { - fprintf_unfiltered (tmp_error_stream, - "Cannot insert breakpoint %d.\n", - b->number); - fprintf_unfiltered (tmp_error_stream, - "Temporarily disabling shared library breakpoints:\n"); - } - disabled_breaks = 1; - fprintf_unfiltered (tmp_error_stream, - "breakpoint #%d\n", b->number); - } - else + if (DISABLE_UNSETTABLE_BREAK (bpt->address)) + { + /* See also: disable_breakpoints_in_shlibs. */ + val = 0; + bpt->owner->enable_state = bp_shlib_disabled; + if (!*disabled_breaks) + { + fprintf_unfiltered (tmp_error_stream, + "Cannot insert breakpoint %d.\n", + bpt->owner->number); + fprintf_unfiltered (tmp_error_stream, + "Temporarily disabling shared library breakpoints:\n"); + } + *disabled_breaks = 1; + fprintf_unfiltered (tmp_error_stream, + "breakpoint #%d\n", bpt->owner->number); + } + else #endif - { + { #ifdef ONE_PROCESS_WRITETEXT - process_warning = 1; + *process_warning = 1; #endif - if (b->type == bp_hardware_breakpoint) - { - hw_breakpoint_error = 1; - fprintf_unfiltered (tmp_error_stream, - "Cannot insert hardware breakpoint %d.\n", - b->number); - } - else - { - fprintf_unfiltered (tmp_error_stream, - "Cannot insert breakpoint %d.\n", - b->number); - fprintf_filtered (tmp_error_stream, - "Error accessing memory address "); - print_address_numeric (b->address, 1, tmp_error_stream); - fprintf_filtered (tmp_error_stream, ": %s.\n", - safe_strerror (val)); - } + if (bpt->loc_type == bp_loc_hardware_breakpoint) + { + *hw_breakpoint_error = 1; + fprintf_unfiltered (tmp_error_stream, + "Cannot insert hardware breakpoint %d.\n", + bpt->owner->number); + } + else + { + fprintf_unfiltered (tmp_error_stream, + "Cannot insert breakpoint %d.\n", + bpt->owner->number); + fprintf_filtered (tmp_error_stream, + "Error accessing memory address "); + print_address_numeric (bpt->address, 1, tmp_error_stream); + fprintf_filtered (tmp_error_stream, ": %s.\n", + safe_strerror (val)); + } - } - } - else - b->inserted = 1; + } + } + else + bpt->inserted = 1; - if (val) - return_val = val; /* remember failure */ - } - else if (ep_is_exception_catchpoint (b) - && !b->inserted - && !b->duplicate) + return val; + } - { - /* If we get here, we must have a callback mechanism for exception - events -- with g++ style embedded label support, we insert - ordinary breakpoints and not catchpoints. */ - val = target_insert_breakpoint (b->address, b->shadow_contents); - if (val) - { - /* Couldn't set breakpoint for some reason */ - fprintf_unfiltered (tmp_error_stream, - "Cannot insert catchpoint %d; disabling it.\n", - b->number); - fprintf_filtered (tmp_error_stream, - "Error accessing memory address "); - print_address_numeric (b->address, 1, tmp_error_stream); - fprintf_filtered (tmp_error_stream, ": %s.\n", - safe_strerror (val)); - b->enable_state = bp_disabled; - } - else - { - /* Bp set, now make sure callbacks are enabled */ - /* Format possible error msg */ - char *message = xstrprintf ("Error inserting catchpoint %d:\n", - b->number); - struct cleanup *cleanups = make_cleanup (xfree, message); - int val; - args_for_catchpoint_enable args; - args.kind = b->type == bp_catch_catch ? - EX_EVENT_CATCH : EX_EVENT_THROW; - args.enable_p = 1; - val = catch_errors (cover_target_enable_exception_callback, - &args, message, RETURN_MASK_ALL); - do_cleanups (cleanups); - if (val != 0 && val != -1) - { - b->inserted = 1; - } - /* Check if something went wrong; val == 0 can be ignored */ - if (val == -1) - { - /* something went wrong */ - fprintf_unfiltered (tmp_error_stream, - "Cannot insert catchpoint %d; disabling it.\n", - b->number); - b->enable_state = bp_disabled; - } - } + else if (bpt->loc_type == bp_loc_hardware_watchpoint + /* NOTE drow/2003-09-08: This state only exists for removing + watchpoints. It's not clear that it's necessary... */ + && bpt->owner->disposition != disp_del_at_next_stop) + { + /* FIXME drow/2003-09-08: This code sets multiple hardware watchpoints + based on the expression. Ideally this should happen at a higher level, + and there should be one bp_location for each computed address we + must watch. As soon as a many-to-one mapping is available I'll + convert this. */ - if (val) - return_val = val; /* remember failure */ - } + struct frame_info *saved_frame; + int saved_level, within_current_scope; + struct value *mark = value_mark (); + struct value *v; - else if ((b->type == bp_hardware_watchpoint || - b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint) - && b->disposition != disp_del_at_next_stop - && !b->inserted - && !b->duplicate) - { - struct frame_info *saved_frame; - int saved_level, within_current_scope; - struct value *mark = value_mark (); - struct value *v; + /* Save the current frame and level so we can restore it after + evaluating the watchpoint expression on its own frame. */ + /* FIXME drow/2003-09-09: It would be nice if evaluate_expression + took a frame parameter, so that we didn't have to change the + selected frame. */ + saved_frame = deprecated_selected_frame; + saved_level = frame_relative_level (deprecated_selected_frame); + + /* Determine if the watchpoint is within scope. */ + if (bpt->owner->exp_valid_block == NULL) + within_current_scope = 1; + else + { + struct frame_info *fi; + fi = frame_find_by_id (bpt->owner->watchpoint_frame); + within_current_scope = (fi != NULL); + if (within_current_scope) + select_frame (fi); + } - /* Save the current frame and level so we can restore it after - evaluating the watchpoint expression on its own frame. */ - saved_frame = deprecated_selected_frame; - saved_level = frame_relative_level (deprecated_selected_frame); + if (within_current_scope) + { + /* Evaluate the expression and cut the chain of values + produced off from the value chain. - /* Determine if the watchpoint is within scope. */ - if (b->exp_valid_block == NULL) - within_current_scope = 1; - else - { - struct frame_info *fi; - fi = frame_find_by_id (b->watchpoint_frame); - within_current_scope = (fi != NULL); - if (within_current_scope) - select_frame (fi); - } + Make sure the value returned isn't lazy; we use + laziness to determine what memory GDB actually needed + in order to compute the value of the expression. */ + v = evaluate_expression (bpt->owner->exp); + VALUE_CONTENTS (v); + value_release_to_mark (mark); - if (within_current_scope) - { - /* Evaluate the expression and cut the chain of values - produced off from the value chain. + bpt->owner->val_chain = v; + bpt->inserted = 1; - Make sure the value returned isn't lazy; we use - laziness to determine what memory GDB actually needed - in order to compute the value of the expression. */ - v = evaluate_expression (b->exp); - VALUE_CONTENTS(v); - value_release_to_mark (mark); + /* Look at each value on the value chain. */ + for (; v; v = v->next) + { + /* If it's a memory location, and GDB actually needed + its contents to evaluate the expression, then we + must watch it. */ + if (VALUE_LVAL (v) == lval_memory + && ! VALUE_LAZY (v)) + { + struct type *vtype = check_typedef (VALUE_TYPE (v)); + + /* We only watch structs and arrays if user asked + for it explicitly, never if they just happen to + appear in the middle of some value chain. */ + if (v == bpt->owner->val_chain + || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT + && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + { + CORE_ADDR addr; + int len, type; + + addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); + len = TYPE_LENGTH (VALUE_TYPE (v)); + type = hw_write; + if (bpt->owner->type == bp_read_watchpoint) + type = hw_read; + else if (bpt->owner->type == bp_access_watchpoint) + type = hw_access; + + val = target_insert_watchpoint (addr, len, type); + if (val == -1) + { + /* Don't exit the loop, try to insert + every value on the value chain. That's + because we will be removing all the + watches below, and removing a + watchpoint we didn't insert could have + adverse effects. */ + bpt->inserted = 0; + } + val = 0; + } + } + } + /* Failure to insert a watchpoint on any memory value in the + value chain brings us here. */ + if (!bpt->inserted) + { + remove_breakpoint (bpt, mark_uninserted); + *hw_breakpoint_error = 1; + fprintf_unfiltered (tmp_error_stream, + "Could not insert hardware watchpoint %d.\n", + bpt->owner->number); + val = -1; + } + } + else + { + printf_filtered ("Hardware watchpoint %d deleted ", bpt->owner->number); + printf_filtered ("because the program has left the block \n"); + printf_filtered ("in which its expression is valid.\n"); + if (bpt->owner->related_breakpoint) + bpt->owner->related_breakpoint->disposition = disp_del_at_next_stop; + bpt->owner->disposition = disp_del_at_next_stop; + } - b->val_chain = v; - b->inserted = 1; + /* Restore the frame and level. */ + if (saved_frame != deprecated_selected_frame + || saved_level != frame_relative_level (deprecated_selected_frame)) + select_frame (saved_frame); - /* Look at each value on the value chain. */ - for (; v; v = v->next) - { - /* If it's a memory location, and GDB actually needed - its contents to evaluate the expression, then we - must watch it. */ - if (VALUE_LVAL (v) == lval_memory - && ! VALUE_LAZY (v)) - { - struct type *vtype = check_typedef (VALUE_TYPE (v)); - - /* We only watch structs and arrays if user asked - for it explicitly, never if they just happen to - appear in the middle of some value chain. */ - if (v == b->val_chain - || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT - && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) - { - CORE_ADDR addr; - int len, type; - - addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); - len = TYPE_LENGTH (VALUE_TYPE (v)); - type = hw_write; - if (b->type == bp_read_watchpoint) - type = hw_read; - else if (b->type == bp_access_watchpoint) - type = hw_access; - - val = target_insert_watchpoint (addr, len, type); - if (val == -1) - { - /* Don't exit the loop, try to insert - every value on the value chain. That's - because we will be removing all the - watches below, and removing a - watchpoint we didn't insert could have - adverse effects. */ - b->inserted = 0; - } - val = 0; - } - } - } - /* Failure to insert a watchpoint on any memory value in the - value chain brings us here. */ - if (!b->inserted) - { - remove_breakpoint (b, mark_uninserted); - hw_breakpoint_error = 1; - fprintf_unfiltered (tmp_error_stream, - "Could not insert hardware watchpoint %d.\n", - b->number); - val = -1; - } - } - else - { - printf_filtered ("Hardware watchpoint %d deleted ", b->number); - printf_filtered ("because the program has left the block \n"); - printf_filtered ("in which its expression is valid.\n"); - if (b->related_breakpoint) - b->related_breakpoint->disposition = disp_del_at_next_stop; - b->disposition = disp_del_at_next_stop; - } + return val; + } - /* Restore the frame and level. */ - if ((saved_frame != deprecated_selected_frame) || - (saved_level != frame_relative_level (deprecated_selected_frame))) - select_frame (saved_frame); + else if (ep_is_exception_catchpoint (bpt->owner)) + { + /* FIXME drow/2003-09-09: This code sets both a catchpoint and a + breakpoint. Once again, it would be better if this was represented + as two bp_locations. */ - if (val) - return_val = val; /* remember failure */ - } - else if ((b->type == bp_catch_fork - || b->type == bp_catch_vfork - || b->type == bp_catch_exec) - && !b->inserted - && !b->duplicate) - { - char *prefix = xstrprintf ("warning: inserting catchpoint %d: ", - b->number); - struct cleanup *cleanups = make_cleanup (xfree, prefix); - val = catch_exceptions (uiout, insert_catchpoint, b, prefix, - RETURN_MASK_ERROR); - do_cleanups (cleanups); - if (val < 0) - b->enable_state = bp_disabled; - else - b->inserted = 1; - } - } - - if (return_val) + /* If we get here, we must have a callback mechanism for exception + events -- with g++ style embedded label support, we insert + ordinary breakpoints and not catchpoints. */ + val = target_insert_breakpoint (bpt->address, bpt->shadow_contents); + if (val) + { + /* Couldn't set breakpoint for some reason */ + fprintf_unfiltered (tmp_error_stream, + "Cannot insert catchpoint %d; disabling it.\n", + bpt->owner->number); + fprintf_filtered (tmp_error_stream, + "Error accessing memory address "); + print_address_numeric (bpt->address, 1, tmp_error_stream); + fprintf_filtered (tmp_error_stream, ": %s.\n", + safe_strerror (val)); + bpt->owner->enable_state = bp_disabled; + } + else + { + /* Bp set, now make sure callbacks are enabled */ + /* Format possible error msg */ + char *message = xstrprintf ("Error inserting catchpoint %d:\n", + bpt->owner->number); + struct cleanup *cleanups = make_cleanup (xfree, message); + int val; + args_for_catchpoint_enable args; + args.kind = bpt->owner->type == bp_catch_catch ? + EX_EVENT_CATCH : EX_EVENT_THROW; + args.enable_p = 1; + val = catch_errors (cover_target_enable_exception_callback, + &args, message, RETURN_MASK_ALL); + do_cleanups (cleanups); + if (val != 0 && val != -1) + bpt->inserted = 1; + + /* Check if something went wrong; val == 0 can be ignored */ + if (val == -1) + { + /* something went wrong */ + fprintf_unfiltered (tmp_error_stream, + "Cannot insert catchpoint %d; disabling it.\n", + bpt->owner->number); + bpt->owner->enable_state = bp_disabled; + } + } + + return val; + } + + else if (bpt->owner->type == bp_catch_fork + || bpt->owner->type == bp_catch_vfork + || bpt->owner->type == bp_catch_exec) + { + char *prefix = xstrprintf ("warning: inserting catchpoint %d: ", + bpt->owner->number); + struct cleanup *cleanups = make_cleanup (xfree, prefix); + val = catch_exceptions (uiout, insert_catchpoint, bpt->owner, prefix, + RETURN_MASK_ERROR); + do_cleanups (cleanups); + if (val < 0) + bpt->owner->enable_state = bp_disabled; + else + bpt->inserted = 1; + return val; + } + + return 0; +} + +/* insert_breakpoints is used when starting or continuing the program. + remove_breakpoints is used when the program stops. + Both return zero if successful, + or an `errno' value if could not write the inferior. */ + +int +insert_breakpoints (void) +{ + struct bp_location *b, *temp; + int return_val = 0; /* return success code. */ + int val = 0; + int disabled_breaks = 0; + int hw_breakpoint_error = 0; + int process_warning = 0; + + struct ui_file *tmp_error_stream = mem_fileopen (); + make_cleanup_ui_file_delete (tmp_error_stream); + + /* Explicitly mark the warning -- this will only be printed if + there was an error. */ + fprintf_unfiltered (tmp_error_stream, "Warning:\n"); + + ALL_BP_LOCATIONS_SAFE (b, temp) + { + /* Permanent breakpoints cannot be inserted or removed. Disabled + breakpoints should not be inserted. */ + if (b->owner->enable_state != bp_enabled) + continue; + + /* FIXME drow/2003-10-07: This code should be pushed elsewhere when + hardware watchpoints are split into multiple loc breakpoints. */ + if ((b->loc_type == bp_loc_hardware_watchpoint + || b->owner->type == bp_watchpoint) && !b->owner->val) + { + struct value *val; + val = evaluate_expression (b->owner->exp); + release_value (val); + if (VALUE_LAZY (val)) + value_fetch_lazy (val); + b->owner->val = val; + } + + val = insert_bp_location (b, tmp_error_stream, + &disabled_breaks, &process_warning, + &hw_breakpoint_error); + if (val) + return_val = val; + } + + if (return_val) { /* If a hardware breakpoint or watchpoint was inserted, add a message about possibly exhausted resources. */ - if (hw_breakpoint_error) + if (hw_breakpoint_error) { fprintf_unfiltered (tmp_error_stream, "Could not insert hardware breakpoints:\n\ @@ -1118,10 +1150,10 @@ You may have requested too many hardware breakpoints/watchpoints.\n"); int remove_breakpoints (void) { - struct breakpoint *b; + struct bp_location *b; int val; - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) { if (b->inserted) { @@ -1136,15 +1168,12 @@ remove_breakpoints (void) int remove_hw_watchpoints (void) { - struct breakpoint *b; + struct bp_location *b; int val; - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) { - if (b->inserted - && (b->type == bp_hardware_watchpoint - || b->type == bp_read_watchpoint - || b->type == bp_access_watchpoint)) + if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint) { val = remove_breakpoint (b, mark_uninserted); if (val != 0) @@ -1157,21 +1186,23 @@ remove_hw_watchpoints (void) int reattach_breakpoints (int pid) { - struct breakpoint *b; + struct bp_location *b; int val; struct cleanup *old_chain = save_inferior_ptid (); /* Set inferior_ptid; remove_breakpoint uses this global. */ inferior_ptid = pid_to_ptid (pid); - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) { if (b->inserted) { remove_breakpoint (b, mark_inserted); - if (b->type == bp_hardware_breakpoint) + if (b->loc_type == bp_loc_hardware_breakpoint) val = target_insert_hw_breakpoint (b->address, b->shadow_contents); else val = target_insert_breakpoint (b->address, b->shadow_contents); + /* FIXME drow/2003-10-07: This doesn't handle any other kinds of + breakpoints. It's wrong for watchpoints, for example. */ if (val != 0) { do_cleanups (old_chain); @@ -1246,11 +1277,11 @@ update_breakpoints_after_exec (void) automagically. Certainly on HP-UX that's true. Jim Blandy <jimb@redhat.com>: Actually, zero is a perfectly - valid code address on some platforms (like the OBSOLETE mn10200 - and mn10300 simulators). We shouldn't assign any special - interpretation to a breakpoint with a zero address. And in - fact, GDB doesn't --- I can't see what that comment above is - talking about. As far as I can tell, setting the address of a + valid code address on some platforms (like the mn10300 + simulators). We shouldn't assign any special interpretation to + a breakpoint with a zero address. And in fact, GDB doesn't --- + I can't see what that comment above is talking about. As far + as I can tell, setting the address of a bp_catch_exec/bp_catch_vfork/bp_catch_fork breakpoint to zero is meaningless, since those are implemented with HP-UX kernel hackery, not by storing breakpoint instructions somewhere. */ @@ -1258,7 +1289,7 @@ update_breakpoints_after_exec (void) (b->type == bp_catch_vfork) || (b->type == bp_catch_fork)) { - b->address = (CORE_ADDR) NULL; + b->loc->address = (CORE_ADDR) NULL; continue; } @@ -1311,7 +1342,7 @@ update_breakpoints_after_exec (void) unnecessary. A call to breakpoint_re_set_one always recomputes the breakpoint's address from scratch, or deletes it if it can't. So I think this assignment could be deleted without effect. */ - b->address = (CORE_ADDR) NULL; + b->loc->address = (CORE_ADDR) NULL; } /* FIXME what about longjmp breakpoints? Re-create them here? */ create_overlay_event_breakpoint ("_ovly_debug_event"); @@ -1320,7 +1351,7 @@ update_breakpoints_after_exec (void) int detach_breakpoints (int pid) { - struct breakpoint *b; + struct bp_location *b; int val; struct cleanup *old_chain = save_inferior_ptid (); @@ -1329,7 +1360,7 @@ detach_breakpoints (int pid) /* Set inferior_ptid; remove_breakpoint uses this global. */ inferior_ptid = pid_to_ptid (pid); - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) { if (b->inserted) { @@ -1346,27 +1377,20 @@ detach_breakpoints (int pid) } static int -remove_breakpoint (struct breakpoint *b, insertion_state_t is) +remove_breakpoint (struct bp_location *b, insertion_state_t is) { int val; - if (b->enable_state == bp_permanent) + if (b->owner->enable_state == bp_permanent) /* Permanent breakpoints cannot be inserted or removed. */ return 0; - if (b->type == bp_none) + if (b->owner->type == bp_none) warning ("attempted to remove apparently deleted breakpoint #%d?", - b->number); - - if (b->type != bp_watchpoint - && b->type != bp_hardware_watchpoint - && b->type != bp_read_watchpoint - && b->type != bp_access_watchpoint - && b->type != bp_catch_fork - && b->type != bp_catch_vfork - && b->type != bp_catch_exec - && b->type != bp_catch_catch - && b->type != bp_catch_throw) + b->owner->number); + + if (b->loc_type == bp_loc_software_breakpoint + || b->loc_type == bp_loc_hardware_breakpoint) { /* "Normal" instruction breakpoint: either the standard trap-instruction bp (bp_breakpoint), or a @@ -1379,7 +1403,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) { /* No overlay handling: just remove the breakpoint. */ - if (b->type == bp_hardware_breakpoint) + if (b->loc_type == bp_loc_hardware_breakpoint) val = target_remove_hw_breakpoint (b->address, b->shadow_contents); else @@ -1398,7 +1422,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) b->section); /* Ignore any failures: if the LMA is in ROM, we will have already warned when we failed to insert it. */ - if (b->type != bp_hardware_breakpoint) + if (b->loc_type == bp_loc_hardware_breakpoint) target_remove_hw_breakpoint (addr, b->shadow_contents); else target_remove_breakpoint (addr, b->shadow_contents); @@ -1411,7 +1435,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) remove the breakpoint if the section had been unmapped, but let's not rely on that being safe. We don't know what the overlay manager might do. */ - if (b->type == bp_hardware_breakpoint) + if (b->loc_type == bp_loc_hardware_breakpoint) val = target_remove_hw_breakpoint (b->address, b->shadow_contents); else @@ -1428,10 +1452,8 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } - else if ((b->type == bp_hardware_watchpoint || - b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint) - && b->enable_state == bp_enabled + else if (b->loc_type == bp_loc_hardware_watchpoint + && b->owner->enable_state == bp_enabled && !b->duplicate) { struct value *v; @@ -1439,7 +1461,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) b->inserted = (is == mark_inserted); /* Walk down the saved value chain. */ - for (v = b->val_chain; v; v = v->next) + for (v = b->owner->val_chain; v; v = v->next) { /* For each memory reference remove the watchpoint at that address. */ @@ -1448,7 +1470,7 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) { struct type *vtype = check_typedef (VALUE_TYPE (v)); - if (v == b->val_chain + if (v == b->owner->val_chain || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { @@ -1458,9 +1480,9 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); len = TYPE_LENGTH (VALUE_TYPE (v)); type = hw_write; - if (b->type == bp_read_watchpoint) + if (b->owner->type == bp_read_watchpoint) type = hw_read; - else if (b->type == bp_access_watchpoint) + else if (b->owner->type == bp_access_watchpoint) type = hw_access; val = target_remove_watchpoint (addr, len, type); @@ -1473,25 +1495,25 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) /* Failure to remove any of the hardware watchpoints comes here. */ if ((is == mark_uninserted) && (b->inserted)) warning ("Could not remove hardware watchpoint %d.", - b->number); + b->owner->number); /* Free the saved value chain. We will construct a new one the next time the watchpoint is inserted. */ - for (v = b->val_chain; v; v = n) + for (v = b->owner->val_chain; v; v = n) { n = v->next; value_free (v); } - b->val_chain = NULL; + b->owner->val_chain = NULL; } - else if ((b->type == bp_catch_fork || - b->type == bp_catch_vfork || - b->type == bp_catch_exec) - && b->enable_state == bp_enabled + else if ((b->owner->type == bp_catch_fork || + b->owner->type == bp_catch_vfork || + b->owner->type == bp_catch_exec) + && b->owner->enable_state == bp_enabled && !b->duplicate) { val = -1; - switch (b->type) + switch (b->owner->type) { case bp_catch_fork: val = target_remove_fork_catchpoint (PIDGET (inferior_ptid)); @@ -1510,9 +1532,9 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } - else if ((b->type == bp_catch_catch || - b->type == bp_catch_throw) - && b->enable_state == bp_enabled + else if ((b->owner->type == bp_catch_catch || + b->owner->type == bp_catch_throw) + && b->owner->enable_state == bp_enabled && !b->duplicate) { @@ -1521,9 +1543,9 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } - else if (ep_is_exception_catchpoint (b) + else if (ep_is_exception_catchpoint (b->owner) && b->inserted /* sometimes previous insert doesn't happen */ - && b->enable_state == bp_enabled + && b->owner->enable_state == bp_enabled && !b->duplicate) { @@ -1542,10 +1564,10 @@ remove_breakpoint (struct breakpoint *b, insertion_state_t is) void mark_breakpoints_out (void) { - struct breakpoint *b; + struct bp_location *bpt; - ALL_BREAKPOINTS (b) - b->inserted = 0; + ALL_BP_LOCATIONS (bpt) + bpt->inserted = 0; } /* Clear the "inserted" flag in all breakpoints and delete any @@ -1564,12 +1586,14 @@ void breakpoint_init_inferior (enum inf_context context) { struct breakpoint *b, *temp; + struct bp_location *bpt; static int warning_needed = 0; + ALL_BP_LOCATIONS (bpt) + bpt->inserted = 0; + ALL_BREAKPOINTS_SAFE (b, temp) { - b->inserted = 0; - switch (b->type) { case bp_call_dummy: @@ -1638,23 +1662,29 @@ breakpoint_init_inferior (enum inf_context context) enum breakpoint_here breakpoint_here_p (CORE_ADDR pc) { - struct breakpoint *b; + struct bp_location *bpt; int any_breakpoint_here = 0; - ALL_BREAKPOINTS (b) - if ((b->enable_state == bp_enabled - || b->enable_state == bp_permanent) - && b->address == pc) /* bp is enabled and matches pc */ - { - if (overlay_debugging - && section_is_overlay (b->section) - && !section_is_mapped (b->section)) - continue; /* unmapped overlay -- can't be a match */ - else if (b->enable_state == bp_permanent) - return permanent_breakpoint_here; - else - any_breakpoint_here = 1; - } + ALL_BP_LOCATIONS (bpt) + { + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) + continue; + + if ((bpt->owner->enable_state == bp_enabled + || bpt->owner->enable_state == bp_permanent) + && bpt->address == pc) /* bp is enabled and matches pc */ + { + if (overlay_debugging + && section_is_overlay (bpt->section) + && !section_is_mapped (bpt->section)) + continue; /* unmapped overlay -- can't be a match */ + else if (bpt->owner->enable_state == bp_permanent) + return permanent_breakpoint_here; + else + any_breakpoint_here = 1; + } + } return any_breakpoint_here ? ordinary_breakpoint_here : 0; } @@ -1667,18 +1697,24 @@ breakpoint_here_p (CORE_ADDR pc) int breakpoint_inserted_here_p (CORE_ADDR pc) { - struct breakpoint *b; + struct bp_location *bpt; - ALL_BREAKPOINTS (b) - if (b->inserted - && b->address == pc) /* bp is inserted and matches pc */ + ALL_BP_LOCATIONS (bpt) { - if (overlay_debugging - && section_is_overlay (b->section) - && !section_is_mapped (b->section)) - continue; /* unmapped overlay -- can't be a match */ - else - return 1; + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) + continue; + + if (bpt->inserted + && bpt->address == pc) /* bp is inserted and matches pc */ + { + if (overlay_debugging + && section_is_overlay (bpt->section) + && !section_is_mapped (bpt->section)) + continue; /* unmapped overlay -- can't be a match */ + else + return 1; + } } return 0; @@ -1707,38 +1743,43 @@ deprecated_frame_in_dummy (struct frame_info *frame) /* We need to check the PC as well as the frame on the sparc, for signals.exp in the testsuite. */ && (get_frame_pc (frame) - >= (b->address + >= (b->loc->address - DEPRECATED_SIZEOF_CALL_DUMMY_WORDS / sizeof (LONGEST) * DEPRECATED_REGISTER_SIZE)) - && get_frame_pc (frame) <= b->address) + && get_frame_pc (frame) <= b->loc->address) return 1; } return 0; } -/* breakpoint_thread_match (PC, PID) returns true if the breakpoint at - PC is valid for process/thread PID. */ +/* breakpoint_thread_match (PC, PTID) returns true if the breakpoint at + PC is valid for process/thread PTID. */ int breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) { - struct breakpoint *b; + struct bp_location *bpt; int thread; thread = pid_to_thread_id (ptid); - ALL_BREAKPOINTS (b) - if (b->enable_state != bp_disabled - && b->enable_state != bp_shlib_disabled - && b->enable_state != bp_call_disabled - && b->address == pc - && (b->thread == -1 || b->thread == thread)) - { - if (overlay_debugging - && section_is_overlay (b->section) - && !section_is_mapped (b->section)) - continue; /* unmapped overlay -- can't be a match */ - else - return 1; + ALL_BP_LOCATIONS (bpt) + { + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) + continue; + + if ((bpt->owner->enable_state == bp_enabled + || bpt->owner->enable_state == bp_permanent) + && bpt->address == pc + && (bpt->owner->thread == -1 || bpt->owner->thread == thread)) + { + if (overlay_debugging + && section_is_overlay (bpt->section) + && !section_is_mapped (bpt->section)) + continue; /* unmapped overlay -- can't be a match */ + else + return 1; + } } return 0; @@ -1924,7 +1965,6 @@ bpstat_clear_actions (bpstat bs) } /* Stub for cleaning up our state if we error-out of a breakpoint command */ -/* ARGSUSED */ static void cleanup_executing_breakpoints (void *ignore) { @@ -2025,6 +2065,10 @@ print_it_typical (bpstat bs) { case bp_breakpoint: case bp_hardware_breakpoint: + if (bs->breakpoint_at->loc->address != bs->breakpoint_at->loc->requested_address) + breakpoint_adjustment_warning (bs->breakpoint_at->loc->requested_address, + bs->breakpoint_at->loc->address, + bs->breakpoint_at->number, 1); annotate_breakpoint (bs->breakpoint_at->number); ui_out_text (uiout, "\nBreakpoint "); if (ui_out_is_mi_like_p (uiout)) @@ -2542,21 +2586,21 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) && b->type != bp_catch_catch && b->type != bp_catch_throw) /* a non-watchpoint bp */ { - if (b->address != bp_addr) /* address doesn't match */ + if (b->loc->address != bp_addr) /* address doesn't match */ continue; if (overlay_debugging /* unmapped overlay section */ - && section_is_overlay (b->section) - && !section_is_mapped (b->section)) + && section_is_overlay (b->loc->section) + && !section_is_mapped (b->loc->section)) continue; } if (b->type == bp_hardware_breakpoint) { - if (b->address != (*pc - DECR_PC_AFTER_HW_BREAK)) + if (b->loc->address != (*pc - DECR_PC_AFTER_HW_BREAK)) continue; if (overlay_debugging /* unmapped overlay section */ - && section_is_overlay (b->section) - && !section_is_mapped (b->section)) + && section_is_overlay (b->loc->section) + && !section_is_mapped (b->loc->section)) continue; } @@ -2793,8 +2837,8 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) bs->print = 0; bs->commands = b->commands; if (bs->commands && - (STREQ ("silent", bs->commands->line) || - (xdb_commands && STREQ ("Q", bs->commands->line)))) + (strcmp ("silent", bs->commands->line) == 0 + || (xdb_commands && strcmp ("Q", bs->commands->line) == 0))) { bs->commands = bs->commands->next; bs->print = 0; @@ -3140,13 +3184,11 @@ bpstat_should_step (void) int bpstat_have_active_hw_watchpoints (void) { - struct breakpoint *b; - ALL_BREAKPOINTS (b) - if ((b->enable_state == bp_enabled) && - (b->inserted) && - ((b->type == bp_hardware_watchpoint) || - (b->type == bp_read_watchpoint) || - (b->type == bp_access_watchpoint))) + struct bp_location *bpt; + ALL_BP_LOCATIONS (bpt) + if ((bpt->owner->enable_state == bp_enabled) + && bpt->inserted + && bpt->loc_type == bp_loc_hardware_watchpoint) return 1; return 0; } @@ -3412,13 +3454,13 @@ print_one_breakpoint (struct breakpoint *b, if (addressprint) { annotate_field (4); - ui_out_field_core_addr (uiout, "addr", b->address); + ui_out_field_core_addr (uiout, "addr", b->loc->address); } annotate_field (5); - *last_addr = b->address; + *last_addr = b->loc->address; if (b->source_file) { - sym = find_pc_sect_function (b->address, b->section); + sym = find_pc_sect_function (b->loc->address, b->loc->section); if (sym) { ui_out_text (uiout, "in "); @@ -3433,7 +3475,7 @@ print_one_breakpoint (struct breakpoint *b, } else { - print_address_symbolic (b->address, stb->stream, demangle, ""); + print_address_symbolic (b->loc->address, stb->stream, demangle, ""); ui_out_field_stream (uiout, "at", stb); } break; @@ -3666,7 +3708,6 @@ breakpoint_1 (int bnum, int allflag) annotate_breakpoints_table_end (); } -/* ARGSUSED */ static void breakpoints_info (char *bnum_exp, int from_tty) { @@ -3678,7 +3719,6 @@ breakpoints_info (char *bnum_exp, int from_tty) breakpoint_1 (bnum, 0); } -/* ARGSUSED */ static void maintenance_info_breakpoints (char *bnum_exp, int from_tty) { @@ -3699,15 +3739,15 @@ describe_other_breakpoints (CORE_ADDR pc, asection *section) struct breakpoint *b; ALL_BREAKPOINTS (b) - if (b->address == pc) /* address match / overlay match */ - if (!overlay_debugging || b->section == section) + if (b->loc->address == pc) /* address match / overlay match */ + if (!overlay_debugging || b->loc->section == section) others++; if (others > 0) { printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : ""); ALL_BREAKPOINTS (b) - if (b->address == pc) /* address match / overlay match */ - if (!overlay_debugging || b->section == section) + if (b->loc->address == pc) /* address match / overlay match */ + if (!overlay_debugging || b->loc->section == section) { others--; printf_filtered ("%d%s%s ", @@ -3784,25 +3824,25 @@ breakpoint_address_is_meaningful (struct breakpoint *bpt) static void check_duplicates (struct breakpoint *bpt) { - struct breakpoint *b; + struct bp_location *b; int count = 0; - struct breakpoint *perm_bp = 0; - CORE_ADDR address = bpt->address; - asection *section = bpt->section; + struct bp_location *perm_bp = 0; + CORE_ADDR address = bpt->loc->address; + asection *section = bpt->loc->section; if (! breakpoint_address_is_meaningful (bpt)) return; - ALL_BREAKPOINTS (b) - if (b->enable_state != bp_disabled - && b->enable_state != bp_shlib_disabled - && b->enable_state != bp_call_disabled + ALL_BP_LOCATIONS (b) + if (b->owner->enable_state != bp_disabled + && b->owner->enable_state != bp_shlib_disabled + && b->owner->enable_state != bp_call_disabled && b->address == address /* address / overlay match */ && (!overlay_debugging || b->section == section) - && breakpoint_address_is_meaningful (b)) + && breakpoint_address_is_meaningful (b->owner)) { /* Have we found a permanent breakpoint? */ - if (b->enable_state == bp_permanent) + if (b->owner->enable_state == bp_permanent) { perm_bp = b; break; @@ -3825,25 +3865,140 @@ check_duplicates (struct breakpoint *bpt) "allegedly permanent breakpoint is not " "actually inserted"); - ALL_BREAKPOINTS (b) + ALL_BP_LOCATIONS (b) if (b != perm_bp) { - if (b->inserted) - internal_error (__FILE__, __LINE__, - "another breakpoint was inserted on top of " - "a permanent breakpoint"); - - if (b->enable_state != bp_disabled - && b->enable_state != bp_shlib_disabled - && b->enable_state != bp_call_disabled + if (b->owner->enable_state != bp_disabled + && b->owner->enable_state != bp_shlib_disabled + && b->owner->enable_state != bp_call_disabled && b->address == address /* address / overlay match */ && (!overlay_debugging || b->section == section) - && breakpoint_address_is_meaningful (b)) - b->duplicate = 1; + && breakpoint_address_is_meaningful (b->owner)) + { + if (b->inserted) + internal_error (__FILE__, __LINE__, + "another breakpoint was inserted on top of " + "a permanent breakpoint"); + + b->duplicate = 1; + } } } } +static void +breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, + int bnum, int have_bnum) +{ + char astr1[40]; + char astr2[40]; + + strcpy (astr1, local_hex_string_custom ((unsigned long) from_addr, "08l")); + strcpy (astr2, local_hex_string_custom ((unsigned long) to_addr, "08l")); + if (have_bnum) + warning ("Breakpoint %d address previously adjusted from %s to %s.", + bnum, astr1, astr2); + else + warning ("Breakpoint address adjusted from %s to %s.", astr1, astr2); +} + +/* Adjust a breakpoint's address to account for architectural constraints + on breakpoint placement. Return the adjusted address. Note: Very + few targets require this kind of adjustment. For most targets, + this function is simply the identity function. */ + +static CORE_ADDR +adjust_breakpoint_address (CORE_ADDR bpaddr) +{ + if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch)) + { + /* Very few targets need any kind of breakpoint adjustment. */ + return bpaddr; + } + else + { + CORE_ADDR adjusted_bpaddr; + + /* Some targets have architectural constraints on the placement + of breakpoint instructions. Obtain the adjusted address. */ + adjusted_bpaddr = gdbarch_adjust_breakpoint_address (current_gdbarch, + bpaddr); + + /* An adjusted breakpoint address can significantly alter + a user's expectations. Print a warning if an adjustment + is required. */ + if (adjusted_bpaddr != bpaddr) + breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, 0); + + return adjusted_bpaddr; + } +} + +/* Allocate a struct bp_location. */ + +static struct bp_location * +allocate_bp_location (struct breakpoint *bpt, enum bptype bp_type) +{ + struct bp_location *loc, *loc_p; + + loc = xmalloc (sizeof (struct bp_location)); + memset (loc, 0, sizeof (*loc)); + + loc->owner = bpt; + + switch (bp_type) + { + case bp_breakpoint: + case bp_until: + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: + case bp_step_resume: + case bp_through_sigtramp: + case bp_watchpoint_scope: + case bp_call_dummy: + case bp_shlib_event: + case bp_thread_event: + case bp_overlay_event: + case bp_catch_load: + case bp_catch_unload: + loc->loc_type = bp_loc_software_breakpoint; + break; + case bp_hardware_breakpoint: + loc->loc_type = bp_loc_hardware_breakpoint; + break; + case bp_hardware_watchpoint: + case bp_read_watchpoint: + case bp_access_watchpoint: + loc->loc_type = bp_loc_hardware_watchpoint; + break; + case bp_watchpoint: + case bp_catch_fork: + case bp_catch_vfork: + case bp_catch_exec: + case bp_catch_catch: + case bp_catch_throw: + loc->loc_type = bp_loc_other; + break; + default: + internal_error (__FILE__, __LINE__, "unknown breakpoint type"); + } + + /* Add this breakpoint to the end of the chain. */ + + loc_p = bp_location_chain; + if (loc_p == 0) + bp_location_chain = loc; + else + { + while (loc_p->next) + loc_p = loc_p->next; + loc_p->next = loc; + } + + return loc; +} + /* set_raw_breakpoint() is a low level routine for allocating and partially initializing a breakpoint of type BPTYPE. The newly created breakpoint's address, section, source file name, and line @@ -3866,13 +4021,15 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint)); memset (b, 0, sizeof (*b)); - b->address = sal.pc; + b->loc = allocate_bp_location (b, bptype); + b->loc->requested_address = sal.pc; + b->loc->address = adjust_breakpoint_address (b->loc->requested_address); if (sal.symtab == NULL) b->source_file = NULL; else b->source_file = savestring (sal.symtab->filename, strlen (sal.symtab->filename)); - b->section = sal.section; + b->loc->section = sal.section; b->type = bptype; b->language = current_language->la_language; b->input_radix = input_radix; @@ -3919,7 +4076,7 @@ make_breakpoint_permanent (struct breakpoint *b) b->enable_state = bp_permanent; /* By definition, permanent breakpoints are already present in the code. */ - b->inserted = 1; + b->loc->inserted = 1; } static struct breakpoint * @@ -3952,7 +4109,7 @@ create_longjmp_breakpoint (char *func_name) b = create_internal_breakpoint (0, bp_longjmp_resume); else { - if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL) + if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL) return; b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), bp_longjmp); @@ -4001,7 +4158,7 @@ create_overlay_event_breakpoint (char *func_name) struct breakpoint *b; struct minimal_symbol *m; - if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL) + if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL) return; b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), @@ -4057,7 +4214,7 @@ create_thread_event_breakpoint (CORE_ADDR address) b->enable_state = bp_enabled; /* addr_string has to be used or breakpoint_re_set will delete me. */ - xasprintf (&b->addr_string, "*0x%s", paddr (b->address)); + xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address)); return b; } @@ -4108,8 +4265,8 @@ disable_breakpoints_in_shlibs (int silent) if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint)) && b->enable_state == bp_enabled && - !b->duplicate && - PC_SOLIB (b->address)) + !b->loc->duplicate && + PC_SOLIB (b->loc->address)) { b->enable_state = bp_shlib_disabled; if (!silent) @@ -4140,7 +4297,7 @@ re_enable_breakpoints_in_shlibs (void) /* Do not reenable the breakpoint if the shared library is still not mapped in. */ - if (target_read_memory (b->address, buf, 1) == 0) + if (target_read_memory (b->loc->address, buf, 1) == 0) b->enable_state = bp_enabled; } } @@ -4357,7 +4514,8 @@ set_longjmp_resume_breakpoint (CORE_ADDR pc, struct frame_id frame_id) ALL_BREAKPOINTS (b) if (b->type == bp_longjmp_resume) { - b->address = pc; + b->loc->requested_address = pc; + b->loc->address = adjust_breakpoint_address (b->loc->requested_address); b->enable_state = bp_enabled; b->frame_id = frame_id; check_duplicates (b); @@ -4557,7 +4715,7 @@ mention (struct breakpoint *b) if (addressprint || b->source_file == NULL) { printf_filtered (" at "); - print_address_numeric (b->address, 1, gdb_stdout); + print_address_numeric (b->loc->address, 1, gdb_stdout); } if (b->source_file) printf_filtered (": file %s, line %d.", @@ -4619,7 +4777,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, else /* addr_string has to be used or breakpoint_re_set will delete me. */ - xasprintf (&b->addr_string, "*0x%s", paddr (b->address)); + xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address)); b->cond_string = cond_string[i]; b->ignore_count = ignore_count; b->enable_state = bp_enabled; @@ -5320,7 +5478,6 @@ stopat_command (char *arg, int from_tty) break_command_1 (arg, 0, from_tty); } -/* ARGSUSED */ /* accessflag: hw_write: watch write, hw_read: watch read, hw_access: watch access (read or write) */ @@ -5473,7 +5630,10 @@ watch_command_1 (char *arg, int accessflag, int from_tty) scope_breakpoint->frame_id = get_frame_id (prev_frame); /* Set the address at which we will stop. */ - scope_breakpoint->address = get_frame_pc (prev_frame); + scope_breakpoint->loc->requested_address + = get_frame_pc (prev_frame); + scope_breakpoint->loc->address + = adjust_breakpoint_address (scope_breakpoint->loc->requested_address); /* The scope breakpoint is related to the watchpoint. We will need to act on them together. */ @@ -5623,7 +5783,6 @@ until_break_command_continuation (struct continuation_arg *arg) do_exec_cleanups (cleanups); } -/* ARGSUSED */ void until_break_command (char *arg, int from_tty, int anywhere) { @@ -6066,10 +6225,10 @@ print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr) if (addressprint) { annotate_field (4); - ui_out_field_core_addr (uiout, "addr", b->address); + ui_out_field_core_addr (uiout, "addr", b->loc->address); } annotate_field (5); - *last_addr = b->address; + *last_addr = b->loc->address; if (strstr (b->addr_string, "throw") != NULL) ui_out_field_string (uiout, "what", "exception throw"); else @@ -6425,14 +6584,14 @@ clear_command (char *arg, int from_tty) && b->type != bp_read_watchpoint && b->type != bp_access_watchpoint /* Not if b is a watchpoint of any sort... */ - && (((sal.pc && (b->address == sal.pc)) - && (!section_is_overlay (b->section) - || b->section == sal.section)) + && (((sal.pc && (b->loc->address == sal.pc)) + && (!section_is_overlay (b->loc->section) + || b->loc->section == sal.section)) /* Yes, if sal.pc matches b (modulo overlays). */ || ((default_match || (0 == sal.pc)) && b->source_file != NULL && sal.symtab != NULL - && STREQ (b->source_file, sal.symtab->filename) + && strcmp (b->source_file, sal.symtab->filename) == 0 && b->line_number == sal.line))) /* Yes, if sal source file and line matches b. */ { @@ -6512,6 +6671,7 @@ delete_breakpoint (struct breakpoint *bpt) { struct breakpoint *b; bpstat bs; + struct bp_location *loc; if (bpt == NULL) error ("Internal error (attempted to delete a NULL breakpoint)"); @@ -6537,12 +6697,15 @@ delete_breakpoint (struct breakpoint *bpt) delete_breakpoint_hook (bpt); breakpoint_delete_event (bpt->number); - if (bpt->inserted) - remove_breakpoint (bpt, mark_inserted); + if (bpt->loc->inserted) + remove_breakpoint (bpt->loc, mark_inserted); if (breakpoint_chain == bpt) breakpoint_chain = bpt->next; + if (bp_location_chain == bpt->loc) + bp_location_chain = bpt->loc->next; + /* If we have callback-style exception catchpoints, don't go through the adjustments to the C++ runtime library etc. if the inferior isn't actually running. target_enable_exception_callback for a @@ -6572,10 +6735,17 @@ delete_breakpoint (struct breakpoint *bpt) break; } + ALL_BP_LOCATIONS (loc) + if (loc->next == bpt->loc) + { + loc->next = bpt->loc->next; + break; + } + check_duplicates (bpt); /* If this breakpoint was inserted, and there is another breakpoint at the same address, we need to insert the other breakpoint. */ - if (bpt->inserted + if (bpt->loc->inserted && bpt->type != bp_hardware_watchpoint && bpt->type != bp_read_watchpoint && bpt->type != bp_access_watchpoint @@ -6584,9 +6754,9 @@ delete_breakpoint (struct breakpoint *bpt) && bpt->type != bp_catch_exec) { ALL_BREAKPOINTS (b) - if (b->address == bpt->address - && b->section == bpt->section - && !b->duplicate + if (b->loc->address == bpt->loc->address + && b->loc->section == bpt->loc->section + && !b->loc->duplicate && b->enable_state != bp_disabled && b->enable_state != bp_shlib_disabled && b->enable_state != bp_call_disabled) @@ -6603,9 +6773,9 @@ delete_breakpoint (struct breakpoint *bpt) "a permanent breakpoint"); if (b->type == bp_hardware_breakpoint) - val = target_insert_hw_breakpoint (b->address, b->shadow_contents); + val = target_insert_hw_breakpoint (b->loc->address, b->loc->shadow_contents); else - val = target_insert_breakpoint (b->address, b->shadow_contents); + val = target_insert_breakpoint (b->loc->address, b->loc->shadow_contents); /* If there was an error in the insert, print a message, then stop execution. */ if (val != 0) @@ -6625,7 +6795,7 @@ delete_breakpoint (struct breakpoint *bpt) { fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number); fprintf_filtered (tmp_error_stream, "Error accessing memory address "); - print_address_numeric (b->address, 1, tmp_error_stream); + print_address_numeric (b->loc->address, 1, tmp_error_stream); fprintf_filtered (tmp_error_stream, ": %s.\n", safe_strerror (val)); } @@ -6635,7 +6805,7 @@ delete_breakpoint (struct breakpoint *bpt) error_stream(tmp_error_stream); } else - b->inserted = 1; + b->loc->inserted = 1; } } @@ -6675,6 +6845,7 @@ delete_breakpoint (struct breakpoint *bpt) bp, we mark it as deleted before freeing its storage. */ bpt->type = bp_none; + xfree (bpt->loc); xfree (bpt); } @@ -6816,12 +6987,12 @@ breakpoint_re_set_one (void *bint) } /* We need to re-set the breakpoint if the address changes... */ - if (b->address != sals.sals[i].pc + if (b->loc->address != sals.sals[i].pc /* ...or new and old breakpoints both have source files, and the source file name or the line number changes... */ || (b->source_file != NULL && sals.sals[i].symtab != NULL - && (!STREQ (b->source_file, sals.sals[i].symtab->filename) + && (strcmp (b->source_file, sals.sals[i].symtab->filename) != 0 || b->line_number != sals.sals[i].line) ) /* ...or we switch between having a source file and not having @@ -6838,7 +7009,9 @@ breakpoint_re_set_one (void *bint) savestring (sals.sals[i].symtab->filename, strlen (sals.sals[i].symtab->filename)); b->line_number = sals.sals[i].line; - b->address = sals.sals[i].pc; + b->loc->requested_address = sals.sals[i].pc; + b->loc->address + = adjust_breakpoint_address (b->loc->requested_address); /* Used to check for duplicates here, but that can cause trouble, as it doesn't check for disabled @@ -6850,7 +7023,7 @@ breakpoint_re_set_one (void *bint) rather than once for every breakpoint. */ breakpoints_changed (); } - b->section = sals.sals[i].section; + b->loc->section = sals.sals[i].section; b->enable_state = save_enable; /* Restore it, this worked. */ @@ -7132,7 +7305,6 @@ disable_breakpoint (struct breakpoint *bpt) breakpoint_modify_event (bpt->number); } -/* ARGSUSED */ static void disable_command (char *args, int from_tty) { @@ -7266,7 +7438,6 @@ enable_breakpoint (struct breakpoint *bpt) breakpoints) so they once again become (or continue to be) effective in stopping the inferior. */ -/* ARGSUSED */ static void enable_command (char *args, int from_tty) { @@ -7306,7 +7477,6 @@ enable_once_breakpoint (struct breakpoint *bpt) do_enable_breakpoint (bpt, disp_disable); } -/* ARGSUSED */ static void enable_once_command (char *args, int from_tty) { @@ -7319,7 +7489,6 @@ enable_delete_breakpoint (struct breakpoint *bpt) do_enable_breakpoint (bpt, disp_del); } -/* ARGSUSED */ static void enable_delete_command (char *args, int from_tty) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 86eec4a..85cc8b9 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -184,6 +184,79 @@ enum target_hw_bp_type hw_execute = 3 /* Execute HW breakpoint */ }; +/* GDB maintains two types of information about each breakpoint (or + watchpoint, or other related event). The first type corresponds + to struct breakpoint; this is a relatively high-level structure + which contains the source location(s), stopping conditions, user + commands to execute when the breakpoint is hit, and so forth. + + The second type of information corresponds to struct bp_location. + Each breakpoint has one or (eventually) more locations associated + with it, which represent target-specific and machine-specific + mechanisms for stopping the program. For instance, a watchpoint + expression may require multiple hardware watchpoints in order to + catch all changes in the value of the expression being watched. */ + +enum bp_loc_type +{ + bp_loc_software_breakpoint, + bp_loc_hardware_breakpoint, + bp_loc_hardware_watchpoint, + bp_loc_other /* Miscellaneous... */ +}; + +struct bp_location +{ + /* Chain pointer to the next breakpoint location. */ + struct bp_location *next; + + /* Type of this breakpoint location. */ + enum bp_loc_type loc_type; + + /* Each breakpoint location must belong to exactly one higher-level + breakpoint. This and the DUPLICATE flag are more straightforward + than reference counting. */ + struct breakpoint *owner; + + /* Nonzero if this breakpoint is now inserted. */ + char inserted; + + /* Nonzero if this is not the first breakpoint in the list + for the given address. */ + char duplicate; + + /* If we someday support real thread-specific breakpoints, then + the breakpoint location will need a thread identifier. */ + + /* Data for specific breakpoint types. These could be a union, but + simplicity is more important than memory usage for breakpoints. */ + + /* Note that zero is a perfectly valid code address on some platforms + (for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL + is not a special value for this field. Valid for all types except + bp_loc_other. */ + CORE_ADDR address; + + /* For any breakpoint type with an address, this is the BFD section + associated with the address. Used primarily for overlay debugging. */ + asection *section; + + /* "Real" contents of byte where breakpoint has been inserted. + Valid only when breakpoints are in the program. Under the complete + control of the target insert_breakpoint and remove_breakpoint routines. + No other code should assume anything about the value(s) here. + Valid only for bp_loc_software_breakpoint. */ + char shadow_contents[BREAKPOINT_MAX]; + + /* Address at which breakpoint was requested, either by the user or + by GDB for internal breakpoints. This will usually be the same + as ``address'' (above) except for cases in which + ADJUST_BREAKPOINT_ADDRESS has computed a different address at + which to place the breakpoint in order to comply with a + processor's architectual constraints. */ + CORE_ADDR requested_address; +}; + /* This structure is a collection of function pointers that, if available, will be called instead of the performing the default action for this bptype. */ @@ -222,11 +295,8 @@ struct breakpoint /* Number assigned to distinguish breakpoints. */ int number; - /* Address to break at. Note that zero is a perfectly valid code - address on some platforms (for example, the OBSOLETE mn10200 - and mn10300 simulators). NULL is not a special value for this - field. */ - CORE_ADDR address; + /* Location(s) associated with this high-level breakpoint. */ + struct bp_location *loc; /* Line number of this address. */ @@ -242,16 +312,6 @@ struct breakpoint /* Number of stops at this breakpoint that should be continued automatically before really stopping. */ int ignore_count; - /* "Real" contents of byte where breakpoint has been inserted. - Valid only when breakpoints are in the program. Under the complete - control of the target insert_breakpoint and remove_breakpoint routines. - No other code should assume anything about the value(s) here. */ - char shadow_contents[BREAKPOINT_MAX]; - /* Nonzero if this breakpoint is now inserted. */ - char inserted; - /* Nonzero if this is not the first breakpoint in the list - for the given address. */ - char duplicate; /* Chain of command lines to execute when this breakpoint is hit. */ struct command_line *commands; /* Stack depth (address of frame). If nonzero, break only if fp @@ -323,8 +383,6 @@ struct breakpoint triggered. */ char *exec_pathname; - asection *section; - /* Methods associated with this breakpoint. */ struct breakpoint_ops *ops; }; diff --git a/gdb/buildsym.c b/gdb/buildsym.c index ff89218..a3ac7d6 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -164,7 +164,6 @@ find_symbol_in_list (struct pending *list, char *name, int length) /* At end of reading syms, or in case of quit, really free as many `struct pending's as we can easily find. */ -/* ARGSUSED */ void really_free_pendings (void *dummy) { @@ -593,17 +592,9 @@ start_subfile (const char *name, char *dirname) later via a call to record_debugformat. */ subfile->debugformat = NULL; -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* cfront output is a C program, so in most ways it looks like a C -// OBSOLETE program. But to demangle we need to set the language to C++. We -// OBSOLETE can distinguish cfront code by the fact that it has #line -// OBSOLETE directives which specify a file name ending in .C. */ -#endif /* OBSOLETE CFront */ - /* If the filename of this subfile ends in .C, then change the language of any pending subfiles from C to C++. We also accept any other C++ suffixes accepted by deduce_language_from_filename. */ - /* OBSOLETE (in particular, some people use .cxx with cfront). */ /* Likewise for f2c. */ if (subfile->name) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index abe52d7..206170d 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -705,7 +705,7 @@ variable: name_not_typename else { struct minimal_symbol *msymbol; - register char *arg = copy_name ($1.stoken); + char *arg = copy_name ($1.stoken); msymbol = lookup_minimal_symbol_linkage_or_natural (arg); @@ -1045,20 +1045,20 @@ name_not_typename : NAME static int parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; + char *p; + int len; int parsed_float; YYSTYPE *putithere; { /* FIXME: Shouldn't these be unsigned? We don't deal with negative values here, and we do kind of silly things like cast to unsigned. */ - register LONGEST n = 0; - register LONGEST prevn = 0; + LONGEST n = 0; + LONGEST prevn = 0; ULONGEST un; - register int i = 0; - register int c; - register int base = input_radix; + int i = 0; + int c; + int base = input_radix; int unsigned_p = 0; /* Number of "L" suffixes encountered. */ @@ -1338,7 +1338,7 @@ yylex () tokstart = lexptr; /* See if it is a special token of length 3. */ for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (STREQN (tokstart, tokentab3[i].operator, 3)) + if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) { lexptr += 3; yylval.opcode = tokentab3[i].opcode; @@ -1347,7 +1347,7 @@ yylex () /* See if it is a special token of length 2. */ for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (STREQN (tokstart, tokentab2[i].operator, 2)) + if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) { lexptr += 2; yylval.opcode = tokentab2[i].opcode; @@ -1455,7 +1455,7 @@ yylex () { /* It's a number. */ int got_dot = 0, got_e = 0, toktype; - register char *p = tokstart; + char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) @@ -1643,52 +1643,52 @@ yylex () switch (namelen) { case 8: - if (STREQN (tokstart, "unsigned", 8)) + if (strncmp (tokstart, "unsigned", 8) == 0) return UNSIGNED; if (current_language->la_language == language_cplus - && STREQN (tokstart, "template", 8)) + && strncmp (tokstart, "template", 8) == 0) return TEMPLATE; - if (STREQN (tokstart, "volatile", 8)) + if (strncmp (tokstart, "volatile", 8) == 0) return VOLATILE_KEYWORD; break; case 6: - if (STREQN (tokstart, "struct", 6)) + if (strncmp (tokstart, "struct", 6) == 0) return STRUCT; - if (STREQN (tokstart, "signed", 6)) + if (strncmp (tokstart, "signed", 6) == 0) return SIGNED_KEYWORD; - if (STREQN (tokstart, "sizeof", 6)) + if (strncmp (tokstart, "sizeof", 6) == 0) return SIZEOF; - if (STREQN (tokstart, "double", 6)) + if (strncmp (tokstart, "double", 6) == 0) return DOUBLE_KEYWORD; break; case 5: if (current_language->la_language == language_cplus) { - if (STREQN (tokstart, "false", 5)) + if (strncmp (tokstart, "false", 5) == 0) return FALSEKEYWORD; - if (STREQN (tokstart, "class", 5)) + if (strncmp (tokstart, "class", 5) == 0) return CLASS; } - if (STREQN (tokstart, "union", 5)) + if (strncmp (tokstart, "union", 5) == 0) return UNION; - if (STREQN (tokstart, "short", 5)) + if (strncmp (tokstart, "short", 5) == 0) return SHORT; - if (STREQN (tokstart, "const", 5)) + if (strncmp (tokstart, "const", 5) == 0) return CONST_KEYWORD; break; case 4: - if (STREQN (tokstart, "enum", 4)) + if (strncmp (tokstart, "enum", 4) == 0) return ENUM; - if (STREQN (tokstart, "long", 4)) + if (strncmp (tokstart, "long", 4) == 0) return LONG; if (current_language->la_language == language_cplus) { - if (STREQN (tokstart, "true", 4)) + if (strncmp (tokstart, "true", 4) == 0) return TRUEKEYWORD; } break; case 3: - if (STREQN (tokstart, "int", 3)) + if (strncmp (tokstart, "int", 3) == 0) return INT_KEYWORD; break; default: diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 4a5a362..a296d81 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -543,9 +543,9 @@ const struct language_defn c_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, c_preprocess_and_parse, c_error, - evaluate_subexp_standard, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -565,6 +565,7 @@ const struct language_defn c_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -599,9 +600,9 @@ const struct language_defn cplus_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, c_preprocess_and_parse, c_error, - evaluate_subexp_standard, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -621,6 +622,7 @@ const struct language_defn cplus_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -632,9 +634,9 @@ const struct language_defn asm_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, c_preprocess_and_parse, c_error, - evaluate_subexp_standard, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -654,6 +656,7 @@ const struct language_defn asm_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -670,9 +673,9 @@ const struct language_defn minimal_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, c_preprocess_and_parse, c_error, - evaluate_subexp_standard, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ c_emit_char, /* Print a single char */ @@ -692,6 +695,7 @@ const struct language_defn minimal_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index ac46735..85e1610 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -859,10 +859,11 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, QUIT; /* Don't print out virtual function table. */ /* HP ANSI C++ case */ - if (TYPE_HAS_VTABLE (type) && (STREQN (TYPE_FIELD_NAME (type, i), "__vfp", 5))) + if (TYPE_HAS_VTABLE (type) + && (strncmp (TYPE_FIELD_NAME (type, i), "__vfp", 5) == 0)) continue; /* Other compilers */ - if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5) + if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0 && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; @@ -944,7 +945,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i); char *method_name = TYPE_FN_FIELDLIST_NAME (type, i); const char *name = type_name_no_tag (type); - int is_constructor = name && STREQ (method_name, name); + int is_constructor = name && strcmp (method_name, name) == 0; for (j = 0; j < len2; j++) { char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 3e8cf74..af47ba1 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -30,6 +30,7 @@ #include "language.h" #include "c-lang.h" #include "cp-abi.h" +#include "target.h" /* Print function pointer with inferior address ADDRESS onto stdio @@ -38,7 +39,9 @@ static void print_function_pointer_address (CORE_ADDR address, struct ui_file *stream) { - CORE_ADDR func_addr = CONVERT_FROM_FUNC_PTR_ADDR (address); + CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + address, + ¤t_target); /* If the function pointer is represented by a description, print the address of the description. */ diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 2e5a3c1..9f48a0a 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -118,7 +118,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols, if (nr_rows == 0) data->suppress_output = 1; else - /* Only the table suppresses the output and, fortunatly, a table + /* Only the table suppresses the output and, fortunately, a table is not a recursive data structure. */ gdb_assert (data->suppress_output == 0); } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 45794f7..6f9fe90 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -184,7 +184,6 @@ error_no_arg (char *why) /* The "info" command is defined as a prefix, with allow_unknown = 0. Therefore, its own definition is called only for "info" with no args. */ -/* ARGSUSED */ static void info_command (char *arg, int from_tty) { @@ -194,7 +193,6 @@ info_command (char *arg, int from_tty) /* The "show" command with no arguments shows all the settings. */ -/* ARGSUSED */ static void show_command (char *arg, int from_tty) { @@ -204,7 +202,6 @@ show_command (char *arg, int from_tty) /* Provide documentation on command or list given by COMMAND. FROM_TTY is ignored. */ -/* ARGSUSED */ static void help_command (char *command, int from_tty) { @@ -222,7 +219,6 @@ compare_strings (const void *arg1, const void *arg2) /* The "complete" command is used by Emacs to implement completion. */ -/* ARGSUSED */ static void complete_command (char *arg, int from_tty) { @@ -275,7 +271,6 @@ is_complete_command (struct cmd_list_element *c) return cmd_cfunc_eq (c, complete_command); } -/* ARGSUSED */ static void show_version (char *args, int from_tty) { @@ -295,7 +290,6 @@ quit_command (char *args, int from_tty) quit_force (args, from_tty); } -/* ARGSUSED */ static void pwd_command (char *args, int from_tty) { @@ -303,7 +297,7 @@ pwd_command (char *args, int from_tty) error ("The \"pwd\" command does not take an argument: %s", args); getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - if (!STREQ (gdb_dirbuf, current_directory)) + if (strcmp (gdb_dirbuf, current_directory) != 0) printf_unfiltered ("Working directory %s\n (canonically %s).\n", current_directory, gdb_dirbuf); else @@ -439,12 +433,11 @@ source_command (char *args, int from_tty) do_cleanups (old_cleanups); } -/* ARGSUSED */ static void echo_command (char *text, int from_tty) { char *p = text; - register int c; + int c; if (text) while ((c = *p++) != '\0') @@ -469,7 +462,6 @@ echo_command (char *text, int from_tty) gdb_flush (gdb_stdout); } -/* ARGSUSED */ static void shell_escape (char *arg, int from_tty) { @@ -659,7 +651,7 @@ list_command (char *arg, int from_tty) /* "l" or "l +" lists next ten lines. */ - if (arg == 0 || STREQ (arg, "+")) + if (arg == 0 || strcmp (arg, "+") == 0) { print_source_lines (cursal.symtab, cursal.line, cursal.line + get_lines_to_list (), 0); @@ -667,7 +659,7 @@ list_command (char *arg, int from_tty) } /* "l -" lists previous ten lines, the ones before the ten just listed. */ - if (STREQ (arg, "-")) + if (strcmp (arg, "-") == 0) { print_source_lines (cursal.symtab, max (get_first_line_listed () - get_lines_to_list (), 1), @@ -820,7 +812,6 @@ list_command (char *arg, int from_tty) Two arguments are interpeted as bounds within which to dump assembly. */ -/* ARGSUSED */ static void disassemble_command (char *arg, int from_tty) { @@ -920,7 +911,6 @@ make_command (char *arg, int from_tty) shell_escape (p, from_tty); } -/* ARGSUSED */ static void show_user (char *args, int from_tty) { diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 8a0d057..24965688e 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -133,7 +133,7 @@ struct cmd_list_element * add_cmd (char *name, enum command_class class, void (*fun) (char *, int), char *doc, struct cmd_list_element **list) { - register struct cmd_list_element *c + struct cmd_list_element *c = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element)); struct cmd_list_element *p; @@ -212,8 +212,8 @@ add_alias_cmd (char *name, char *oldname, enum command_class class, { /* Must do this since lookup_cmd tries to side-effect its first arg */ char *copied_name; - register struct cmd_list_element *old; - register struct cmd_list_element *c; + struct cmd_list_element *old; + struct cmd_list_element *c; copied_name = (char *) alloca (strlen (oldname) + 1); strcpy (copied_name, oldname); old = lookup_cmd (&copied_name, *list, "", 1, 1); @@ -247,7 +247,7 @@ add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int), char *prefixname, int allow_unknown, struct cmd_list_element **list) { - register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list); + struct cmd_list_element *c = add_cmd (name, class, fun, doc, list); c->prefixlist = prefixlist; c->prefixname = prefixname; c->allow_unknown = allow_unknown; @@ -262,7 +262,7 @@ add_abbrev_prefix_cmd (char *name, enum command_class class, struct cmd_list_element **prefixlist, char *prefixname, int allow_unknown, struct cmd_list_element **list) { - register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list); + struct cmd_list_element *c = add_cmd (name, class, fun, doc, list); c->prefixlist = prefixlist; c->prefixname = prefixname; c->allow_unknown = allow_unknown; @@ -500,10 +500,10 @@ add_show_from_set (struct cmd_list_element *setcmd, void delete_cmd (char *name, struct cmd_list_element **list) { - register struct cmd_list_element *c; + struct cmd_list_element *c; struct cmd_list_element *p; - while (*list && STREQ ((*list)->name, name)) + while (*list && strcmp ((*list)->name, name) == 0) { if ((*list)->hookee_pre) (*list)->hookee_pre->hook_pre = 0; /* Hook slips out of its mouth */ @@ -517,7 +517,7 @@ delete_cmd (char *name, struct cmd_list_element **list) if (*list) for (c = *list; c->next;) { - if (STREQ (c->next->name, name)) + if (strcmp (c->next->name, name) == 0) { if (c->next->hookee_pre) c->next->hookee_pre->hook_pre = 0; /* hooked cmd gets away. */ @@ -577,7 +577,7 @@ void apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist, struct re_pattern_buffer *regex, char *prefix) { - register struct cmd_list_element *c; + struct cmd_list_element *c; int returnvalue=1; /*Needed to avoid double printing*/ /* Walk through the commands */ for (c=commandlist;c;c=c->next) @@ -786,7 +786,7 @@ print_doc_line (struct ui_file *stream, char *str) { static char *line_buffer = 0; static int line_size; - register char *p; + char *p; if (!line_buffer) { @@ -830,7 +830,7 @@ void help_cmd_list (struct cmd_list_element *list, enum command_class class, char *prefix, int recurse, struct ui_file *stream) { - register struct cmd_list_element *c; + struct cmd_list_element *c; for (c = list; c; c = c->next) { diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index ab69ca4..cac5408 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -255,7 +255,7 @@ do_restore_user_call_depth (void * call_depth) void execute_user_command (struct cmd_list_element *c, char *args) { - register struct command_line *cmdlines; + struct command_line *cmdlines; struct cleanup *old_chain; enum command_control_type ret; static int user_call_depth = 0; @@ -974,8 +974,8 @@ read_command_lines (char *prompt_arg, int from_tty) void free_command_lines (struct command_line **lptr) { - register struct command_line *l = *lptr; - register struct command_line *next; + struct command_line *l = *lptr; + struct command_line *next; struct command_line **blist; int i; @@ -1040,7 +1040,7 @@ copy_command_lines (struct command_line *cmds) static void validate_comname (char *comname) { - register char *p; + char *p; if (comname == 0) error_no_arg ("name of command to define"); @@ -1070,8 +1070,8 @@ define_command (char *comname, int from_tty) CMD_PRE_HOOK, CMD_POST_HOOK }; - register struct command_line *cmds; - register struct cmd_list_element *c, *newc, *oldc, *hookc = 0; + struct command_line *cmds; + struct cmd_list_element *c, *newc, *oldc, *hookc = 0; char *tem = comname; char *tem2; char tmpbuf[MAX_TMPBUF]; @@ -1176,7 +1176,7 @@ void document_command (char *comname, int from_tty) { struct command_line *doclines; - register struct cmd_list_element *c; + struct cmd_list_element *c; char *tem = comname; char tmpbuf[128]; @@ -1194,8 +1194,8 @@ document_command (char *comname, int from_tty) xfree (c->doc); { - register struct command_line *cl1; - register int len = 0; + struct command_line *cl1; + int len = 0; for (cl1 = doclines; cl1; cl1 = cl1->next) len += strlen (cl1->line) + 1; @@ -1233,7 +1233,6 @@ source_cleanup_lines (void *args) error_pre_print = p->old_error_pre_print; } -/* ARGSUSED */ static void do_fclose_cleanup (void *stream) { @@ -1290,7 +1289,7 @@ script_from_file (FILE *stream, char *file) void show_user_1 (struct cmd_list_element *c, struct ui_file *stream) { - register struct command_line *cmdlines; + struct command_line *cmdlines; cmdlines = c->user_commands; if (!cmdlines) diff --git a/gdb/coffread.c b/gdb/coffread.c index 50c5e02..0a983f0 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -477,9 +477,8 @@ coff_symfile_init (struct objfile *objfile) of the line table (minimum and maximum file offset) so that the mainline code can read the whole thing for efficiency. */ -/* ARGSUSED */ static void -find_linenos (bfd *abfd, sec_ptr asect, void *vpinfo) +find_linenos (bfd *abfd, struct bfd_section *asect, void *vpinfo) { struct coff_symfile_info *info; int size, count; @@ -514,7 +513,6 @@ static bfd *symfile_bfd; /* Read a symbol file, after initialization by coff_symfile_init. */ -/* ARGSUSED */ static void coff_symfile_read (struct objfile *objfile, int mainline) { @@ -937,15 +935,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, if (cs->c_name[0] != '@' /* Skip tdesc symbols */ ) { struct minimal_symbol *msym; - - /* FIXME: cagney/2001-02-01: The nasty (int) -> (long) - -> (void*) cast is to ensure that that the value of - cs->c_sclass can be correctly stored in a void - pointer in MSYMBOL_INFO. Better solutions - welcome. */ - gdb_assert (sizeof (void *) >= sizeof (cs->c_sclass)); msym = prim_record_minimal_symbol_and_info - (cs->c_name, tmpaddr, ms_type, (void *) (long) cs->c_sclass, + (cs->c_name, tmpaddr, ms_type, NULL, sec, NULL, objfile); if (msym) COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym); @@ -1448,7 +1439,7 @@ patch_opaque_types (struct symtab *s) for (sym = opaque_type_chain[hash]; sym;) { if (name[0] == DEPRECATED_SYMBOL_NAME (sym)[0] && - STREQ (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1)) + strcmp (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1) == 0) { if (prev) { @@ -1652,11 +1643,6 @@ process_coff_symbol (struct coff_symbol *cs, TYPE_NAME (SYMBOL_TYPE (sym)) = concat (DEPRECATED_SYMBOL_NAME (sym), NULL); } -#ifdef CXUX_TARGET - /* Ignore vendor section for Harris CX/UX targets. */ - else if (cs->c_name[0] == '$') - break; -#endif /* CXUX_TARGET */ /* Keep track of any type which points to empty structured type, so it can be filled from a definition from another file. A @@ -1809,15 +1795,6 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, /* shows up with "void (*foo)();" structure members */ return lookup_fundamental_type (current_objfile, FT_VOID); -#if 0 -/* DGUX actually defines both T_ARG and T_VOID to the same value. */ -#ifdef T_ARG - case T_ARG: - /* Shows up in DGUX, I think. Not sure where. */ - return lookup_fundamental_type (current_objfile, FT_VOID); /* shouldn't show up here */ -#endif -#endif /* 0 */ - #ifdef T_VOID case T_VOID: /* Intel 960 COFF has this symbol and meaning. */ @@ -2045,7 +2022,6 @@ coff_read_struct_type (int index, int length, int lastsym) and create and return a suitable type object. Also defines the symbols that represent the values of the type. */ -/* ARGSUSED */ static struct type * coff_read_enum_type (int index, int length, int lastsym) { diff --git a/gdb/command.h b/gdb/command.h index 9cadd63..c4a5f20 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -157,7 +157,7 @@ extern void execute_cmd_post_hook (struct cmd_list_element *cmd); the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command callbacks. - Unfortunatly, for ``show'' commands cloned from ``set'', this + Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ diff --git a/gdb/complaints.c b/gdb/complaints.c index 252e654..ed24f43 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -210,7 +210,7 @@ vcomplaint (struct complaints **c, const char *file, int line, const char *fmt, trailing newline, the wrap_here() is just a hint. */ if (series == ISOLATED_MESSAGE) /* It would be really nice to use begin_line() here. - Unfortunatly that function doesn't track GDB_STDERR and + Unfortunately that function doesn't track GDB_STDERR and consequently will sometimes supress a line when it shouldn't. */ fputs_filtered ("\n", gdb_stderr); @@ -292,7 +292,7 @@ clear_complaints (struct complaints **c, int less_verbose, int noisy) break; case SUBSEQUENT_MESSAGE: /* It would be really nice to use begin_line() here. - Unfortunatly that function doesn't track GDB_STDERR and + Unfortunately that function doesn't track GDB_STDERR and consequently will sometimes supress a line when it shouldn't. */ fputs_unfiltered ("\n", gdb_stderr); break; diff --git a/gdb/completer.c b/gdb/completer.c index 4274241..1ab71be 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -23,6 +23,7 @@ #include "gdbtypes.h" #include "expression.h" #include "filenames.h" /* for DOSish file names */ +#include "language.h" #include "cli/cli-decode.h" @@ -51,13 +52,11 @@ char *line_completion_function (const char *text, int matches, char *line_buffer it does affect how much stuff M-? lists. (2) If one of the matches contains a word break character, readline will quote it. That's why we switch between - gdb_completer_word_break_characters and + current_language->la_word_break_characters() and gdb_completer_command_word_break_characters. I'm not sure when we need this behavior (perhaps for funky characters in C++ symbols?). */ /* Variables which are necessary for fancy command line editing. */ -static char *gdb_completer_word_break_characters = -" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-"; /* When completing on command names, we remove '-' from the list of word break characters, since we use it in command names. If the @@ -91,12 +90,6 @@ static char *gdb_completer_quote_characters = "'"; /* Accessor for some completer data that may interest other files. */ char * -get_gdb_completer_word_break_characters (void) -{ - return gdb_completer_word_break_characters; -} - -char * get_gdb_completer_quote_characters (void) { return gdb_completer_quote_characters; @@ -251,7 +244,7 @@ location_completer (char *text, char *word) colon = p; symbol_start = p + 1; } - else if (strchr (gdb_completer_word_break_characters, *p)) + else if (strchr (current_language->la_word_break_characters(), *p)) symbol_start = p + 1; } @@ -399,7 +392,7 @@ complete_line (const char *text, char *line_buffer, int point) '-' character used in some commands. */ rl_completer_word_break_characters = - gdb_completer_word_break_characters; + current_language->la_word_break_characters(); /* Decide whether to complete on a list of gdb commands or on symbols. */ tmp_command = (char *) alloca (point + 1); @@ -674,7 +667,7 @@ line_completion_function (const char *text, int matches, char *line_buffer, int /* Make sure the word break characters are set back to normal for the next time that readline tries to complete something. */ rl_completer_word_break_characters = - gdb_completer_word_break_characters; + current_language->la_word_break_characters(); #endif return (output); @@ -696,7 +689,7 @@ skip_quoted_chars (char *str, char *quotechars, char *breakchars) quotechars = gdb_completer_quote_characters; if (breakchars == NULL) - breakchars = gdb_completer_word_break_characters; + breakchars = current_language->la_word_break_characters(); for (scan = str; *scan != '\0'; scan++) { diff --git a/gdb/completer.h b/gdb/completer.h index 7a96951..0a8e9fa 100644 --- a/gdb/completer.h +++ b/gdb/completer.h @@ -31,8 +31,6 @@ extern char **location_completer (char *, char *); extern char **command_completer (char *, char *); -extern char *get_gdb_completer_word_break_characters (void); - extern char *get_gdb_completer_quote_characters (void); /* Exported to linespec.c */ diff --git a/gdb/config/arm/linux.mt b/gdb/config/arm/linux.mt index c17b2e5..cd6f010 100644 --- a/gdb/config/arm/linux.mt +++ b/gdb/config/arm/linux.mt @@ -1,3 +1,3 @@ # Target: ARM based machine running GNU/Linux TM_FILE= tm-linux.h -TDEPFILES= arm-tdep.o arm-linux-tdep.o solib.o solib-svr4.o solib-legacy.o +TDEPFILES= arm-tdep.o arm-linux-tdep.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o diff --git a/gdb/config/d10v/d10v.mt b/gdb/config/d10v/d10v.mt index 72680e2..805ce76 100644 --- a/gdb/config/d10v/d10v.mt +++ b/gdb/config/d10v/d10v.mt @@ -1,4 +1,4 @@ -# Target: Mitsubishi D10V processor +# Target: Renesas D10V processor TDEPFILES= d10v-tdep.o SIM_OBS= remote-sim.o SIM= ../sim/d10v/libsim.a diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 9c2fac7..2bcb5f9 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -16,22 +16,14 @@ @V@/bfd/elf32-frv.c @V@/bfd/elf32fv.c @V@/bfd/elf32-i370.c @V@/bfd/e32i370.c @V@/bfd/elf32-i386.c @V@/bfd/e32i86.c -@V@/bfd/elf32-i386qnx.c @V@/bfd/e32i86q.c @V@/bfd/elf32-m68hc11.c @V@/bfd/em68hc11.c @V@/bfd/elf32-m68hc12.c @V@/bfd/em68hc12.c @V@/bfd/elf32-m68k.c @V@/bfd/em68k.c @V@/bfd/elf32-ppc.c @V@/bfd/e32ppc.c -@V@/bfd/elf32-ppcqnx.c @V@/bfd/e32ppcq.c @V@/bfd/elf32-sh.c @V@/bfd/e32sh.c -@V@/bfd/elf32-shqnx.c @V@/bfd/e32shq.c -@V@/bfd/elf32-sh-lin.c @V@/bfd/e32shlin.c -@V@/bfd/elf32-sh-nbsd.c @V@/bfd/e32shn.c @V@/bfd/elf32-sh64.c @V@/bfd/e32sh64.c -@V@/bfd/elf32-sh64-nbsd.c @V@/bfd/e32sh64n.c @V@/bfd/elf64-alpha.c @V@/bfd/e64alphf.c -@V@/bfd/elf64-alpha-fbsd.c @V@/bfd/e64alph.c @V@/bfd/elf64-sh64.c @V@/bfd/e64sh64.c -@V@/bfd/elf64-sh64-nbsd.c @V@/bfd/e64sh64n.c @V@/bfd/po/.cvsignore @V@/bfd/po/_cvsignore @V@/dejagnu/baseboards/mn10200-cygmon.exp @V@/dejagnu/baseboards/mn10200cygmon.exp @V@/dejagnu/baseboards/mn10200-sim.exp @V@/dejagnu/baseboards/mn10200sim.exp @@ -70,11 +62,12 @@ @V@/gdb/ChangeLog-2002 @V@/gdb/ChangeLog.002 @V@/gdb/ChangeLog-3.x @V@/gdb/ChangeLog.3-x @V@/gdb/ada-exp.tab.c @V@/gdb/ada-exp_tab.c -@V@/gdb/amd64fbsd-tdep.c @V@/gdb/a64fb-tdep.c @V@/gdb/amd64fbsd-nat.c @V@/gdb/a64fb-nat.c +@V@/gdb/amd64fbsd-tdep.c @V@/gdb/a64fb-tdep.c +@V@/gdb/amd64nbsd-nat.c @V@/gdb/a64nb-nat.c +@V@/gdb/amd64nbsd-tdep.c @V@/gdb/a64nb-tdep.c @V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c @V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c -@V@/gdb/alphanbsd-nat.c @V@/gdb/alphnb-nat.c @V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c @V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c @V@/gdb/arm-linux-tdep.c @V@/gdb/armlin-tdep.c @@ -91,34 +84,16 @@ @V@/gdb/config/i386/nm-i386sol2.h @V@/gdb/config/i386/nm-sol2.h @V@/gdb/config/i386/nm-i386v4.h @V@/gdb/config/i386/nm-v4.h @V@/gdb/config/i386/nm-i386v42mp.h @V@/gdb/config/i386/nm-v42mp.h -@V@/gdb/config/i386/tm-i386mk.h @V@/gdb/config/i386/tm-mk.h @V@/gdb/config/i386/tm-i386sol2.h @V@/gdb/config/i386/tm-sol2.h -@V@/gdb/config/i386/tm-i386v42mp.h @V@/gdb/config/i386/tm-v42mp.h -@V@/gdb/config/i386/xm-i386mach.h @V@/gdb/config/i386/xm-mach.h -@V@/gdb/config/i386/xm-i386mk.h @V@/gdb/config/i386/xm-mk.h -@V@/gdb/config/i386/xm-i386v32.h @V@/gdb/config/i386/xm-v32.h @V@/gdb/config/i386/xm-i386v4.h @V@/gdb/config/i386/xm-v4.h -@V@/gdb/config/m68k/apollo68v.mh @V@/gdb/config/m68k/apollo-v.mh -@V@/gdb/config/m68k/nm-apollo68v.h @V@/gdb/config/m68k/nm-apolv.h -@V@/gdb/config/m68k/xm-apollo68v.h @V@/gdb/config/m68k/xm-apolv.h -@V@/gdb/config/m88k/tm-delta88v4.h @V@/gdb/config/m88k/tm-d88v4.h @V@/gdb/config/m88k/xm-delta88v4.h @V@/gdb/config/m88k/xm-d88v4.h -@V@/gdb/config/mips/tm-bigmips64.h @V@/gdb/config/mips/tm-bigm64.h -@V@/gdb/config/mips/tm-embed64.h @V@/gdb/config/mips/tm-emb64.h -@V@/gdb/config/mips/tm-embedl.h @V@/gdb/config/mips/tm-embdl.h -@V@/gdb/config/mips/tm-embedl64.h @V@/gdb/config/mips/tm-embl64.h @V@/gdb/config/mips/tm-linux.h @V@/gdb/config/mips/tm-lx.h @V@/gdb/config/mips/tm-linux64.h @V@/gdb/config/mips/tm-lx64.h -@V@/gdb/config/mips/tm-vr4300el.h @V@/gdb/config/mips/tm-v43el.h -@V@/gdb/config/mips/tm-vr4xxxel.h @V@/gdb/config/mips/tm-v4xel.h -@V@/gdb/config/mips/tm-vr5000el.h @V@/gdb/config/mips/tm-vr5kel.h @V@/gdb/config/pa/nm-hppah11.h @V@/gdb/config/pa/nm-hppa11.h @V@/gdb/config/powerpc/tm-ppcle-sim.h @V@/gdb/config/powerpc/tm-ppcl-sim.h @V@/gdb/config/rs6000/nm-rs6000ly.h @V@/gdb/config/rs6000/nm-rs6kly.h @V@/gdb/config/rs6000/tm-rs6000.h @V@/gdb/config/rs6000/tm-rs6k.h @V@/gdb/config/rs6000/tm-rs6000ly.h @V@/gdb/config/rs6000/tm-rs6kly.h -@V@/gdb/config/sparc/tm-sparclet.h @V@/gdb/config/sparc/tm-splet.h -@V@/gdb/config/sparc/tm-sparclite.h @V@/gdb/config/sparc/tm-splite.h @V@/gdb/config/sparc/tm-sparclynx.h @V@/gdb/config/sparc/tm-splynx.h @V@/gdb/config/vax/xm-vaxult2.h @V@/gdb/config/vax/xm-vaxut2.h @V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c @@ -126,18 +101,18 @@ @V@/gdb/gdbtk/generic/ChangeLog-1998 @V@/gdb/gdbtk/generic/ChangeLog.98 @V@/gdb/gdbtk/generic/ChangeLog-1999 @V@/gdb/gdbtk/generic/ChangeLog.99 @V@/gdb/gdbtk/generic/ChangeLog-2000 @V@/gdb/gdbtk/generic/ChangeLog.000 -@V@/gdb/gdbtk/generic/ChangeLog-2001 @V@/gdb/gdbtk/generic/ChangeLog.001 @V@/gdb/gdbtk/generic/gdbtk-varobj.c @V@/gdb/gdbtk/generic/gdbtk-vobj.c @V@/gdb/gdbtk/library/ChangeLog-1997 @V@/gdb/gdbtk/library/ChangeLog.97 @V@/gdb/gdbtk/library/ChangeLog-1998 @V@/gdb/gdbtk/library/ChangeLog.98 @V@/gdb/gdbtk/library/ChangeLog-1999 @V@/gdb/gdbtk/library/ChangeLog.99 @V@/gdb/gdbtk/library/ChangeLog-2000 @V@/gdb/gdbtk/library/ChangeLog.000 -@V@/gdb/gdbtk/library/ChangeLog-2001 @V@/gdb/gdbtk/library/ChangeLog.001 @V@/gdb/i386-interix-nat.c @V@/gdb/i386ix-nat.c @V@/gdb/i386-interix-tdep.c @V@/gdb/i386ix-tdep.c @V@/gdb/i386-linux-tdep.c @V@/gdb/i386linux-tdep.c @V@/gdb/i386bsd-nat.c @V@/gdb/i3bsd-nat.c @V@/gdb/i386bsd-tdep.c @V@/gdb/i3bsd-tdep.c +@V@/gdb/i386fbsd-nat.c @V@/gdb/i3fbsd-nat.c +@V@/gdb/i386fbsd-tdep.c @V@/gdb/i3fbsd-tdep.c @V@/gdb/i386gnu-nat.c @V@/gdb/i3gnu-nat.c @V@/gdb/i386gnu-tdep.c @V@/gdb/i3gnu-tdep.c @V@/gdb/i386nbsd-nat.c @V@/gdb/i3nbsd-nat.c @@ -166,27 +141,20 @@ @V@/gdb/ppcnbsd-tdep.c @V@/gdb/ppcnb-tdep.c @V@/gdb/regformats/reg-i386-linux.dat @V@/gdb/regformats/r-i386-lnx.dat @V@/gdb/regformats/reg-s390x.dat @V@/gdb/regformats/r-s390x.dat -@V@/gdb/remote-adapt.c @V@/gdb/rmt-adapt.c @V@/gdb/remote-e7000.c @V@/gdb/rmt-e7000.c -@V@/gdb/remote-eb.c @V@/gdb/rmt-eb.c @V@/gdb/remote-est.c @V@/gdb/rmt-est.c @V@/gdb/remote-mips.c @V@/gdb/emt-mips.c -@V@/gdb/remote-mm.c @V@/gdb/emt-mm.c -@V@/gdb/remote-nrom.c @V@/gdb/rmt-nrom.c @V@/gdb/remote-rdi.c @V@/gdb/rmt-rdi.c @V@/gdb/remote-rdp.c @V@/gdb/rmt-rdp.c @V@/gdb/remote-sds.c @V@/gdb/rmt-sds.c @V@/gdb/remote-sim.c @V@/gdb/rmt-sim.c @V@/gdb/remote-st.c @V@/gdb/rmt-st.c -@V@/gdb/remote-udi.c @V@/gdb/rmt-udi.c @V@/gdb/remote-vx.c @V@/gdb/rmt-vx.c -@V@/gdb/remote-vx29k.c @V@/gdb/rmt-vx29k.c @V@/gdb/remote-vx68.c @V@/gdb/rmt-vx68.c -@V@/gdb/remote-vx960.c @V@/gdb/rmt-vx960.c @V@/gdb/remote-vxmips.c @V@/gdb/rmt-vxmips.c @V@/gdb/remote-vxsparc.c @V@/gdb/rmt-vxsparc.c -@V@/gdb/sparclet-rom.c @V@/gdb/splet-rom.c -@V@/gdb/sparclet-stub.c @V@/gdb/splet-stub.c +@V@/gdb/sparc64fbsd-nat.c @V@/gdb/sp64fb-nat.c +@V@/gdb/sparc64fbsd-tdep.c @V@/gdb/sp64fb-tdep.c @V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c @V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c @V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini @@ -198,10 +166,6 @@ @V@/gdb/testsuite/gdb.cp/m-static1.cc @V@/gdb/testsuite/gdb.cp/m-stat1.cc @V@/gdb/testsuite/gdb.cp/namespace1.cc @V@/gdb/testsuite/gdb.cp/namesp1.cc @V@/gdb/testsuite/gdb.mi/mi-var-cmd.exp @V@/gdb/testsuite/gdb.mi/mi-varcmd.exp -@V@/gdb/testsuite/gdb.mi/mi0-var-block.exp @V@/gdb/testsuite/gdb.mi/mi0varblock.exp -@V@/gdb/testsuite/gdb.mi/mi0-var-child.exp @V@/gdb/testsuite/gdb.mi/mi0varchild.exp -@V@/gdb/testsuite/gdb.mi/mi0-var-cmd.exp @V@/gdb/testsuite/gdb.mi/mi0varcmd.exp -@V@/gdb/testsuite/gdb.mi/mi0-var-display.exp @V@/gdb/testsuite/gdb.mi/mi0vardisplay.exp @V@/gdb/testsuite/gdb.mi/mi1-var-block.exp @V@/gdb/testsuite/gdb.mi/mi1varblock.exp @V@/gdb/testsuite/gdb.mi/mi1-var-child.exp @V@/gdb/testsuite/gdb.mi/mi1varchild.exp @V@/gdb/testsuite/gdb.mi/mi1-var-cmd.exp @V@/gdb/testsuite/gdb.mi/mi1varcmd.exp @@ -223,96 +187,6 @@ @V@/itcl/itk/itkConfig.sh.in @V@/itcl/itk/itkConfig.sh-in @V@/itcl/itk/unix/pkgIndex.tcl.in @V@/itcl/itk/unix/pkgIndex.t-in @V@/itcl/iwidgets3.0.0 @V@/itcl/iwidgets3.0-0 -@V@/itcl/iwidgets3.0.0/demos/extfileselectionbox @V@/itcl/iwidgets3.0-0/demos/efselbox -@V@/itcl/iwidgets3.0.0/demos/extfileselectiondialog @V@/itcl/iwidgets3.0-0/demos/efseldialog -@V@/itcl/iwidgets3.0.0/demos/fileselectionbox @V@/itcl/iwidgets3.0-0/demos/fselectbox -@V@/itcl/iwidgets3.0.0/demos/fileselectiondialog @V@/itcl/iwidgets3.0-0/demos/fselectdialog -@V@/itcl/iwidgets3.0.0/demos/html/buttonbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/buttonbox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/canvasprintbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/cprintbox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/canvasprintdialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/cprintdialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/combobox.n.html @V@/itcl/iwidgets3.0-0/demos/html/combobox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/dialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/dialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/dialogshell.n.html @V@/itcl/iwidgets3.0-0/demos/html/dialogshell.n-html -@V@/itcl/iwidgets3.0.0/demos/html/entryfield.n.html @V@/itcl/iwidgets3.0-0/demos/html/entryfield.n-html -@V@/itcl/iwidgets3.0.0/demos/html/feedback.n.html @V@/itcl/iwidgets3.0-0/demos/html/feedback.n-html -@V@/itcl/iwidgets3.0.0/demos/html/fileselectionbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/fselectbox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/fileselectiondialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/fselectdialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/hyperhelp.n.html @V@/itcl/iwidgets3.0-0/demos/html/hyperhelp.n-html -@V@/itcl/iwidgets3.0.0/demos/html/iwidgets2.2.0UserCmds.html @V@/itcl/iwidgets3.0-0/demos/html/iw220UserCmds.html -@V@/itcl/iwidgets3.0.0/demos/html/labeledwidget.n.html @V@/itcl/iwidgets3.0-0/demos/html/labeledwidget.n-html -@V@/itcl/iwidgets3.0.0/demos/html/menubar.n.html @V@/itcl/iwidgets3.0-0/demos/html/menubar.n-html -@V@/itcl/iwidgets3.0.0/demos/html/messagedialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/messagedialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/notebook.n.html @V@/itcl/iwidgets3.0-0/demos/html/notebook.n-html -@V@/itcl/iwidgets3.0.0/demos/html/optionmenu.n.html @V@/itcl/iwidgets3.0-0/demos/html/optionmenu.n-html -@V@/itcl/iwidgets3.0.0/demos/html/panedwindow.n.html @V@/itcl/iwidgets3.0-0/demos/html/panedwindow.n-html -@V@/itcl/iwidgets3.0.0/demos/html/promptdialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/promptdialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/pushbutton.n.html @V@/itcl/iwidgets3.0-0/demos/html/pushbutton.n-html -@V@/itcl/iwidgets3.0.0/demos/html/radiobox.n.html @V@/itcl/iwidgets3.0-0/demos/html/radiobox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/scrolledcanvas.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolcanvas.n-html -@V@/itcl/iwidgets3.0.0/demos/html/scrolledframe.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolframe.n-html -@V@/itcl/iwidgets3.0.0/demos/html/scrolledhtml.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolhtml.n-html -@V@/itcl/iwidgets3.0.0/demos/html/scrolledlistbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrollistbox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/scrolledtext.n.html @V@/itcl/iwidgets3.0-0/demos/html/scroltext.n-html -@V@/itcl/iwidgets3.0.0/demos/html/selectionbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/selectbox.n-html -@V@/itcl/iwidgets3.0.0/demos/html/selectiondialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/selectdialog.n-html -@V@/itcl/iwidgets3.0.0/demos/html/shell.n.html @V@/itcl/iwidgets3.0-0/demos/html/shell.n-html -@V@/itcl/iwidgets3.0.0/demos/html/spindate.n.html @V@/itcl/iwidgets3.0-0/demos/html/spindate.n-html -@V@/itcl/iwidgets3.0.0/demos/html/spinint.n.html @V@/itcl/iwidgets3.0-0/demos/html/spinint.n-html -@V@/itcl/iwidgets3.0.0/demos/html/spinner.n.html @V@/itcl/iwidgets3.0-0/demos/html/spinner.n-html -@V@/itcl/iwidgets3.0.0/demos/html/spintime.n.html @V@/itcl/iwidgets3.0-0/demos/html/spintime.n-html -@V@/itcl/iwidgets3.0.0/demos/html/tabnotebook.n.html @V@/itcl/iwidgets3.0-0/demos/html/tabnotebook.n-html -@V@/itcl/iwidgets3.0.0/demos/html/tabset.n.html @V@/itcl/iwidgets3.0-0/demos/html/tabset.n-html -@V@/itcl/iwidgets3.0.0/demos/html/toolbar.n.html @V@/itcl/iwidgets3.0-0/demos/html/toolbar.n-html -@V@/itcl/iwidgets3.0.0/demos/scrolledcanvas @V@/itcl/iwidgets3.0-0/demos/scrolcanvas -@V@/itcl/iwidgets3.0.0/demos/scrolledframe @V@/itcl/iwidgets3.0-0/demos/scrolframe -@V@/itcl/iwidgets3.0.0/demos/scrolledhtml @V@/itcl/iwidgets3.0-0/demos/scrolhtml -@V@/itcl/iwidgets3.0.0/demos/scrolledlistbox @V@/itcl/iwidgets3.0-0/demos/scroldlistbox -@V@/itcl/iwidgets3.0.0/demos/scrolledtext @V@/itcl/iwidgets3.0-0/demos/scroltext -@V@/itcl/iwidgets3.0.0/demos/selectionbox @V@/itcl/iwidgets3.0-0/demos/selectbox -@V@/itcl/iwidgets3.0.0/demos/selectiondialog @V@/itcl/iwidgets3.0-0/demos/selectdialog -@V@/itcl/iwidgets3.0.0/doc/canvasprintbox.n @V@/itcl/iwidgets3.0-0/doc/cprintbox.n -@V@/itcl/iwidgets3.0.0/doc/canvasprintdialog.n @V@/itcl/iwidgets3.0-0/doc/cprintdialog.n -@V@/itcl/iwidgets3.0.0/doc/extfileselectionbox.n @V@/itcl/iwidgets3.0-0/doc/efselbox.n -@V@/itcl/iwidgets3.0.0/doc/extfileselectiondialog.n @V@/itcl/iwidgets3.0-0/doc/efseldialog.n -@V@/itcl/iwidgets3.0.0/doc/fileselectionbox.n @V@/itcl/iwidgets3.0-0/doc/fselectbox.n -@V@/itcl/iwidgets3.0.0/doc/fileselectiondialog.n @V@/itcl/iwidgets3.0-0/doc/fselectdialog.n -@V@/itcl/iwidgets3.0.0/doc/scopedobject.n.backup @V@/itcl/iwidgets3.0-0/doc/scopedobject.n-backup -@V@/itcl/iwidgets3.0.0/doc/scrolledcanvas.n @V@/itcl/iwidgets3.0-0/doc/scrolcanvas.n -@V@/itcl/iwidgets3.0.0/doc/scrolledframe.n @V@/itcl/iwidgets3.0-0/doc/scrolframe.n -@V@/itcl/iwidgets3.0.0/doc/scrolledhtml.n @V@/itcl/iwidgets3.0-0/doc/scrolhtml.n -@V@/itcl/iwidgets3.0.0/doc/scrolledlistbox.n @V@/itcl/iwidgets3.0-0/doc/scrollistbox.n -@V@/itcl/iwidgets3.0.0/doc/scrolledtext.n @V@/itcl/iwidgets3.0-0/doc/scroltext.n -@V@/itcl/iwidgets3.0.0/doc/selectionbox.n @V@/itcl/iwidgets3.0-0/doc/selectbox.n -@V@/itcl/iwidgets3.0.0/doc/selectiondialog.n @V@/itcl/iwidgets3.0-0/doc/selectdialog.n -@V@/itcl/iwidgets3.0.0/generic/canvasprintbox.itk @V@/itcl/iwidgets3.0-0/generic/cprintbox.itk -@V@/itcl/iwidgets3.0.0/generic/canvasprintdialog.itk @V@/itcl/iwidgets3.0-0/generic/cprintdialog.itk -@V@/itcl/iwidgets3.0.0/generic/extfileselectionbox.itk @V@/itcl/iwidgets3.0-0/generic/efselbox.itk -@V@/itcl/iwidgets3.0.0/generic/extfileselectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/efseldialog.itk -@V@/itcl/iwidgets3.0.0/generic/fileselectionbox.itk @V@/itcl/iwidgets3.0-0/generic/fselectbox.itk -@V@/itcl/iwidgets3.0.0/generic/fileselectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/fselectdialog.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledcanvas.itk @V@/itcl/iwidgets3.0-0/generic/scrolcanvas.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledframe.itk @V@/itcl/iwidgets3.0-0/generic/scrolframe.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledhtml.itk @V@/itcl/iwidgets3.0-0/generic/scrolhtml.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledlistbox.itk @V@/itcl/iwidgets3.0-0/generic/scrollistbox.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledtext.itk @V@/itcl/iwidgets3.0-0/generic/scroltext.itk -@V@/itcl/iwidgets3.0.0/generic/scrolledwidget.itk @V@/itcl/iwidgets3.0-0/generic/scrolwidget.itk -@V@/itcl/iwidgets3.0.0/generic/selectionbox.itk @V@/itcl/iwidgets3.0-0/generic/selectbox.itk -@V@/itcl/iwidgets3.0.0/generic/selectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/selectdialog.itk -@V@/itcl/iwidgets3.0.0/tests/canvasprintbox.test @V@/itcl/iwidgets3.0-0/tests/cprintbox.test -@V@/itcl/iwidgets3.0.0/tests/canvasprintdialog.test @V@/itcl/iwidgets3.0-0/tests/cprintdialog.test -@V@/itcl/iwidgets3.0.0/tests/extfileselectionbox.test @V@/itcl/iwidgets3.0-0/tests/efselbox.test -@V@/itcl/iwidgets3.0.0/tests/extfileselectiondialog.test @V@/itcl/iwidgets3.0-0/tests/efseldialog.test -@V@/itcl/iwidgets3.0.0/tests/fileselectionbox.test @V@/itcl/iwidgets3.0-0/tests/fselectbox.test -@V@/itcl/iwidgets3.0.0/tests/fileselectiondialog.test @V@/itcl/iwidgets3.0-0/tests/fselectdialog.test -@V@/itcl/iwidgets3.0.0/tests/scrolledcanvas.test @V@/itcl/iwidgets3.0-0/tests/scrolcanvas.test -@V@/itcl/iwidgets3.0.0/tests/scrolledframe.test @V@/itcl/iwidgets3.0-0/tests/scrolframe.test -@V@/itcl/iwidgets3.0.0/tests/scrolledhtml.test @V@/itcl/iwidgets3.0-0/tests/scrolhtml.test -@V@/itcl/iwidgets3.0.0/tests/scrolledlistbox.test @V@/itcl/iwidgets3.0-0/tests/scrollistbox.test -@V@/itcl/iwidgets3.0.0/tests/scrolledtext.test @V@/itcl/iwidgets3.0-0/tests/scroltext.test -@V@/itcl/iwidgets3.0.0/tests/selectionbox.test @V@/itcl/iwidgets3.0-0/tests/selectbox.test -@V@/itcl/iwidgets3.0.0/tests/selectiondialog.test @V@/itcl/iwidgets3.0-0/tests/selectdialog.test -@V@/itcl/iwidgets3.0.0/unix/iwidgets.tcl.in @V@/itcl/iwidgets3.0-0/unix/iwidgets.t-in -@V@/itcl/iwidgets3.0.0/unix/pkgIndex.tcl.in @V@/itcl/iwidgets3.0-0/unix/pkgIndex.t-in @V@/libgui/config.h.in @V@/libgui/config.h-in @V@/libgui/src/tkTableCell.c @V@/libgui/src/tkTabCell.c @V@/libgui/src/tkTableCmd.c @V@/libgui/src/tkTabCmd.c @@ -390,6 +264,13 @@ @V@/sim/testsuite/sim/arm/misaligned1.ms @V@/sim/testsuite/sim/arm/mis1.ms @V@/sim/testsuite/sim/arm/misaligned2.ms @V@/sim/testsuite/sim/arm/mis2.ms @V@/sim/testsuite/sim/arm/misaligned3.ms @V@/sim/testsuite/sim/arm/mis3.ms +@V@/sim/testsuite/sim/frv/interrupts/Ipipe-fr400.cgs @V@/sim/testsuite/sim/frv/interrupts/Ip-fr400.cgs +@V@/sim/testsuite/sim/frv/interrupts/Ipipe-fr500.cgs @V@/sim/testsuite/sim/frv/interrupts/Ip-fr500.cgs +@V@/sim/testsuite/sim/frv/interrupts/badalign-fr550.cgs @V@/sim/testsuite/sim/frv/interrupts/fr550-badalign.cgs +@V@/sim/testsuite/sim/frv/interrupts/compound-fr550.cgs @V@/sim/testsuite/sim/frv/interrupts/fr550-compound.cgs +@V@/sim/testsuite/sim/frv/interrupts/data_store_error-fr550.cgs @V@/sim/testsuite/sim/frv/interrupts/fr550-data_store_error.cgs +@V@/sim/testsuite/sim/frv/interrupts/fp_exception-fr550.cgs @V@/sim/testsuite/sim/frv/interrupts/fr550-fp_exception.cgs +@V@/sim/testsuite/sim/frv/interrupts/insn_access_error-fr550.cgs @V@/sim/testsuite/sim/frv/interrupts/fr550-insn_access_error.cgs @V@/tcl/cygwin/tclConfig.sh.in @V@/tcl/cygwin/tclConfig.sh-in @V@/tcl/doc/ExprLongObj.3 @V@/tcl/doc/ExprLObj.3 @V@/tcl/mac/tclMacBOAAppInit.c @V@/tcl/mac/tclBOAAppInit.c @@ -407,29 +288,8 @@ @V@/tcl/unix/tclUnixFile.c @V@/tcl/unix/tclFile.c @V@/tcl/unix/tclUnixTest.c @V@/tcl/unix/tclTest.c @V@/tcl/unix/tclUnixTime.c @V@/tcl/unix/tclTime.c -@V@/tix/docs/Release-4.1.0.html @V@/tix/docs/Rel4_10.html -@V@/tix/docs/Release-4.1.0.txt @V@/tix/docs/Rel4_10.txt -@V@/tix/docs/Release-4.1a2.html @V@/tix/docs/Rel4_1a2.html -@V@/tix/docs/Release-4.1a2.txt @V@/tix/docs/Rel4_1a2.txt -@V@/tix/docs/Release-4.1a3.html @V@/tix/docs/Rel4_1a3.html -@V@/tix/docs/Release-4.1a3.txt @V@/tix/docs/Rel4_1a3.txt -@V@/tix/docs/Release-4.1b1.html @V@/tix/docs/Rel4_1b1.html -@V@/tix/docs/Release-4.1b1.txt @V@/tix/docs/Rel4_1b1.txt -@V@/tix/docs/Release-4.1b2.html @V@/tix/docs/Rel4_1b2.html -@V@/tix/docs/Release-4.1b2.txt @V@/tix/docs/Rel4_1b2.txt -@V@/tix/tixConfig.sh.in @V@/tix/tixConfig.sh-in -@V@/tix/unix/tk4.2/pkgIndex.tcl.in @V@/tix/unix/tk4.2/pkgIndex.t-in -@V@/tix/unix/tk8.0/pkgIndex.tcl.in @V@/tix/unix/tk8.0/pkgIndex.t-in -@V@/tix/unix/tk8.0/pkgIndex.tcl.in @V@/tix/unix/tk8.0/pkgIndex.t-in -@V@/tix/unix/tk8.1/pkgIndex.tcl.in @V@/tix/unix/tk8.1/pkgIndex.t-in -@V@/tix/win/tkConsole41.c @V@/tix/win/tkCon41.c -@V@/tix/win/tkConsole42.c @V@/tix/win/tkCon42.c -@V@/tix/win/tkConsole80a1.c @V@/tix/win/tkCon80a1.c -@V@/tix/win/tkConsole80b1.c @V@/tix/win/tkCon80b1.c -@V@/tix/win/tkConsole81.c @V@/tix/win/tkCon81.c @V@/tk/doc/ConfigWidg.3 @V@/tk/doc/CfgWidg.3 @V@/tk/doc/ConfigWind.3 @V@/tk/doc/CfgWind.3 -@V@/tk/doc/tk4.0.ps @V@/tk/doc/tk4-0.ps @V@/tk/library/images/pwrdLogo100.gif @V@/tk/library/images/pwLogo100.gif @V@/tk/library/images/pwrdLogo150.gif @V@/tk/library/images/pwLogo150.gif @V@/tk/library/images/pwrdLogo175.gif @V@/tk/library/images/pwLogo175.gif @@ -438,7 +298,6 @@ @V@/tk/mac/tkMacMenu.c @V@/tk/mac/tkMenu.c @V@/tk/mac/tkMacMenubutton.c @V@/tk/mac/tkMenubutton.c @V@/tk/mac/tkMacMenus.c @V@/tk/mac/tkMenus.c -@V@/tk/mac/tkMacProjects.sit.hqx @V@/tk/mac/tkMacProjects.shqx @V@/tk/tests/option.file1 @V@/tk/tests/option1.file @V@/tk/tests/option.file2 @V@/tk/tests/option2.file @V@/tk/unix/tkConfig.sh.in @V@/tk/unix/tkConfig.sh-in diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index 5d1aaa7..807d7c0 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -26,6 +26,7 @@ GDB_TARGET_IS_H8300 in remote-e7000.c */ extern int h8300hmode; extern int h8300smode; +extern int h8300_normal_mode; /* 1 - Normal Mode , 0 - Advanced mode */ extern int h8300sxmode; #define GDB_TARGET_IS_H8300 diff --git a/gdb/config/h8500/h8500.mt b/gdb/config/h8500/h8500.mt deleted file mode 100644 index 64608a0..0000000 --- a/gdb/config/h8500/h8500.mt +++ /dev/null @@ -1,6 +0,0 @@ -# OBSOLETE # Target: H8500 with HMS monitor and H8 simulator -# OBSOLETE TDEPFILES= h8500-tdep.o monitor.o remote-hms.o dsrec.o -# OBSOLETE TM_FILE= tm-h8500.h -# OBSOLETE -# OBSOLETE SIM_OBS = remote-sim.o -# OBSOLETE SIM = ../sim/h8500/libsim.a diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h deleted file mode 100644 index 4d0f640..0000000 --- a/gdb/config/h8500/tm-h8500.h +++ /dev/null @@ -1,295 +0,0 @@ -// OBSOLETE /* Parameters for execution on a H8/500 series machine. -// OBSOLETE -// OBSOLETE Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 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 #include "regcache.h" -// OBSOLETE -// OBSOLETE /* NOTE: cagney/2002-11-24: This is a guess. */ -// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0 -// OBSOLETE #define CALL_DUMMY_LOCATION ON_STACK -// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address) -// OBSOLETE -// OBSOLETE /* Contributed by Steve Chamberlain sac@cygnus.com */ -// OBSOLETE -// OBSOLETE #define GDB_TARGET_IS_H8500 -// OBSOLETE -// OBSOLETE /* Define the sizes of integers and pointers. */ -// OBSOLETE -// OBSOLETE #define TARGET_INT_BIT 16 -// OBSOLETE -// OBSOLETE #define TARGET_LONG_BIT 32 -// OBSOLETE -// OBSOLETE #define TARGET_PTR_BIT (minimum_mode ? 16 : 32) -// OBSOLETE -// OBSOLETE /* Offset from address of function to start of its code. -// OBSOLETE Zero on most machines. */ -// OBSOLETE -// OBSOLETE #define FUNCTION_START_OFFSET 0 -// OBSOLETE -// OBSOLETE /* Advance PC across any function entry prologue instructions -// OBSOLETE to reach some "real" code. */ -// OBSOLETE -// OBSOLETE #define SKIP_PROLOGUE(ip) (h8500_skip_prologue (ip)) -// OBSOLETE extern CORE_ADDR h8500_skip_prologue (CORE_ADDR); -// OBSOLETE -// OBSOLETE /* Immediately after a function call, return the saved pc. -// OBSOLETE Can't always go through the frames for this because on some machines -// OBSOLETE the new frame is not set up until the new function executes -// OBSOLETE some instructions. */ -// OBSOLETE -// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call() -// OBSOLETE extern CORE_ADDR saved_pc_after_call (void); -// OBSOLETE -// OBSOLETE /* Stack grows downward. */ -// OBSOLETE -// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) -// OBSOLETE -// OBSOLETE /* Illegal instruction - used by the simulator for breakpoint -// OBSOLETE detection */ -// OBSOLETE -// OBSOLETE #define BREAKPOINT {0x0b} -// OBSOLETE -// OBSOLETE /* If your kernel resets the pc after the trap happens you may need to -// OBSOLETE define this before including this file. */ -// OBSOLETE -// OBSOLETE #define DECR_PC_AFTER_BREAK 0 -// OBSOLETE -// OBSOLETE /* Say how long registers are. */ -// OBSOLETE -// OBSOLETE #define REGISTER_TYPE unsigned long -// OBSOLETE -// OBSOLETE /* Say how much memory is needed to store a copy of the register set */ -// OBSOLETE -// OBSOLETE #define REGISTER_BYTES (NUM_REGS * 4) -// OBSOLETE -// OBSOLETE /* Index within `registers' of the first byte of the space for -// OBSOLETE register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_BYTE(N) ((N)*4) -// OBSOLETE -// OBSOLETE /* Number of bytes of storage in the actual machine representation -// OBSOLETE for register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_RAW_SIZE(N) h8500_register_size(N) -// OBSOLETE extern int h8500_register_size (int regno); -// OBSOLETE -// OBSOLETE #define REGISTER_SIZE 4 -// OBSOLETE -// OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) h8500_register_size(N) -// OBSOLETE -// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */ -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_RAW_SIZE 4 -// OBSOLETE -// OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. */ -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4 -// OBSOLETE -// OBSOLETE /* Return the GDB type object for the "standard" data type -// OBSOLETE of data in register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) h8500_register_virtual_type(N) -// OBSOLETE extern struct type *h8500_register_virtual_type (int regno); -// OBSOLETE -// OBSOLETE /* Initializer for an array of names of registers. -// OBSOLETE Entries beyond the first NUM_REGS are ignored. */ -// OBSOLETE -// OBSOLETE #define REGISTER_NAMES \ -// OBSOLETE { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ -// OBSOLETE "pr0","pr1","pr2","pr3","pr4","pr5","pr6","pr7", \ -// OBSOLETE "cp", "dp", "ep", "tp", "sr", "pc"} -// OBSOLETE -// OBSOLETE /* Register numbers of various important registers. Note that some of -// OBSOLETE these values are "real" register numbers, and correspond to the -// OBSOLETE general registers of the machine, and some are "phony" register -// OBSOLETE numbers which are too large to be actual register numbers as far as -// OBSOLETE the user is concerned but do serve to get the desired values when -// OBSOLETE passed to read_register. */ -// OBSOLETE -// OBSOLETE #define R0_REGNUM 0 -// OBSOLETE #define R1_REGNUM 1 -// OBSOLETE #define R2_REGNUM 2 -// OBSOLETE #define R3_REGNUM 3 -// OBSOLETE #define R4_REGNUM 4 -// OBSOLETE #define R5_REGNUM 5 -// OBSOLETE #define R6_REGNUM 6 -// OBSOLETE #define R7_REGNUM 7 -// OBSOLETE -// OBSOLETE #define PR0_REGNUM 8 -// OBSOLETE #define PR1_REGNUM 9 -// OBSOLETE #define PR2_REGNUM 10 -// OBSOLETE #define PR3_REGNUM 11 -// OBSOLETE #define PR4_REGNUM 12 -// OBSOLETE #define PR5_REGNUM 13 -// OBSOLETE #define PR6_REGNUM 14 -// OBSOLETE #define PR7_REGNUM 15 -// OBSOLETE -// OBSOLETE #define SEG_C_REGNUM 16 /* Segment registers */ -// OBSOLETE #define SEG_D_REGNUM 17 -// OBSOLETE #define SEG_E_REGNUM 18 -// OBSOLETE #define SEG_T_REGNUM 19 -// OBSOLETE -// OBSOLETE #define CCR_REGNUM 20 /* Contains processor status */ -// OBSOLETE #define PC_REGNUM 21 /* Contains program counter */ -// OBSOLETE -// OBSOLETE #define NUM_REGS 22 -// OBSOLETE -// OBSOLETE #define SP_REGNUM PR7_REGNUM /* Contains address of top of stack */ -// OBSOLETE #define FP_REGNUM PR6_REGNUM /* Contains address of executing stack frame */ -// OBSOLETE -// OBSOLETE #define PTR_SIZE (minimum_mode ? 2 : 4) -// OBSOLETE #define PTR_MASK (minimum_mode ? 0x0000ffff : 0x00ffffff) -// 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 -// OBSOLETE /*#define STORE_STRUCT_RETURN(ADDR, SP) \ -// OBSOLETE { write_register (0, (ADDR)); internal_error (__FILE__, __LINE__, "failed internal consistency check"); } */ -// 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 #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ -// OBSOLETE memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE)) -// OBSOLETE -// OBSOLETE /* Write into appropriate registers a function return value -// OBSOLETE of type TYPE, given in virtual format. */ -// OBSOLETE -// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ -// OBSOLETE deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) -// OBSOLETE -// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state -// OBSOLETE the address in which a function should return its structure value, -// OBSOLETE as a CORE_ADDR (or an expression that can be used as one). */ -// OBSOLETE -// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Define other aspects of the stack frame. */ -// OBSOLETE -// OBSOLETE /* A macro that tells us whether the function invocation represented -// OBSOLETE by FI does not have a frame on the stack associated with it. If it -// OBSOLETE does not, FRAMELESS is set to 1, else 0. */ -// OBSOLETE -// OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) \ -// OBSOLETE (frameless_look_for_prologue (FI)) -// OBSOLETE -// OBSOLETE /* Any function with a frame looks like this -// OBSOLETE SECOND ARG -// OBSOLETE FIRST ARG -// OBSOLETE RET PC -// OBSOLETE SAVED R2 -// OBSOLETE SAVED R3 -// OBSOLETE SAVED FP <-FP POINTS HERE -// OBSOLETE LOCALS0 -// OBSOLETE LOCALS1 <-SP POINTS HERE -// OBSOLETE -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) ; -// OBSOLETE /* (fci)->frame |= read_register(SEG_T_REGNUM) << 16; */ -// OBSOLETE -// OBSOLETE #define FRAME_CHAIN(FRAME) h8500_frame_chain(FRAME) -// OBSOLETE struct frame_info; -// OBSOLETE extern CORE_ADDR h8500_frame_chain (struct frame_info *); -// OBSOLETE -// OBSOLETE #define FRAME_SAVED_PC(FRAME) frame_saved_pc(FRAME) -// OBSOLETE extern CORE_ADDR frame_saved_pc (struct frame_info *frame); -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi)) -// OBSOLETE -// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi)) -// OBSOLETE -// OBSOLETE /* Set VAL to the number of args passed to frame described by FI. -// OBSOLETE Can set VAL to -1, meaning no way to tell. */ -// OBSOLETE -// OBSOLETE /* We can't tell how many args there are -// OBSOLETE now that the C compiler delays popping them. */ -// OBSOLETE -// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) -// OBSOLETE -// OBSOLETE /* Return number of bytes at start of arglist that are not really args. */ -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_SKIP 0 -// OBSOLETE -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. */ -// OBSOLETE -// OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ -// OBSOLETE frame_find_saved_regs(frame_info, &(frame_saved_regs)) -// OBSOLETE struct frame_saved_regs; -// OBSOLETE extern void frame_find_saved_regs (struct frame_info *frame_info, -// OBSOLETE struct frame_saved_regs *frame_saved_regs); -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Discard from the stack the innermost frame, restoring all registers. */ -// OBSOLETE -// OBSOLETE #define POP_FRAME { h8500_pop_frame (); } -// OBSOLETE extern void h8500_pop_frame (void); -// OBSOLETE -// OBSOLETE #define SHORT_INT_MAX 32767 -// OBSOLETE #define SHORT_INT_MIN -32768 -// OBSOLETE -// OBSOLETE typedef unsigned short INSN_WORD; -// OBSOLETE -// OBSOLETE extern CORE_ADDR h8500_addr_bits_remove (CORE_ADDR); -// OBSOLETE #define ADDR_BITS_REMOVE(addr) h8500_addr_bits_remove (addr) -// OBSOLETE -// OBSOLETE #define read_memory_short(x) (read_memory_integer(x,2) & 0xffff) -// OBSOLETE -// OBSOLETE extern void h8500_do_registers_info (int regnum, int all); -// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \ -// OBSOLETE h8500_do_registers_info (REGNUM, ALL) -// OBSOLETE -// OBSOLETE extern int minimum_mode; -// OBSOLETE -// OBSOLETE #define CALL_DUMMY_LENGTH 10 -// OBSOLETE -// OBSOLETE /* Fake variables to make it easy to use 24 bit register pointers */ -// OBSOLETE -// OBSOLETE #define IS_TRAPPED_INTERNALVAR h8500_is_trapped_internalvar -// OBSOLETE extern int h8500_is_trapped_internalvar (char *name); -// OBSOLETE -// OBSOLETE #define VALUE_OF_TRAPPED_INTERNALVAR h8500_value_of_trapped_internalvar -// OBSOLETE extern struct value *h8500_value_of_trapped_internalvar ( /* struct internalvar *var */ ); -// OBSOLETE -// OBSOLETE #define SET_TRAPPED_INTERNALVAR h8500_set_trapped_internalvar -// OBSOLETE extern void h8500_set_trapped_internalvar ( /* struct internalvar *var, value newval, int bitpos, int bitsize, int offset */ ); -// OBSOLETE -// OBSOLETE extern CORE_ADDR h8500_read_sp (void); -// OBSOLETE extern void h8500_write_sp (CORE_ADDR); -// OBSOLETE -// OBSOLETE extern CORE_ADDR h8500_read_fp (void); -// OBSOLETE -// OBSOLETE extern CORE_ADDR h8500_read_pc (ptid_t); -// OBSOLETE extern void h8500_write_pc (CORE_ADDR, ptid_t); -// OBSOLETE -// OBSOLETE #define TARGET_READ_SP() h8500_read_sp() -// OBSOLETE #define TARGET_WRITE_SP(x) h8500_write_sp(x) -// OBSOLETE -// OBSOLETE #define TARGET_READ_PC(pid) h8500_read_pc(pid) -// OBSOLETE #define TARGET_WRITE_PC(x,pid) h8500_write_pc(x,pid) -// OBSOLETE -// OBSOLETE #define TARGET_READ_FP() h8500_read_fp() diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh index 08d9e7d..4c70fc6 100644 --- a/gdb/config/i386/fbsd.mh +++ b/gdb/config/i386/fbsd.mh @@ -4,4 +4,4 @@ XM_FILE= xm-i386.h NAT_FILE= nm-fbsd.h # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-aout.o core-regset.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o core-aout.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o gcore.o fbsd-proc.o diff --git a/gdb/config/i386/fbsd.mt b/gdb/config/i386/fbsd.mt index 7a95e00..b266255 100644 --- a/gdb/config/i386/fbsd.mt +++ b/gdb/config/i386/fbsd.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running FreeBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o +TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o corelow.o TM_FILE= tm-fbsd.h diff --git a/gdb/config/i386/fbsd64.mh b/gdb/config/i386/fbsd64.mh index 7e42aaa..eaa801f 100644 --- a/gdb/config/i386/fbsd64.mh +++ b/gdb/config/i386/fbsd64.mh @@ -4,4 +4,4 @@ XM_FILE= xm-i386.h NAT_FILE= nm-fbsd64.h # NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make. -NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o corelow.o core-regset.o amd64-nat.o amd64fbsd-nat.o gcore.o fbsd-proc.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o solib-legacy.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o gcore.o fbsd-proc.o diff --git a/gdb/config/i386/fbsd64.mt b/gdb/config/i386/fbsd64.mt index ae4fe98..3a66a15 100644 --- a/gdb/config/i386/fbsd64.mt +++ b/gdb/config/i386/fbsd64.mt @@ -1,2 +1,2 @@ # Target: FreeBSD/amd64 -TDEPFILES= x86-64-tdep.o amd64fbsd-tdep.o i386-tdep.o i387-tdep.o i386bsd-tdep.o +TDEPFILES= x86-64-tdep.o amd64fbsd-tdep.o i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o corelow.o diff --git a/gdb/config/i386/linux.mt b/gdb/config/i386/linux.mt index 2d27a02..9e068a4 100644 --- a/gdb/config/i386/linux.mt +++ b/gdb/config/i386/linux.mt @@ -1,4 +1,4 @@ # Target: Intel 386 running GNU/Linux -TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o \ +TDEPFILES= i386-tdep.o i386-linux-tdep.o glibc-tdep.o i387-tdep.o \ solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h deleted file mode 100644 index 74db165..0000000 --- a/gdb/config/i386/nm-ptx4.h +++ /dev/null @@ -1,66 +0,0 @@ -// 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 deleted file mode 100644 index 72b7d8d..0000000 --- a/gdb/config/i386/nm-symmetry.h +++ /dev/null @@ -1,50 +0,0 @@ -// 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 deleted file mode 100644 index 048f5e5..0000000 --- a/gdb/config/i386/ptx.mh +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index e9551e2..0000000 --- a/gdb/config/i386/ptx.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index 4d23635..0000000 --- a/gdb/config/i386/ptx4.mh +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index ad268f8..0000000 --- a/gdb/config/i386/ptx4.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index 19c5264..0000000 --- a/gdb/config/i386/symmetry.mh +++ /dev/null @@ -1,4 +0,0 @@ -# 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 deleted file mode 100644 index 8fccbd2..0000000 --- a/gdb/config/i386/symmetry.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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-cygwin.h b/gdb/config/i386/tm-cygwin.h index 4b926f9..e7b49de 100644 --- a/gdb/config/i386/tm-cygwin.h +++ b/gdb/config/i386/tm-cygwin.h @@ -35,5 +35,3 @@ char *solib_address (CORE_ADDR); char *child_solib_loaded_library_pathname(int); void child_clear_solibs (void); void dll_symbol_command (char *, int); - -#define LINKER_SYMBOLS_HAVE_WIN32_STDCALL_ARG_SIZES (1) diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h deleted file mode 100644 index 4d3ba83..0000000 --- a/gdb/config/i386/tm-ptx.h +++ /dev/null @@ -1,194 +0,0 @@ -// 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 deleted file mode 100644 index 5f83db4..0000000 --- a/gdb/config/i386/tm-ptx4.h +++ /dev/null @@ -1,26 +0,0 @@ -// 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 deleted file mode 100644 index c8680a3..0000000 --- a/gdb/config/i386/tm-symmetry.h +++ /dev/null @@ -1,291 +0,0 @@ -// 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 deleted file mode 100644 index 1ecae0c..0000000 --- a/gdb/config/i386/xm-ptx.h +++ /dev/null @@ -1,38 +0,0 @@ -// 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 deleted file mode 100644 index 7f0605d..0000000 --- a/gdb/config/i386/xm-ptx4.h +++ /dev/null @@ -1,27 +0,0 @@ -// 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 deleted file mode 100644 index 27711f2..0000000 --- a/gdb/config/i386/xm-symmetry.h +++ /dev/null @@ -1,28 +0,0 @@ -// 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/m32r/m32r.mt b/gdb/config/m32r/m32r.mt index 6d578c8..ff6def0 100644 --- a/gdb/config/m32r/m32r.mt +++ b/gdb/config/m32r/m32r.mt @@ -1,4 +1,4 @@ # Target: Renesas m32r processor -TDEPFILES= m32r-tdep.o monitor.o m32r-rom.o dsrec.o +TDEPFILES= m32r-tdep.o monitor.o m32r-rom.o dsrec.o remote-m32r-sdi.o SIM_OBS = remote-sim.o SIM = ../sim/m32r/libsim.a diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index 97112a8..a360a78 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -68,10 +68,10 @@ struct frame_info; #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ { \ - char raw_buf[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ + char raw_buf[DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)]; \ DEPRECATED_REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (FP0_REGNUM), \ - raw_buf, REGISTER_RAW_SIZE (FP0_REGNUM)); \ + raw_buf, DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); \ } \ else \ deprecated_write_register_bytes ((TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : 0), \ diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h index f721dcf..93fea35 100644 --- a/gdb/config/m68k/tm-sun3.h +++ b/gdb/config/m68k/tm-sun3.h @@ -86,24 +86,4 @@ /* 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. 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. */ - -#undef SIG_PC_FP_OFFSET -#define SIG_PC_FP_OFFSET 324 -#define SIG_SP_FP_OFFSET 332 - #endif /* TM_SUN3_H */ diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h index 271eb7e..6eaf418 100644 --- a/gdb/config/m68k/tm-vx68.h +++ b/gdb/config/m68k/tm-vx68.h @@ -72,11 +72,7 @@ #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) -/* Number of registers in a ptrace_getregs call. */ - -#define VX_NUM_REGS (18) - /* Number of registers in a ptrace_getfpregs call. */ -#define VX_SIZE_FPREGS (8 * REGISTER_RAW_SIZE (FP0_REGNUM) \ +#define VX_SIZE_FPREGS (8 * DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) \ + (3 * DEPRECATED_REGISTER_SIZE)) diff --git a/gdb/config/m88k/xm-delta88v4.h b/gdb/config/m88k/xm-delta88v4.h deleted file mode 100644 index 932b902..0000000 --- a/gdb/config/m88k/xm-delta88v4.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Host machine description for Motorola Delta 88 box, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993 - 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/xm-sysv4.h" diff --git a/gdb/config/mips/irix6.mh b/gdb/config/mips/irix6.mh index 8075f0d..141bff6 100644 --- a/gdb/config/mips/irix6.mh +++ b/gdb/config/mips/irix6.mh @@ -1,6 +1,6 @@ # Host: SGI Iris running irix 6.x -XM_FILE= xm-irix6.h -NAT_FILE= nm-irix6.h +XM_FILE= xm-irix5.h +NAT_FILE= nm-irix5.h NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \ proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh index 38f8725..3fbc3e9 100644 --- a/gdb/config/mips/linux.mh +++ b/gdb/config/mips/linux.mh @@ -1,5 +1,4 @@ # Host: Linux/MIPS -XM_FILE= xm-linux.h NAT_FILE= nm-linux.h NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \ thread-db.o lin-lwp.o proc-service.o linux-proc.o gcore.o \ diff --git a/gdb/config/mips/mipsm3.mh b/gdb/config/mips/mipsm3.mh deleted file mode 100644 index fc9f37c..0000000 --- a/gdb/config/mips/mipsm3.mh +++ /dev/null @@ -1,6 +0,0 @@ -# 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 deleted file mode 100644 index 837b27e..0000000 --- a/gdb/config/mips/mipsm3.mt +++ /dev/null @@ -1,4 +0,0 @@ -# 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/nm-irix6.h b/gdb/config/mips/nm-irix6.h deleted file mode 100644 index 301b629..0000000 --- a/gdb/config/mips/nm-irix6.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definitions for native support of irix6. - - Copyright 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 "mips/nm-irix5.h" diff --git a/gdb/config/mips/nm-linux.h b/gdb/config/mips/nm-linux.h index 426dd55..8fd2193 100644 --- a/gdb/config/mips/nm-linux.h +++ b/gdb/config/mips/nm-linux.h @@ -1,6 +1,6 @@ /* Native-dependent definitions for GNU/Linux on MIPS. - Copyright 1996, 2001, 2002 Free Software Foundation, Inc. + Copyright 1996, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -22,8 +22,6 @@ #ifndef NM_MIPSLINUX_H #define NM_MIPSLINUX_H -#define MIPS_GNULINUX_TARGET - #include "config/nm-linux.h" /* Return sizeof user struct to callers in less machine dependent diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index 51a6a7d..59aeb5d 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -130,10 +130,6 @@ typedef struct mips_extra_func_info } *mips_extra_func_info_t; -extern void mips_print_extra_frame_info (struct frame_info *frame); -#define PRINT_EXTRA_FRAME_INFO(fi) \ - mips_print_extra_frame_info (fi) - /* It takes two values to specify a frame on the MIPS. In fact, the *PC* is the primary value that sets up a frame. The diff --git a/gdb/config/mips/tm-mipsm3.h b/gdb/config/mips/tm-mipsm3.h deleted file mode 100644 index dbc10d7..0000000 --- a/gdb/config/mips/tm-mipsm3.h +++ /dev/null @@ -1,67 +0,0 @@ -// 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-vxmips.h b/gdb/config/mips/tm-vxmips.h index 5475fb5..5eb1043 100644 --- a/gdb/config/mips/tm-vxmips.h +++ b/gdb/config/mips/tm-vxmips.h @@ -21,9 +21,3 @@ #include "mips/tm-mips.h" #include "config/tm-vxworks.h" - -/* FIXME: These are almost certainly wrong. */ - -/* Number of registers in a ptrace_getregs call. */ - -#define VX_NUM_REGS (NUM_REGS) diff --git a/gdb/config/mips/xm-irix6.h b/gdb/config/mips/xm-irix6.h deleted file mode 100644 index a8a4c68..0000000 --- a/gdb/config/mips/xm-irix6.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definitions for irix6 hosting support. - - Copyright 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 "mips/xm-irix5.h" diff --git a/gdb/config/mips/xm-linux.h b/gdb/config/mips/xm-linux.h deleted file mode 100644 index 4db6201..0000000 --- a/gdb/config/mips/xm-linux.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Host definitions for GNU/Linux on MIPS. - - Copyright 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. */ - -#ifndef XM_MIPSLINUX_H -#define XM_MIPSLINUX_H - -#endif /* XM_MIPSLINUX_H */ diff --git a/gdb/config/mips/xm-mipsm3.h b/gdb/config/mips/xm-mipsm3.h deleted file mode 100644 index 2207d3a..0000000 --- a/gdb/config/mips/xm-mipsm3.h +++ /dev/null @@ -1,29 +0,0 @@ -// 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/mn10200/mn10200.mt b/gdb/config/mn10200/mn10200.mt deleted file mode 100644 index be374ec..0000000 --- a/gdb/config/mn10200/mn10200.mt +++ /dev/null @@ -1,6 +0,0 @@ -# OBSOLETE # Target: Matsushita mn10200 -# OBSOLETE TDEPFILES= mn10200-tdep.o -# OBSOLETE TM_FILE= tm-mn10200.h -# OBSOLETE -# OBSOLETE SIM_OBS = remote-sim.o -# OBSOLETE SIM = ../sim/mn10200/libsim.a diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h deleted file mode 100644 index 511c136..0000000 --- a/gdb/config/mn10200/tm-mn10200.h +++ /dev/null @@ -1,214 +0,0 @@ -// OBSOLETE /* Parameters for execution on a Matsushita mn10200 processor. -// OBSOLETE -// OBSOLETE Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software -// OBSOLETE Foundation, Inc. -// OBSOLETE -// OBSOLETE Contributed by Geoffrey Noer <noer@cygnus.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 /* FIXME: cagney/2001-03-01: The below macros refer to functions -// OBSOLETE declared in "regcache.h". The ``correct fix'' is to convert those -// OBSOLETE macros into functions. */ -// OBSOLETE #include "regcache.h" -// OBSOLETE #include "symtab.h" /* For namespace_enum. */ -// OBSOLETE #include "symfile.h" /* For entry_point_address(). */ -// OBSOLETE -// OBSOLETE /* ints are only 16bits on the mn10200. */ -// OBSOLETE #undef TARGET_INT_BIT -// OBSOLETE #define TARGET_INT_BIT 16 -// OBSOLETE -// OBSOLETE /* The mn10200 doesn't support long long types. */ -// OBSOLETE #undef TARGET_LONG_LONG_BIT -// OBSOLETE #define TARGET_LONG_LONG_BIT 32 -// OBSOLETE -// OBSOLETE /* The mn10200 doesn't support double or long double either. */ -// OBSOLETE #undef TARGET_DOUBLE_BIT -// OBSOLETE #undef TARGET_LONG_DOUBLE_BIT -// OBSOLETE #define TARGET_DOUBLE_BIT 32 -// OBSOLETE #define TARGET_LONG_DOUBLE_BIT 32 -// OBSOLETE -// OBSOLETE /* Not strictly correct, but the machine independent code is not -// OBSOLETE ready to handle any of the basic sizes not being a power of two. */ -// OBSOLETE #undef TARGET_PTR_BIT -// OBSOLETE #define TARGET_PTR_BIT 32 -// OBSOLETE -// OBSOLETE /* The mn10200 really has 24 bit registers but the simulator reads/writes -// OBSOLETE them as 32bit values, so we claim they're 32bits each. This may have -// OBSOLETE to be tweaked if the Matsushita emulator/board really deals with them -// OBSOLETE as 24bits each. */ -// OBSOLETE #define REGISTER_SIZE 4 -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_RAW_SIZE REGISTER_SIZE -// OBSOLETE #define NUM_REGS 11 -// OBSOLETE -// OBSOLETE #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE) -// OBSOLETE -// OBSOLETE #define REGISTER_NAMES \ -// OBSOLETE { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "sp", \ -// OBSOLETE "pc", "mdr", "psw"} -// OBSOLETE -// OBSOLETE #define FP_REGNUM 6 -// OBSOLETE #define SP_REGNUM 7 -// OBSOLETE #define PC_REGNUM 8 -// OBSOLETE #define MDR_REGNUM 9 -// OBSOLETE #define PSW_REGNUM 10 -// OBSOLETE -// OBSOLETE /* Treat the registers as 32bit values. */ -// OBSOLETE #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_long -// OBSOLETE -// OBSOLETE #define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE) -// OBSOLETE #define REGISTER_VIRTUAL_SIZE(REG) REGISTER_SIZE -// OBSOLETE #define REGISTER_RAW_SIZE(REG) REGISTER_SIZE -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE REGISTER_SIZE -// OBSOLETE -// OBSOLETE /* The breakpoint instruction must be the same size as te smallest -// OBSOLETE instruction in the instruction set. -// OBSOLETE -// OBSOLETE The Matsushita mn10x00 processors have single byte instructions -// OBSOLETE so we need a single byte breakpoint. Matsushita hasn't defined -// OBSOLETE one, so we defined it ourselves. -// OBSOLETE -// OBSOLETE 0xff is the only available single byte insn left on the mn10200. */ -// OBSOLETE #define BREAKPOINT {0xff} -// OBSOLETE -// OBSOLETE #define FUNCTION_START_OFFSET 0 -// OBSOLETE -// OBSOLETE #define DECR_PC_AFTER_BREAK 0 -// OBSOLETE -// OBSOLETE /* Stacks grow the normal way. */ -// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) -// OBSOLETE -// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) \ -// OBSOLETE (read_memory_integer (read_register (SP_REGNUM), REGISTER_SIZE) & 0xffffff) -// OBSOLETE -// OBSOLETE struct frame_info; -// OBSOLETE struct frame_saved_regs; -// OBSOLETE struct type; -// OBSOLETE struct value; -// OBSOLETE -// OBSOLETE #define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size; -// OBSOLETE -// OBSOLETE extern void mn10200_init_extra_frame_info (struct frame_info *); -// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi) -// OBSOLETE #define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y)) -// OBSOLETE #define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y)) -// OBSOLETE -// OBSOLETE extern void mn10200_frame_find_saved_regs (struct frame_info *, -// OBSOLETE struct frame_saved_regs *); -// OBSOLETE #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_frame_chain (struct frame_info *); -// OBSOLETE #define FRAME_CHAIN(fi) mn10200_frame_chain (fi) -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_find_callers_reg (struct frame_info *, int); -// OBSOLETE extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *); -// OBSOLETE #define FRAME_SAVED_PC(FI) (mn10200_frame_saved_pc (FI)) -// 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 #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ -// OBSOLETE { \ -// OBSOLETE if (TYPE_LENGTH (TYPE) > 8) \ -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); \ -// OBSOLETE else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \ -// OBSOLETE { \ -// OBSOLETE memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), 2); \ -// OBSOLETE memcpy (VALBUF + 2, REGBUF + REGISTER_BYTE (1), 2); \ -// OBSOLETE } \ -// OBSOLETE else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\ -// OBSOLETE { \ -// OBSOLETE memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \ -// OBSOLETE } \ -// OBSOLETE else \ -// OBSOLETE { \ -// OBSOLETE memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); \ -// OBSOLETE } \ -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ -// OBSOLETE extract_address (REGBUF + REGISTER_BYTE (4), \ -// OBSOLETE REGISTER_RAW_SIZE (4)) -// OBSOLETE -// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \ -// OBSOLETE { \ -// OBSOLETE if (TYPE_LENGTH (TYPE) > 8) \ -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); \ -// OBSOLETE else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \ -// OBSOLETE { \ -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \ -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \ -// OBSOLETE } \ -// OBSOLETE else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\ -// OBSOLETE { \ -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \ -// OBSOLETE } \ -// OBSOLETE else \ -// OBSOLETE { \ -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \ -// OBSOLETE } \ -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); -// OBSOLETE #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \ -// OBSOLETE (SP) = mn10200_store_struct_return (STRUCT_ADDR, SP) -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_skip_prologue (CORE_ADDR); -// OBSOLETE #define SKIP_PROLOGUE(pc) (mn10200_skip_prologue (pc)) -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_SKIP 0 -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi)) -// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi)) -// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) -// OBSOLETE -// OBSOLETE extern void mn10200_pop_frame (struct frame_info *); -// OBSOLETE #define POP_FRAME mn10200_pop_frame (get_current_frame ()) -// OBSOLETE -// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1 -// OBSOLETE #define CALL_DUMMY {0} -// OBSOLETE #define CALL_DUMMY_START_OFFSET (0) -// OBSOLETE #define CALL_DUMMY_BREAKPOINT_OFFSET (0) -// OBSOLETE #define CALL_DUMMY_LOCATION AT_ENTRY_POINT -// OBSOLETE #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) -// OBSOLETE #define CALL_DUMMY_ADDRESS() entry_point_address () -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_push_return_address (CORE_ADDR, CORE_ADDR); -// OBSOLETE #define PUSH_RETURN_ADDRESS(PC, SP) mn10200_push_return_address (PC, SP) -// OBSOLETE -// OBSOLETE #define PUSH_DUMMY_FRAME generic_push_dummy_frame () -// OBSOLETE -// OBSOLETE extern CORE_ADDR mn10200_push_arguments (int, struct value **, CORE_ADDR, -// OBSOLETE unsigned char, CORE_ADDR); -// OBSOLETE #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ -// OBSOLETE (mn10200_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)) -// OBSOLETE -// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) -// OBSOLETE -// OBSOLETE #define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \ -// OBSOLETE (TYPE_LENGTH (TYPE) > 8) -// OBSOLETE -// OBSOLETE extern use_struct_convention_fn mn10200_use_struct_convention; -// OBSOLETE #define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10200_use_struct_convention (GCC_P, TYPE) -// OBSOLETE -// OBSOLETE /* Define this for Wingdb */ -// OBSOLETE #define TARGET_MN10200 diff --git a/gdb/config/nm-m3.h b/gdb/config/nm-m3.h deleted file mode 100644 index 0cc84e3..0000000 --- a/gdb/config/nm-m3.h +++ /dev/null @@ -1,126 +0,0 @@ -// 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/ns32k/tm-ns32k.h b/gdb/config/ns32k/tm-ns32k.h index 96dd2cb..a603fc8 100644 --- a/gdb/config/ns32k/tm-ns32k.h +++ b/gdb/config/ns32k/tm-ns32k.h @@ -32,6 +32,4 @@ #define STACK_END_ADDR (0xfffff000) #endif -#define NUM_GENERAL_REGS 8 - #endif /* TM_NS32K_H */ diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh deleted file mode 100644 index e4d0215..0000000 --- a/gdb/config/pa/hppabsd.mh +++ /dev/null @@ -1,4 +0,0 @@ -# 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 deleted file mode 100644 index e63f9b8..0000000 --- a/gdb/config/pa/hppabsd.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index 0e82dc1..0000000 --- a/gdb/config/pa/hppaosf.mh +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index 4a54c79..0000000 --- a/gdb/config/pa/hppaosf.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index cfd9969..0000000 --- a/gdb/config/pa/hppapro.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index 96dea6e..0000000 --- a/gdb/config/pa/nm-hppab.h +++ /dev/null @@ -1,123 +0,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 29a52df..bf4fd3c 100644 --- a/gdb/config/pa/nm-hppah.h +++ b/gdb/config/pa/nm-hppah.h @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct target_ops; + #define U_REGS_OFFSET 0 #define KERNEL_U_ADDR 0 @@ -44,9 +46,10 @@ #define FIVE_ARG_PTRACE /* We need to figure out where the text region is so that we use the - appropriate ptrace operator to manipulate text. Simply reading/writing - user space will crap out HPUX. */ -#define NEED_TEXT_START_END 1 + appropriate ptrace operator to manipulate text. Simply + reading/writing user space will crap out HPUX. */ +#define DEPRECATED_HPUX_TEXT_END deprecated_hpux_text_end +extern void deprecated_hpux_text_end (struct target_ops *exec_ops); /* In hppah-nat.c: */ #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h deleted file mode 100644 index 0a6b810..0000000 --- a/gdb/config/pa/nm-hppao.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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 d1b3555..9d4b134 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -35,8 +35,8 @@ #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address) /* Hack, get around problem with including "arch-utils.h". */ struct frame_info; -extern CORE_ADDR init_frame_pc_default (int fromleaf, struct frame_info *prev); -#define DEPRECATED_INIT_FRAME_PC(l,f) (init_frame_pc_default (l, f)) +extern CORE_ADDR deprecated_init_frame_pc_default (int fromleaf, struct frame_info *prev); +#define DEPRECATED_INIT_FRAME_PC(l,f) (deprecated_init_frame_pc_default (l, f)) /* Forward declarations of some types we use in prototypes */ @@ -119,9 +119,12 @@ extern int hppa_instruction_nullified (void); specified in the calling convention doc. As far as I know, the only way to get the return value is to have the caller tell us where it told the callee to put it, rather than have the callee tell us. */ -struct value *hppa_value_returned_from_stack (register struct type *valtype, +struct value *hppa_value_returned_from_stack (struct type *valtype, CORE_ADDR addr); -#define VALUE_RETURNED_FROM_STACK(valtype,addr) \ +/* FIXME: cagney/2003-09-27: This method should now be redundant. + Instead, when "struct return convention", the inferior function + call code always saves and uses the struct return's stack address. */ +#define DEPRECATED_VALUE_RETURNED_FROM_STACK(valtype,addr) \ hppa_value_returned_from_stack (valtype, addr) extern void hppa_frame_init_saved_regs (struct frame_info *); @@ -205,7 +208,7 @@ extern void hppa_frame_init_saved_regs (struct frame_info *); /* If we've reached a trap instruction within the call dummy, then we'll consider that to mean that we've reached the call dummy's end after its successful completion. */ -#define CALL_DUMMY_HAS_COMPLETED(pc, sp, frame_address) \ +#define DEPRECATED_CALL_DUMMY_HAS_COMPLETED(pc, sp, frame_address) \ (DEPRECATED_PC_IN_CALL_DUMMY((pc), (sp), (frame_address)) && \ (read_memory_integer((pc), 4) == BREAKPOINT32)) diff --git a/gdb/config/pa/tm-hppab.h b/gdb/config/pa/tm-hppab.h deleted file mode 100644 index edacdbf..0000000 --- a/gdb/config/pa/tm-hppab.h +++ /dev/null @@ -1,47 +0,0 @@ -// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running BSD, for GDB. -// OBSOLETE Contributed by the Center for Software Science at the -// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */ -// OBSOLETE -// OBSOLETE /* For BSD: -// OBSOLETE -// OBSOLETE The signal context structure pointer is always saved at the base -// OBSOLETE of the frame + 0x4. -// OBSOLETE -// OBSOLETE We get the PC & SP directly from the sigcontext structure itself. -// OBSOLETE For other registers we have to dive in a little deeper: -// OBSOLETE -// OBSOLETE The hardware save state pointer is at offset 0x10 within the -// OBSOLETE signal context structure. -// OBSOLETE -// OBSOLETE Within the hardware save state, registers are found in the same order -// OBSOLETE as the register numbers in GDB. */ -// OBSOLETE -// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ -// OBSOLETE { \ -// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ -// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \ -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ -// OBSOLETE { \ -// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ -// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \ -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ -// OBSOLETE { \ -// OBSOLETE int i; \ -// OBSOLETE CORE_ADDR TMP; \ -// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \ -// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \ -// OBSOLETE for (i = 0; i < NUM_REGS; i++) \ -// OBSOLETE { \ -// OBSOLETE if (i == SP_REGNUM) \ -// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \ -// OBSOLETE else \ -// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \ -// OBSOLETE } \ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* It's mostly just the common stuff. */ -// OBSOLETE #include "pa/tm-hppa.h" diff --git a/gdb/config/pa/tm-hppao.h b/gdb/config/pa/tm-hppao.h deleted file mode 100644 index a466287..0000000 --- a/gdb/config/pa/tm-hppao.h +++ /dev/null @@ -1,98 +0,0 @@ -// 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 deleted file mode 100644 index c4f2b77..0000000 --- a/gdb/config/pa/tm-pro.h +++ /dev/null @@ -1,14 +0,0 @@ -// 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 deleted file mode 100644 index d46e5ad..0000000 --- a/gdb/config/pa/xm-hppab.h +++ /dev/null @@ -1,24 +0,0 @@ -// 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-pa.h b/gdb/config/pa/xm-pa.h deleted file mode 100644 index 0095003..0000000 --- a/gdb/config/pa/xm-pa.h +++ /dev/null @@ -1,5 +0,0 @@ -// 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/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h index e538390..25b9904 100644 --- a/gdb/config/powerpc/tm-linux.h +++ b/gdb/config/powerpc/tm-linux.h @@ -31,19 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef IN_SOLIB_CALL_TRAMPOLINE #undef SKIP_TRAMPOLINE_CODE -/* We can single step on linux */ -#undef SOFTWARE_SINGLE_STEP -#define SOFTWARE_SINGLE_STEP(p,q) internal_error (__FILE__, __LINE__, "Will never execute!") -#undef SOFTWARE_SINGLE_STEP_P -#define SOFTWARE_SINGLE_STEP_P() 0 - /* Make sure nexti gets the help it needs for debugging assembly code without symbols */ -#define AT_SUBROUTINE_CALL_INSTRUCTION_TARGET(prevpc,stoppc) \ - at_subroutine_call_instruction_target(prevpc,stoppc) -extern int at_subroutine_call_instruction_target(); - extern int ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name); #undef IN_SIGTRAMP #define IN_SIGTRAMP(pc,func_name) ppc_linux_in_sigtramp (pc,func_name) diff --git a/gdb/config/powerpc/tm-ppc-eabi.h b/gdb/config/powerpc/tm-ppc-eabi.h index e49b2bd..d29b05d 100644 --- a/gdb/config/powerpc/tm-ppc-eabi.h +++ b/gdb/config/powerpc/tm-ppc-eabi.h @@ -24,9 +24,6 @@ /* Use generic RS6000 definitions. */ #include "rs6000/tm-rs6000.h" -/* except we want to allow single stepping */ -#undef SOFTWARE_SINGLE_STEP_P -#define SOFTWARE_SINGLE_STEP_P() 0 #undef PROCESS_LINENUMBER_HOOK diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 66b2f28..41183fb 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -83,18 +83,6 @@ extern void aix_process_linenos (void); #define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \ (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 - anyway. */ -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)) - -/* RS6000/AIX does not support PT_STEP. Has to be simulated. */ - -#define SOFTWARE_SINGLE_STEP_P() 1 -extern void rs6000_software_single_step (enum target_signal, int); -#define SOFTWARE_SINGLE_STEP(sig,bp_p) rs6000_software_single_step (sig, bp_p) /* Notice when a new child process is started. */ diff --git a/gdb/config/s390/nm-linux.h b/gdb/config/s390/nm-linux.h index 727a66eb..df601de 100644 --- a/gdb/config/s390/nm-linux.h +++ b/gdb/config/s390/nm-linux.h @@ -27,6 +27,10 @@ #include "config/nm-linux.h" +/* This is the amount to subtract from u.u_ar0 + to get the offset in the core file of the register values. */ +#define KERNEL_U_ADDR 0x0 + #define REGISTER_U_ADDR(addr, blockend, regno) \ (addr) = s390_register_u_addr((blockend),(regno)); extern int s390_register_u_addr (int, int); diff --git a/gdb/config/s390/s390.mh b/gdb/config/s390/s390.mh index ab3350f..b45fa11 100644 --- a/gdb/config/s390/s390.mh +++ b/gdb/config/s390/s390.mh @@ -1,13 +1,6 @@ # Host: S390, running Linux - -XM_FILE= xm-linux.h -XM_CLIBS= - NAT_FILE= nm-linux.h NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \ core-aout.o core-regset.o linux-proc.o gcore.o thread-db.o lin-lwp.o \ proc-service.o linux-nat.o LOADLIBES = -ldl -rdynamic - - - diff --git a/gdb/config/s390/xm-linux.h b/gdb/config/s390/xm-linux.h deleted file mode 100644 index d059d40..0000000 --- a/gdb/config/s390/xm-linux.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Native support for GNU/Linux, for GDB, the GNU debugger. - Copyright 2001 Free Software Foundation, Inc. - Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - for IBM Deutschland Entwicklung GmbH, IBM Corporation. - - 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 XM_LINUX_H -#define XM_LINUX_H - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#define KERNEL_U_ADDR 0x0 - -#endif /* #ifndef XM_LINUX_H */ diff --git a/gdb/config/sh/embed.mt b/gdb/config/sh/embed.mt index 4c82134..807aa11 100644 --- a/gdb/config/sh/embed.mt +++ b/gdb/config/sh/embed.mt @@ -1,4 +1,4 @@ -# Target: Embedded Hitachi Super-H with ICE and simulator +# Target: Embedded Renesas Super-H with ICE and simulator TDEPFILES= sh-tdep.o sh64-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o TM_FILE= tm-sh.h diff --git a/gdb/config/sh/linux.mt b/gdb/config/sh/linux.mt index 92ab4c4..83ada46 100644 --- a/gdb/config/sh/linux.mt +++ b/gdb/config/sh/linux.mt @@ -1,4 +1,4 @@ -# Target: Hitachi Super-H running GNU/Linux +# Target: Renesas Super-H running GNU/Linux TDEPFILES= sh-tdep.o sh64-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o solib.o solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h index e8272d0..0117d81 100644 --- a/gdb/config/sh/tm-linux.h +++ b/gdb/config/sh/tm-linux.h @@ -1,4 +1,4 @@ -/* Target-specific definitions for GNU/Linux running on a Hitachi +/* Target-specific definitions for GNU/Linux running on a Renesas Super-H. Copyright 2000, 2002 Free Software Foundation, Inc. diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 966c8cd..228e0bc 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -1,4 +1,4 @@ -/* Target-specific definition for a Hitachi Super-H. +/* Target-specific definition for a Renesas Super-H. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. diff --git a/gdb/config/sh/wince.mt b/gdb/config/sh/wince.mt index 342c2d6..89a5a89 100644 --- a/gdb/config/sh/wince.mt +++ b/gdb/config/sh/wince.mt @@ -1,4 +1,4 @@ -# Target: Hitachi Super-H running on Windows CE +# Target: Renesas Super-H running on Windows CE TDEPFILES= sh-tdep.o sh64-tdep.o wince.o TM_FILE= tm-wince.h MT_CFLAGS=-DSHx -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"' diff --git a/gdb/config/sparc/sparclet.mt b/gdb/config/sparc/sparclet.mt deleted file mode 100644 index 5dde41b..0000000 --- a/gdb/config/sparc/sparclet.mt +++ /dev/null @@ -1,3 +0,0 @@ -# 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 deleted file mode 100644 index 7ae1008..0000000 --- a/gdb/config/sparc/sparclite.mt +++ /dev/null @@ -1,5 +0,0 @@ -# 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-sp64linux.h b/gdb/config/sparc/tm-sp64linux.h index 17bdd8a..81d9db0 100644 --- a/gdb/config/sparc/tm-sp64linux.h +++ b/gdb/config/sparc/tm-sp64linux.h @@ -29,8 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef TM_PRINT_INSN_MACH #define TM_PRINT_INSN_MACH bfd_mach_sparc_v9a -#define GDB_PTRACE_REGS64 - #include "config/tm-sysv4.h" #endif /* TM_SPARC_LIN64_H */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index a18e203..e8deebc 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -204,18 +204,13 @@ extern const unsigned char *sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len); #define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM) -#define PRINT_EXTRA_FRAME_INFO(FI) \ +#define DEPRECATED_PRINT_EXTRA_FRAME_INFO(FI) \ sparc_print_extra_frame_info (FI) extern void sparc_print_extra_frame_info (struct frame_info *); /* DEPRECATED_INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames. */ -/* NOTE: cagney/2002-12-08: Add local declaration of - init_frame_pc_noop() because it isn't possible to include - "arch-utils.h" here. */ -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) ? DEPRECATED_SAVED_PC_AFTER_CALL ((PREV)->next) : \ (PREV)->next ? DEPRECATED_FRAME_SAVED_PC ((PREV)->next) : read_pc ()) @@ -228,9 +223,7 @@ extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); address). Some vendors get it wrong. */ #define FRAME_SAVED_L0 0 -#define FRAME_SAVED_I0 (8 * REGISTER_RAW_SIZE (L0_REGNUM)) - -#define FRAME_STRUCT_ARGS_ADDRESS(FI) (get_frame_base (FI)) +#define FRAME_SAVED_I0 (8 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)) /* Things needed for making the inferior call functions. */ /* diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h deleted file mode 100644 index 95bdeea..0000000 --- a/gdb/config/sparc/tm-sparclet.h +++ /dev/null @@ -1,158 +0,0 @@ -// 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 deleted file mode 100644 index bd8996b..0000000 --- a/gdb/config/sparc/tm-sparclite.h +++ /dev/null @@ -1,123 +0,0 @@ -// 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/config/sparc/tm-sparclynx.h b/gdb/config/sparc/tm-sparclynx.h index 3d19653..e4ea4d5 100644 --- a/gdb/config/sparc/tm-sparclynx.h +++ b/gdb/config/sparc/tm-sparclynx.h @@ -32,6 +32,6 @@ #undef FRAME_SAVED_L0 #define FRAME_SAVED_I0 0 -#define FRAME_SAVED_L0 (8 * REGISTER_RAW_SIZE (I0_REGNUM)) +#define FRAME_SAVED_L0 (8 * DEPRECATED_REGISTER_RAW_SIZE (I0_REGNUM)) #endif /* TM_SPARCLYNX_H */ diff --git a/gdb/config/sparc/tm-vxsparc.h b/gdb/config/sparc/tm-vxsparc.h index f32f70d..95861ec 100644 --- a/gdb/config/sparc/tm-vxsparc.h +++ b/gdb/config/sparc/tm-vxsparc.h @@ -22,12 +22,6 @@ #include "sparc/tm-spc-em.h" #include "config/tm-vxworks.h" -/* FIXME: These are almost certainly wrong. */ - -/* Number of registers in a ptrace_getregs call. */ - -#define VX_NUM_REGS (NUM_REGS) - /* Number of registers in a ptrace_getfpregs call. */ /* #define VX_SIZE_FPREGS (don't know how many) */ diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h deleted file mode 100644 index 59b6ecb..0000000 --- a/gdb/config/z8k/tm-z8k.h +++ /dev/null @@ -1,292 +0,0 @@ -// OBSOLETE /* Parameters for execution on a z8000 series machine. -// OBSOLETE -// OBSOLETE Copyright 1992, 1993, 1994, 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 /* NOTE: cagney/2002-11-24: This is a guess. */ -// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0 -// OBSOLETE #define CALL_DUMMY_LOCATION ON_STACK -// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address) -// OBSOLETE -// OBSOLETE #undef TARGET_INT_BIT -// OBSOLETE #undef TARGET_LONG_BIT -// OBSOLETE #undef TARGET_SHORT_BIT -// OBSOLETE #undef TARGET_PTR_BIT -// OBSOLETE -// OBSOLETE #define TARGET_SHORT_BIT 16 -// OBSOLETE #define TARGET_INT_BIT 16 -// OBSOLETE #define TARGET_LONG_BIT 32 -// OBSOLETE #define TARGET_PTR_BIT (BIG ? 32: 16) -// OBSOLETE -// OBSOLETE /* Offset from address of function to start of its code. -// OBSOLETE Zero on most machines. */ -// OBSOLETE -// OBSOLETE #define FUNCTION_START_OFFSET 0 -// OBSOLETE -// OBSOLETE /* Advance PC across any function entry prologue instructions -// OBSOLETE to reach some "real" code. */ -// OBSOLETE -// OBSOLETE #define SKIP_PROLOGUE(ip) (z8k_skip_prologue (ip)) -// OBSOLETE extern CORE_ADDR z8k_skip_prologue (CORE_ADDR ip); -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Immediately after a function call, return the saved pc. -// OBSOLETE Can't always go through the frames for this because on some machines -// OBSOLETE the new frame is not set up until the new function executes -// OBSOLETE some instructions. */ -// OBSOLETE -// OBSOLETE -// OBSOLETE extern int z8k_saved_pc_after_call (struct frame_info *frame); -// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) z8k_saved_pc_after_call(frame) -// OBSOLETE -// OBSOLETE /* Stack grows downward. */ -// OBSOLETE -// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) -// OBSOLETE -// OBSOLETE /* Sequence of bytes for breakpoint instruction. */ -// OBSOLETE -// OBSOLETE #define BREAKPOINT {0x36,0x00} -// OBSOLETE -// OBSOLETE /* If your kernel resets the pc after the trap happens you may need to -// OBSOLETE define this before including this file. */ -// OBSOLETE -// OBSOLETE #define DECR_PC_AFTER_BREAK 0 -// OBSOLETE -// OBSOLETE /* Say how long registers are. */ -// OBSOLETE -// OBSOLETE #define REGISTER_TYPE unsigned int -// OBSOLETE -// OBSOLETE #define NUM_REGS 23 /* 16 registers + 1 ccr + 1 pc + 3 debug -// OBSOLETE regs + fake fp + fake sp */ -// OBSOLETE #define REGISTER_BYTES (NUM_REGS *4) -// OBSOLETE -// OBSOLETE /* Index within `registers' of the first byte of the space for -// OBSOLETE register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_BYTE(N) ((N)*4) -// OBSOLETE -// OBSOLETE /* Number of bytes of storage in the actual machine representation -// OBSOLETE for register N. On the z8k, all but the pc are 2 bytes, but we -// OBSOLETE keep them all as 4 bytes and trim them on I/O */ -// OBSOLETE -// OBSOLETE -// OBSOLETE #define REGISTER_RAW_SIZE(N) (((N) < 16)? 2:4) -// OBSOLETE -// OBSOLETE /* Number of bytes of storage in the program's representation -// OBSOLETE for register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) -// OBSOLETE -// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */ -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_RAW_SIZE 4 -// OBSOLETE -// OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. */ -// OBSOLETE -// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4 -// OBSOLETE -// OBSOLETE /* Return the GDB type object for the "standard" data type -// OBSOLETE of data in register N. */ -// OBSOLETE -// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ -// OBSOLETE (REGISTER_VIRTUAL_SIZE(N) == 2? builtin_type_unsigned_int : builtin_type_long) -// OBSOLETE -// OBSOLETE #define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y)) -// OBSOLETE #define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y)) -// OBSOLETE -// OBSOLETE #define REGISTER_NAMES \ -// OBSOLETE {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ -// OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ -// OBSOLETE "ccr", "pc", "cycles","insts","time","fp","sp"} -// 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 CCR_REGNUM 16 /* Contains processor status */ -// OBSOLETE #define PC_REGNUM 17 /* Contains program counter */ -// OBSOLETE #define CYCLES_REGNUM 18 -// OBSOLETE #define INSTS_REGNUM 19 -// OBSOLETE #define TIME_REGNUM 20 -// OBSOLETE #define FP_REGNUM 21 /* Contains fp, whatever memory model */ -// OBSOLETE #define SP_REGNUM 22 /* Conatins sp, whatever memory model */ -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE #define PTR_SIZE (BIG ? 4: 2) -// OBSOLETE #define PTR_MASK (BIG ? 0xff00ffff : 0x0000ffff) -// 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 -// OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// 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. This is assuming that floating point values are returned -// OBSOLETE as doubles in d0/d1. */ -// OBSOLETE -// OBSOLETE -// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ -// OBSOLETE memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE)); -// OBSOLETE -// OBSOLETE /* Write into appropriate registers a function return value -// OBSOLETE of type TYPE, given in virtual format. */ -// OBSOLETE -// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE -// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state -// OBSOLETE the address in which a function should return its structure value, -// OBSOLETE as a CORE_ADDR (or an expression that can be used as one). */ -// OBSOLETE -// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) -// OBSOLETE -// OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame -// OBSOLETE (its caller). */ -// OBSOLETE -// OBSOLETE /* FRAME_CHAIN takes a frame's nominal address and produces the frame's -// OBSOLETE chain-pointer. -// OBSOLETE In the case of the Z8000, the frame's nominal address -// OBSOLETE is the address of a ptr sized byte word containing the calling -// OBSOLETE frame's address. */ -// OBSOLETE -// OBSOLETE extern CORE_ADDR z8k_frame_chain (struct frame_info *thisframe); -// OBSOLETE #define FRAME_CHAIN(thisframe) z8k_frame_chain(thisframe); -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Define other aspects of the stack frame. */ -// OBSOLETE -// OBSOLETE /* A macro that tells us whether the function invocation represented -// OBSOLETE by FI does not have a frame on the stack associated with it. If it -// OBSOLETE does not, FRAMELESS is set to 1, else 0. */ -// OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) \ -// OBSOLETE (frameless_look_for_prologue (FI)) -// OBSOLETE -// OBSOLETE extern CORE_ADDR z8k_frame_saved_pc (struct frame_info *frame); -// OBSOLETE #define FRAME_SAVED_PC(FRAME) z8k_frame_saved_pc(FRAME) -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) -// OBSOLETE -// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) -// OBSOLETE -// OBSOLETE /* Set VAL to the number of args passed to frame described by FI. -// OBSOLETE Can set VAL to -1, meaning no way to tell. */ -// OBSOLETE -// OBSOLETE /* We can't tell how many args there are -// OBSOLETE now that the C compiler delays popping them. */ -// OBSOLETE #if !defined (FRAME_NUM_ARGS) -// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE /* Return number of bytes at start of arglist that are not really args. */ -// OBSOLETE -// OBSOLETE #define FRAME_ARGS_SKIP 8 -// OBSOLETE -// OBSOLETE struct frame_info; -// OBSOLETE extern void z8k_frame_init_saved_regs (struct frame_info *); -// OBSOLETE #define FRAME_INIT_SAVED_REGS(fi) z8k_frame_init_saved_regs (fi) -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Things needed for making the inferior call functions. -// OBSOLETE It seems like every m68k based machine has almost identical definitions -// OBSOLETE in the individual machine's configuration files. Most other cpu types -// OBSOLETE (mips, i386, etc) have routines in their *-tdep.c files to handle this -// OBSOLETE for most configurations. The m68k family should be able to do this as -// OBSOLETE well. These macros can still be overridden when necessary. */ -// OBSOLETE -// OBSOLETE /* The CALL_DUMMY macro is the sequence of instructions, as disassembled -// OBSOLETE by gdb itself: -// OBSOLETE -// OBSOLETE fmovemx fp0-fp7,sp@- 0xf227 0xe0ff -// OBSOLETE moveml d0-a5,sp@- 0x48e7 0xfffc -// OBSOLETE clrw sp@- 0x4267 -// OBSOLETE movew ccr,sp@- 0x42e7 -// OBSOLETE -// OBSOLETE /..* The arguments are pushed at this point by GDB; -// OBSOLETE no code is needed in the dummy for this. -// OBSOLETE The CALL_DUMMY_START_OFFSET gives the position of -// OBSOLETE the following jsr instruction. *../ -// OBSOLETE -// OBSOLETE jsr @#0x32323232 0x4eb9 0x3232 0x3232 -// OBSOLETE addal #0x69696969,sp 0xdffc 0x6969 0x6969 -// OBSOLETE trap #<your BPT_VECTOR number here> 0x4e4? -// OBSOLETE nop 0x4e71 -// OBSOLETE -// OBSOLETE Note this is CALL_DUMMY_LENGTH bytes (28 for the above example). -// OBSOLETE We actually start executing at the jsr, since the pushing of the -// OBSOLETE registers is done by PUSH_DUMMY_FRAME. If this were real code, -// OBSOLETE the arguments for the function called by the jsr would be pushed -// OBSOLETE between the moveml and the jsr, and we could allow it to execute through. -// OBSOLETE But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is -// OBSOLETE done, and we cannot allow the moveml to push the registers again lest -// OBSOLETE they be taken for the arguments. */ -// OBSOLETE -// OBSOLETE -// OBSOLETE #define CALL_DUMMY { 0 } -// OBSOLETE #define CALL_DUMMY_LENGTH 24 /* Size of CALL_DUMMY */ -// OBSOLETE #define CALL_DUMMY_START_OFFSET 8 /* Offset to jsr instruction */ -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Insert the specified number of args and function address -// OBSOLETE into a call sequence of the above form stored at DUMMYNAME. -// OBSOLETE We use the BFD routines to store a big-endian value of known size. */ -// OBSOLETE -// OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -// OBSOLETE { bfd_putb32 (fun, (char *) dummyname + CALL_DUMMY_START_OFFSET + 2); \ -// OBSOLETE bfd_putb32 (nargs*4, (char *) dummyname + CALL_DUMMY_START_OFFSET + 8); } -// OBSOLETE -// OBSOLETE /* Push an empty stack frame, to record the current PC, etc. */ -// OBSOLETE -// OBSOLETE #define PUSH_DUMMY_FRAME { z8k_push_dummy_frame (); } -// OBSOLETE -// OBSOLETE extern void z8k_push_dummy_frame (void); -// OBSOLETE -// OBSOLETE extern void z8k_pop_frame (void); -// OBSOLETE -// OBSOLETE /* Discard from the stack the innermost frame, restoring all registers. */ -// OBSOLETE -// OBSOLETE #define POP_FRAME { z8k_pop_frame (); } -// OBSOLETE -// OBSOLETE /* Offset from SP to first arg on stack at first instruction of a function */ -// OBSOLETE -// OBSOLETE #define SP_ARG0 (1 * 4) -// OBSOLETE -// OBSOLETE extern CORE_ADDR z8k_addr_bits_remove (CORE_ADDR); -// OBSOLETE #define ADDR_BITS_REMOVE(addr) z8k_addr_bits_remove (addr) -// OBSOLETE int sim_z8001_mode; -// OBSOLETE #define BIG (sim_z8001_mode) -// OBSOLETE -// OBSOLETE #define read_memory_short(x) (read_memory_integer(x,2) & 0xffff) -// OBSOLETE -// OBSOLETE #define NO_STD_REGS -// OBSOLETE -// OBSOLETE extern void z8k_do_registers_info (int regnum, int all); -// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \ -// OBSOLETE z8k_do_registers_info (REGNUM, ALL) -// OBSOLETE -// OBSOLETE extern void z8k_set_pointer_size (int newsize); -// OBSOLETE #define INIT_EXTRA_SYMTAB_INFO \ -// OBSOLETE z8k_set_pointer_size(objfile->obfd->arch_info->bits_per_address); -// OBSOLETE -// OBSOLETE #define REGISTER_SIZE 4 diff --git a/gdb/config/z8k/z8k.mt b/gdb/config/z8k/z8k.mt deleted file mode 100644 index 3eb6c7b..0000000 --- a/gdb/config/z8k/z8k.mt +++ /dev/null @@ -1,6 +0,0 @@ -# OBSOLETE # Target: Z8000 with simulator -# OBSOLETE TDEPFILES= z8k-tdep.o -# OBSOLETE TM_FILE= tm-z8k.h -# OBSOLETE -# OBSOLETE SIM_OBS = remote-sim.o -# OBSOLETE SIM = ../sim/z8k/libsim.a diff --git a/gdb/configure.host b/gdb/configure.host index 1830fb8..1c0f9c7 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -41,18 +41,13 @@ arm*-*-linux*) gdb_host=linux ;; arm*-*-netbsdelf*) gdb_host=nbsdelf ;; arm*-*-netbsd*) gdb_host=nbsdaout ;; -# 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 ;; -# OBSOLETE hppa*-*-osf*) gdb_host=hppaosf ;; i[34567]86-ncr-*) gdb_host=ncr3000 ;; -# OBSOLETE i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix -# OBSOLETE i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;; -# OBSOLETE i[3456]86-sequent-sysv*) gdb_host=ptx ;; i[34567]86-*-bsd*) gdb_host=i386bsd ;; i[34567]86-*-dgux*) gdb_host=i386v4 ;; i[34567]86-*-freebsd*) gdb_host=fbsd ;; @@ -96,7 +91,6 @@ m68*-sun-sunos3*) gdb_host=sun3os3 ;; m68*-sun-sunos4*) gdb_host=sun3os4 ;; m68*-sun-*) gdb_host=sun3os4 ;; -# OBSOLETE mips-dec-mach3*) gdb_host=mipsm3 ;; mips-dec-*) gdb_host=decstation ;; mips-little-*) gdb_host=littlemips ;; mips-sgi-irix5*) gdb_host=irix5 ;; @@ -151,5 +145,6 @@ vax-*-ultrix*) gdb_host=vaxult ;; x86_64-*-linux*) gdb_host=x86-64linux ;; x86_64-*-freebsd*) gdb_host=fbsd64 ;; +x86_64-*-netbsd*) gdb_host=nbsd64 ;; esac diff --git a/gdb/configure.tgt b/gdb/configure.tgt index e18d46c..fdaf9ec 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -67,22 +67,15 @@ cris*) gdb_target=cris ;; d10v-*-*) gdb_target=d10v ;; h8300-*-*) gdb_target=h8300 ;; -# OBSOLETE h8500-*-*) gdb_target=h8500 ;; frv-*-*) gdb_target=frv ;; -# 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 ;; -# OBSOLETE hppa*-*-osf*) gdb_target=hppaosf ;; hppa*-*-*) gdb_target=hppa ;; -# OBSOLETE i[3456]86-sequent-bsd*) gdb_target=symmetry ;; -# OBSOLETE i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;; -# OBSOLETE i[3456]86-sequent-sysv*) gdb_target=ptx ;; i[34567]86-ncr-*) gdb_target=ncr3000 ;; i[34567]86-*-bsd*) gdb_target=i386bsd ;; i[34567]86-*-netbsd*) gdb_target=nbsd ;; @@ -154,13 +147,11 @@ mips*-*-linux*) gdb_target=linux build_gdbserver=yes ;; mips*-*-netbsd*) gdb_target=nbsd ;; -# OBSOLETE mips*-*-mach3*) gdb_target=mipsm3 ;; mips*-*-sysv4*) gdb_target=mipsv4 ;; mips*-*-vxworks*) gdb_target=vxmips ;; mips64*-*-*) gdb_target=embed64 ;; mips*-*-*) gdb_target=embed ;; -# OBSOLETE mn10200-*-*) gdb_target=mn10200 ;; mn10300-*-*) gdb_target=mn10300 ;; none-*-*) gdb_target=none ;; @@ -213,9 +204,6 @@ sparc-*-sunos4*) gdb_target=sun4os4 ;; sparc-*-sunos5*) gdb_target=sun4sol2 ;; sparc-*-vxworks*) gdb_target=vxsparc ;; sparc-*-*) gdb_target=sun4os4 ;; -# 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 @@ -241,8 +229,7 @@ v850*-*-*) gdb_target=v850 x86_64-*-linux*) gdb_target=x86-64linux build_gdbserver=yes ;; - -# OBSOLETE z8k-*-coff*) gdb_target=z8k ;; +x86_64-*-netbsd*) gdb_target=nbsd64 ;; esac diff --git a/gdb/core-sol2.c b/gdb/core-sol2.c index a365233..456eebc 100644 --- a/gdb/core-sol2.c +++ b/gdb/core-sol2.c @@ -98,7 +98,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, /* The globals and output registers. */ memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (G1_REGNUM)], - &gregs->r_g1, 15 * REGISTER_RAW_SIZE (G1_REGNUM)); + &gregs->r_g1, 15 * DEPRECATED_REGISTER_RAW_SIZE (G1_REGNUM)); *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)] @@ -119,7 +119,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, sp = *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)]; if (0 != target_read_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM))) + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM))) { warning ("couldn't read input and local registers from core file\n"); } diff --git a/gdb/corelow.c b/gdb/corelow.c index 016140f..8fc3e66 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1,7 +1,7 @@ /* Core dump and executable file functions below target vector, for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "arch-utils.h" #include "gdb_string.h" #include <errno.h> #include <signal.h> @@ -37,9 +38,13 @@ #include "gdbcore.h" #include "gdbthread.h" #include "regcache.h" +#include "regset.h" #include "symfile.h" +#include "exec.h" #include <readline/readline.h> +#include "gdb_assert.h" + #ifndef O_BINARY #define O_BINARY 0 #endif @@ -55,6 +60,11 @@ static struct core_fns *core_file_fns = NULL; static struct core_fns *core_vec = NULL; +/* FIXME: kettenis/20031023: Eventually this variable should + disappear. */ + +struct gdbarch *core_gdbarch = NULL; + static void core_files_info (struct target_ops *); #ifdef SOLIB_ADD @@ -124,6 +134,10 @@ sniff_core_bfd (bfd *abfd) struct core_fns *yummy = NULL; int matches = 0;; + /* Don't sniff if we have support for register sets in CORE_GDBARCH. */ + if (core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch)) + return NULL; + for (cf = core_file_fns; cf != NULL; cf = cf->next) { if (cf->core_sniffer (cf, abfd)) @@ -179,7 +193,6 @@ gdb_check_format (bfd *abfd) /* Discard all vestiges of any previous core file and mark data and stack spaces as empty. */ -/* ARGSUSED */ static void core_close (int quitting) { @@ -209,6 +222,7 @@ core_close (int quitting) } } core_vec = NULL; + core_gdbarch = NULL; } static void @@ -311,6 +325,14 @@ core_open (char *filename, int from_tty) core_bfd = temp_bfd; old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/); + /* FIXME: kettenis/20031023: This is very dangerous. The + CORE_GDBARCH that results from this call may very well be + different from CURRENT_GDBARCH. However, its methods may only + work if it is selected as the current architecture, because they + rely on swapped data (see gdbarch.c). We should get rid of that + swapped data. */ + core_gdbarch = gdbarch_from_bfd (core_bfd); + /* Find a suitable core file handler to munch on core_bfd */ core_vec = sniff_core_bfd (core_bfd); @@ -410,7 +432,7 @@ get_core_register_section (char *name, int required) { char section_name[100]; - sec_ptr section; + struct bfd_section *section; bfd_size_type size; char *contents; @@ -437,6 +459,24 @@ get_core_register_section (char *name, return; } + if (core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch)) + { + const struct regset *regset; + + regset = gdbarch_regset_from_core_section (core_gdbarch, name, size); + if (regset == NULL) + { + if (required) + warning ("Couldn't recognize %s registers in core file.\n", + human_name); + return; + } + + regset->supply_regset (regset, current_regcache, -1, contents, size); + return; + } + + gdb_assert (core_vec); core_vec->core_read_registers (contents, size, which, ((CORE_ADDR) bfd_section_vma (core_bfd, section))); @@ -449,14 +489,13 @@ get_core_register_section (char *name, /* We just get all the registers, so we don't use regno. */ -/* ARGSUSED */ static void get_core_registers (int regno) { int status; - if (core_vec == NULL - || core_vec->core_read_registers == NULL) + if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch)) + && (core_vec == NULL || core_vec->core_read_registers == NULL)) { fprintf_filtered (gdb_stderr, "Can't fetch registers from this type of core file\n"); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 89f54cf..6c5483b 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -501,10 +501,10 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, /* We only want to know the end of the prologue when fi->saved_regs == 0. When the saved registers are allocated full information is required. */ - if (get_frame_saved_regs (fi)) + if (deprecated_get_frame_saved_regs (fi)) { for (regno = 0; regno < NUM_REGS; regno++) - get_frame_saved_regs (fi)[regno] = 0; + deprecated_get_frame_saved_regs (fi)[regno] = 0; } /* Find the prologue instructions. */ @@ -676,34 +676,34 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, /* We only want to know the end of the prologue when fi->saved_regs == 0. */ - if (!get_frame_saved_regs (fi)) + if (!deprecated_get_frame_saved_regs (fi)) return ip; if (have_fp) { - get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] = get_frame_base (fi); + deprecated_get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] = get_frame_base (fi); /* Calculate the addresses. */ for (regno = regsave; regno >= 0; regno--) { - get_frame_saved_regs (fi)[regno] = get_frame_base (fi) - val; + deprecated_get_frame_saved_regs (fi)[regno] = get_frame_base (fi) - val; val -= 4; } if (get_frame_extra_info (fi)->leaf_function) { /* Set the register SP to contain the stack pointer of the caller. */ - get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 4; + deprecated_get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 4; } else { /* Set the register SP to contain the stack pointer of the caller. */ - get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 8; + deprecated_get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) + 8; /* Set the register SRP to contain the return address of the caller. */ - get_frame_saved_regs (fi)[SRP_REGNUM] = get_frame_base (fi) + 4; + deprecated_get_frame_saved_regs (fi)[SRP_REGNUM] = get_frame_base (fi) + 4; } } return ip; @@ -1151,7 +1151,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) int frameless_p = 0; /* Has this frame's registers already been initialized? */ - if (get_frame_saved_regs (fi)) + if (deprecated_get_frame_saved_regs (fi)) return; frame_saved_regs_zalloc (fi); @@ -1161,7 +1161,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) /* I don't see this ever happening, considering the context in which cris_frame_init_saved_regs is called (always when we're not in a dummy frame). */ - memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); + memcpy (deprecated_get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); } else { @@ -1219,12 +1219,12 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Check fromleaf/frameless_function_invocation. (FIXME) */ - if (get_frame_saved_regs (fi)[SRP_REGNUM] != 0) + if (deprecated_get_frame_saved_regs (fi)[SRP_REGNUM] != 0) { /* SRP was saved on the stack; non-leaf function. */ get_frame_extra_info (fi)->return_pc = - read_memory_integer (get_frame_saved_regs (fi)[SRP_REGNUM], - REGISTER_RAW_SIZE (SRP_REGNUM)); + read_memory_integer (deprecated_get_frame_saved_regs (fi)[SRP_REGNUM], + DEPRECATED_REGISTER_RAW_SIZE (SRP_REGNUM)); } else { @@ -1527,30 +1527,30 @@ cris_pop_frame (void) after SP was saved. */ for (regno = 0; regno < DEPRECATED_FP_REGNUM; regno++) { - if (get_frame_saved_regs (fi)[regno]) + if (deprecated_get_frame_saved_regs (fi)[regno]) { write_register (regno, - read_memory_integer (get_frame_saved_regs (fi)[regno], 4)); + read_memory_integer (deprecated_get_frame_saved_regs (fi)[regno], 4)); } } - if (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM]) + if (deprecated_get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM]) { /* Pop the frame pointer (R8). It was pushed before SP was saved. */ write_register (DEPRECATED_FP_REGNUM, - read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4)); + read_memory_integer (deprecated_get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4)); stack_offset += 4; /* Not a leaf function. */ - if (get_frame_saved_regs (fi)[SRP_REGNUM]) + if (deprecated_get_frame_saved_regs (fi)[SRP_REGNUM]) { /* SRP was pushed before SP was saved. */ stack_offset += 4; } /* Restore the SP and adjust for R8 and (possibly) SRP. */ - write_register (SP_REGNUM, get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] + stack_offset); + write_register (SP_REGNUM, deprecated_get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] + stack_offset); } else { @@ -3916,7 +3916,7 @@ cris_version_update (char *ignore_args, int from_tty, the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command - callbacks. Unfortunatly, for ``show'' commands cloned from + callbacks. Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ @@ -3943,7 +3943,7 @@ cris_mode_update (char *ignore_args, int from_tty, the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command - callbacks. Unfortunatly, for ``show'' commands cloned from + callbacks. Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ @@ -3970,7 +3970,7 @@ cris_abi_update (char *ignore_args, int from_tty, the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command - callbacks. Unfortunatly, for ``show'' commands cloned from + callbacks. Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ @@ -4126,7 +4126,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); tdep->cris_version = cris_version; tdep->cris_mode = cris_mode; @@ -4184,8 +4184,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, cris_register_name); - /* Length of ordinary registers used in push_word and a few other places. - REGISTER_RAW_SIZE is the real way to know how big a register is. */ + /* Length of ordinary registers used in push_word and a few other + places. DEPRECATED_REGISTER_RAW_SIZE is the real way to know how + big a register is. */ set_gdbarch_deprecated_register_size (gdbarch, 4); /* NEW */ @@ -4239,13 +4240,13 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* The length of the registers in the actual machine representation. */ set_gdbarch_deprecated_register_raw_size (gdbarch, cris_register_size); - /* The largest value REGISTER_RAW_SIZE can have. */ + /* The largest value DEPRECATED_REGISTER_RAW_SIZE can have. */ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 32); /* The length of the registers in the program's representation. */ set_gdbarch_deprecated_register_virtual_size (gdbarch, cris_register_size); - /* The largest value REGISTER_VIRTUAL_SIZE can have. */ + /* The largest value DEPRECATED_REGISTER_VIRTUAL_SIZE can have. */ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 32); set_gdbarch_deprecated_register_virtual_type (gdbarch, cris_register_virtual_type); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 129f563..6ad5ed5 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1,4 +1,4 @@ -/* Target-dependent code for Mitsubishi D10V, for GDB. +/* Target-dependent code for Renesas D10V, for GDB. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -57,7 +57,7 @@ struct gdbarch_tdep }; /* These are the addresses the D10V-EVA board maps data and - instruction memory to. */ + instruction memory to. */ enum memspace { DMEM_START = 0x2000000, @@ -65,7 +65,7 @@ enum memspace { STACK_START = 0x200bffe }; -/* d10v register names. */ +/* d10v register names. */ enum { @@ -80,10 +80,9 @@ enum NR_A_REGS = 2, TS2_NUM_REGS = 37, TS3_NUM_REGS = 42, - /* d10v calling convention. */ + /* d10v calling convention. */ ARG1_REGNUM = R0_REGNUM, - ARGN_REGNUM = R3_REGNUM, - RET1_REGNUM = R0_REGNUM, + ARGN_REGNUM = R3_REGNUM }; static int @@ -114,44 +113,6 @@ d10v_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) return sp & ~3; } -/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of - EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc - and TYPE is the type (which is known to be struct, union or array). - - The d10v returns anything less than 8 bytes in size in - registers. */ - -static int -d10v_use_struct_convention (int gcc_p, struct type *type) -{ - long alignment; - int i; - /* The d10v only passes a struct in a register when that structure - has an alignment that matches the size of a register. */ - /* If the structure doesn't fit in 4 registers, put it on the - stack. */ - if (TYPE_LENGTH (type) > 8) - return 1; - /* If the struct contains only one field, don't put it on the stack - - gcc can fit it in one or more registers. */ - if (TYPE_NFIELDS (type) == 1) - return 0; - alignment = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)); - for (i = 1; i < TYPE_NFIELDS (type); i++) - { - /* If the alignment changes, just assume it goes on the - stack. */ - if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)) != alignment) - return 1; - } - /* If the alignment is suitable for the d10v's 16 bit registers, - don't put it on the stack. */ - if (alignment == 2 || alignment == 4) - return 0; - return 1; -} - - static const unsigned char * d10v_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { @@ -162,7 +123,7 @@ d10v_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) } /* Map the REG_NR onto an ascii name. Return NULL or an empty string - when the reg_nr isn't valid. */ + when the reg_nr isn't valid. */ enum ts2_regnums { @@ -279,7 +240,7 @@ d10v_ts3_imap_register (void *regcache, int reg_nr) /* MAP GDB's internal register numbering (determined by the layout from the DEPRECATED_REGISTER_BYTE array) onto the simulator's - register numbering. */ + register numbering. */ static int d10v_ts2_register_sim_regno (int nr) @@ -353,7 +314,7 @@ static CORE_ADDR d10v_make_iaddr (CORE_ADDR x) { if (d10v_iaddr_p (x)) - return x; /* Idempotency -- x is already in the IMEM space. */ + return x; /* Idempotency -- x is already in the IMEM space. */ else return (((x) << 2) | IMEM_START); } @@ -413,54 +374,88 @@ d10v_integer_to_address (struct type *type, void *buf) return val; } -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. - - Things always get returned in RET1_REGNUM, RET2_REGNUM, ... */ +/* Handle the d10v's return_value convention. */ -static void -d10v_store_return_value (struct type *type, struct regcache *regcache, - const void *valbuf) +static enum return_value_convention +d10v_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) { - /* Only char return values need to be shifted right within the first - regnum. */ - if (TYPE_LENGTH (type) == 1 - && TYPE_CODE (type) == TYPE_CODE_INT) + if (TYPE_LENGTH (valtype) > 8) + /* Anything larger than 8 bytes (4 registers) goes on the stack. */ + return RETURN_VALUE_STRUCT_CONVENTION; + if (TYPE_LENGTH (valtype) == 5 + || TYPE_LENGTH (valtype) == 6) + /* Anything 5 or 6 bytes in size goes in memory. Contents don't + appear to matter. Note that 7 and 8 byte objects do end up in + registers! */ + return RETURN_VALUE_STRUCT_CONVENTION; + if (TYPE_LENGTH (valtype) == 1) { - bfd_byte tmp[2]; - tmp[1] = *(bfd_byte *)valbuf; - regcache_cooked_write (regcache, RET1_REGNUM, tmp); + /* All single byte values go in a register stored right-aligned. + Note: 2 byte integer values are handled further down. */ + if (readbuf) + { + /* Since TYPE is smaller than the register, there isn't a + sign extension problem. Let the extraction truncate the + register value. */ + ULONGEST regval; + regcache_cooked_read_unsigned (regcache, R0_REGNUM, + ®val); + store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), regval); + + } + if (writebuf) + { + ULONGEST regval; + if (TYPE_CODE (valtype) == TYPE_CODE_INT) + /* Some sort of integer value stored in R0. Use + unpack_long since that should handle any required sign + extension. */ + regval = unpack_long (valtype, writebuf); + else + /* Some other type. Don't sign-extend the value when + storing it in the register. */ + regval = extract_unsigned_integer (writebuf, 1); + regcache_cooked_write_unsigned (regcache, R0_REGNUM, regval); + } + return RETURN_VALUE_REGISTER_CONVENTION; } - else + if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT + || TYPE_CODE (valtype) == TYPE_CODE_UNION) + && TYPE_NFIELDS (valtype) > 1 + && TYPE_FIELD_BITPOS (valtype, 1) == 8) + /* If a composite is 8 bit aligned (determined by looking at the + start address of the second field), put it in memory. */ + return RETURN_VALUE_STRUCT_CONVENTION; + /* Assume it is in registers. */ + if (writebuf || readbuf) { int reg; - /* A structure is never more than 8 bytes long. See - use_struct_convention(). */ - gdb_assert (TYPE_LENGTH (type) <= 8); - /* Write out most registers, stop loop before trying to write - out any dangling byte at the end of the buffer. */ - for (reg = 0; (reg * 2) + 1 < TYPE_LENGTH (type); reg++) + /* Per above, the value is never more than 8 bytes long. */ + gdb_assert (TYPE_LENGTH (valtype) <= 8); + /* Xfer 2 bytes at a time. */ + for (reg = 0; (reg * 2) + 1 < TYPE_LENGTH (valtype); reg++) { - regcache_cooked_write (regcache, RET1_REGNUM + reg, - (bfd_byte *) valbuf + reg * 2); + if (readbuf) + regcache_cooked_read (regcache, R0_REGNUM + reg, + (bfd_byte *) readbuf + reg * 2); + if (writebuf) + regcache_cooked_write (regcache, R0_REGNUM + reg, + (bfd_byte *) writebuf + reg * 2); + } + /* Any trailing byte ends up _left_ aligned. */ + if ((reg * 2) < TYPE_LENGTH (valtype)) + { + if (readbuf) + regcache_cooked_read_part (regcache, R0_REGNUM + reg, + 0, 1, (bfd_byte *) readbuf + reg * 2); + if (writebuf) + regcache_cooked_write_part (regcache, R0_REGNUM + reg, + 0, 1, (bfd_byte *) writebuf + reg * 2); } - /* Write out any dangling byte at the end of the buffer. */ - if ((reg * 2) + 1 == TYPE_LENGTH (type)) - regcache_cooked_write_part (regcache, reg, 0, 1, - (bfd_byte *) valbuf + reg * 2); } -} - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -static CORE_ADDR -d10v_extract_struct_value_address (struct regcache *regcache) -{ - ULONGEST addr; - regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &addr); - return (addr | DMEM_START); + return RETURN_VALUE_REGISTER_CONVENTION; } static int @@ -505,8 +500,8 @@ d10v_skip_prologue (CORE_ADDR pc) CORE_ADDR func_addr, func_end; struct symtab_and_line sal; - /* If we have line debugging information, then the end of the */ - /* prologue should the first assembly instruction of the first source line */ + /* If we have line debugging information, then the end of the prologue + should be the first assembly instruction of the first source line. */ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) { sal = find_pc_line (func_addr, 0); @@ -515,7 +510,7 @@ d10v_skip_prologue (CORE_ADDR pc) } if (target_read_memory (pc, (char *) &op, 4)) - return pc; /* Can't access it -- assume no prologue. */ + return pc; /* Can't access it -- assume no prologue. */ while (1) { @@ -545,8 +540,9 @@ d10v_skip_prologue (CORE_ADDR pc) { if (!check_prologue (op2)) { - /* if the previous opcode was really part of the prologue */ - /* and not just a NOP, then we want to break after both instructions */ + /* If the previous opcode was really part of the + prologue and not just a NOP, then we want to + break after both instructions. */ if (op1 != 0x5E00) pc += 4; break; @@ -657,7 +653,7 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, 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. */ + for it IS the sp for the next frame. */ static struct d10v_unwind_cache * d10v_frame_unwind_cache (struct frame_info *next_frame, @@ -795,11 +791,11 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { ULONGEST pc, psw, rpt_s, rpt_e, rpt_c; - frame_read_unsigned_register (frame, D10V_PC_REGNUM, &pc); - frame_read_unsigned_register (frame, PSW_REGNUM, &psw); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_s", -1), &rpt_s); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_e", -1), &rpt_e); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_c", -1), &rpt_c); + pc = get_frame_register_unsigned (frame, D10V_PC_REGNUM); + psw = get_frame_register_unsigned (frame, PSW_REGNUM); + rpt_s = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_s", -1)); + rpt_e = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_e", -1)); + rpt_c = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_c", -1)); fprintf_filtered (file, "PC=%04lx (0x%lx) PSW=%04lx RPT_S=%04lx RPT_E=%04lx RPT_C=%04lx\n", (long) pc, (long) d10v_make_iaddr (pc), (long) psw, (long) rpt_s, (long) rpt_e, (long) rpt_c); @@ -814,7 +810,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, for (r = group; r < group + 8; r++) { ULONGEST tmp; - frame_read_unsigned_register (frame, r, &tmp); + tmp = get_frame_register_unsigned (frame, r); fprintf_filtered (file, " %04lx", (long) tmp); } fprintf_filtered (file, "\n"); @@ -856,7 +852,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { int i; fprintf_filtered (file, " "); - frame_read_register (frame, a, num); + get_frame_register (frame, a, num); for (i = 0; i < register_size (gdbarch, a); i++) { fprintf_filtered (file, "%02x", (num[i] & 0xff)); @@ -908,7 +904,7 @@ d10v_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) } /* When arguments must be pushed onto the stack, they go on in reverse - order. The below implements a FILO (stack) to do this. */ + order. The below implements a FILO (stack) to do this. */ struct stack_item { @@ -965,8 +961,8 @@ d10v_push_dummy_code (struct gdbarch *gdbarch, static CORE_ADDR d10v_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, - int nargs, struct value **args, CORE_ADDR sp, int struct_return, - CORE_ADDR struct_addr) + int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) { int i; int regnum = ARG1_REGNUM; @@ -1042,51 +1038,11 @@ d10v_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, return sp; } - -/* Given a return value in `regbuf' with a type `valtype', - extract and copy its value into `valbuf'. */ - -static void -d10v_extract_return_value (struct type *type, struct regcache *regcache, - void *valbuf) -{ - int len; - if (TYPE_LENGTH (type) == 1) - { - ULONGEST c; - regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &c); - store_unsigned_integer (valbuf, 1, c); - } - else - { - /* For return values of odd size, the first byte is in the - least significant part of the first register. The - remaining bytes in remaining registers. Interestingly, when - such values are passed in, the last byte is in the most - significant byte of that same register - wierd. */ - int reg = RET1_REGNUM; - int off = 0; - if (TYPE_LENGTH (type) & 1) - { - regcache_cooked_read_part (regcache, RET1_REGNUM, 1, 1, - (bfd_byte *)valbuf + off); - off++; - reg++; - } - /* Transfer the remaining registers. */ - for (; off < TYPE_LENGTH (type); reg++, off += 2) - { - regcache_cooked_read (regcache, RET1_REGNUM + reg, - (bfd_byte *) valbuf + off); - } - } -} - /* Translate a GDB virtual ADDR/LEN into a format the remote target understands. Returns number of bytes that can be transfered starting at TARG_ADDR. Return ZERO if no bytes can be transfered (segmentation fault). Since the simulator knows all about how the - VM system works, we just call that to do the translation. */ + VM system works, we just call that to do the translation. */ static void remote_d10v_translate_xfer_address (struct gdbarch *gdbarch, @@ -1313,7 +1269,8 @@ tdisassemble_command (char *arg, int from_tty) } } - printf_filtered ("Dump of trace from %s to %s:\n", paddr_u (low), paddr_u (high)); + printf_filtered ("Dump of trace from %s to %s:\n", + paddr_u (low), paddr_u (high)); display_trace (low, high); @@ -1403,11 +1360,6 @@ d10v_frame_this_id (struct frame_info *next_frame, /* 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 || deprecated_inside_entry_file (func)) - 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". */ @@ -1483,13 +1435,13 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_register_name_ftype *d10v_register_name; gdbarch_register_sim_regno_ftype *d10v_register_sim_regno; - /* Find a candidate among the list of pre-declared architectures. */ + /* Find a candidate among the list of pre-declared architectures. */ arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; /* None found, create a new architecture from the information - provided. */ + provided. */ tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); @@ -1535,7 +1487,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); /* NOTE: The d10v as a 32 bit ``float'' and ``double''. ``long - double'' is 64 bits. */ + double'' is 64 bits. */ set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); @@ -1549,19 +1501,17 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) case BFD_ENDIAN_LITTLE: set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little); set_gdbarch_double_format (gdbarch, &floatformat_ieee_single_little); - set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_little); + set_gdbarch_long_double_format (gdbarch, + &floatformat_ieee_double_little); break; default: internal_error (__FILE__, __LINE__, "d10v_gdbarch_init: bad byte order for float format"); } - set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); + set_gdbarch_return_value (gdbarch, d10v_return_value); set_gdbarch_push_dummy_code (gdbarch, d10v_push_dummy_code); 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); set_gdbarch_skip_prologue (gdbarch, d10v_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -1569,10 +1519,12 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, d10v_breakpoint_from_pc); - set_gdbarch_remote_translate_xfer_address (gdbarch, remote_d10v_translate_xfer_address); + set_gdbarch_remote_translate_xfer_address (gdbarch, + remote_d10v_translate_xfer_address); set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); + set_gdbarch_frameless_function_invocation (gdbarch, + frameless_look_for_prologue); set_gdbarch_frame_align (gdbarch, d10v_frame_align); @@ -1604,7 +1556,8 @@ _initialize_d10v_tdep (void) target_resume_hook = d10v_eva_prepare_to_trace; target_wait_loop_hook = d10v_eva_get_trace_data; - deprecate_cmd (add_com ("regs", class_vars, show_regs, "Print all registers"), + deprecate_cmd (add_com ("regs", class_vars, show_regs, + "Print all registers"), "info registers"); add_com ("itrace", class_support, trace_command, diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 6ed23c6..59c5d79 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -258,10 +258,6 @@ static int bincls_allocated; extern void _initialize_dbxread (void); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE static void process_now (struct objfile *); -#endif /* OBSOLETE CFront */ - static void read_ofile_symtab (struct partial_symtab *); static void dbx_psymtab_to_symtab (struct partial_symtab *); @@ -356,7 +352,7 @@ add_old_header_file (char *name, int instance) int i; for (i = 0; i < N_HEADER_FILES (current_objfile); i++) - if (STREQ (p[i].name, name) && instance == p[i].instance) + if (strcmp (p[i].name, name) == 0 && instance == p[i].instance) { add_this_object_header_file (i); return; @@ -773,107 +769,6 @@ static struct external_nlist symbuf[4096]; static int symbuf_idx; static int symbuf_end; -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* cont_elem is used for continuing information in cfront. -// OBSOLETE It saves information about which types need to be fixed up and -// OBSOLETE completed after all the stabs are read. */ -// OBSOLETE struct cont_elem -// OBSOLETE { -// OBSOLETE /* sym and stabstring for continuing information in cfront */ -// OBSOLETE struct symbol *sym; -// OBSOLETE char *stabs; -// OBSOLETE /* state dependencies (statics that must be preserved) */ -// OBSOLETE int sym_idx; -// OBSOLETE int sym_end; -// OBSOLETE int symnum; -// OBSOLETE int (*func) (struct objfile *, struct symbol *, char *); -// OBSOLETE /* other state dependencies include: -// OBSOLETE (assumption is that these will not change since process_now FIXME!!) -// OBSOLETE stringtab_global -// OBSOLETE n_stabs -// OBSOLETE objfile -// OBSOLETE symfile_bfd */ -// OBSOLETE }; - -// OBSOLETE static struct cont_elem *cont_list = 0; -// OBSOLETE static int cont_limit = 0; -// OBSOLETE static int cont_count = 0; - -// OBSOLETE /* Arrange for function F to be called with arguments SYM and P later -// OBSOLETE in the stabs reading process. */ -// OBSOLETE void -// OBSOLETE process_later (struct symbol *sym, char *p, -// OBSOLETE int (*f) (struct objfile *, struct symbol *, char *)) -// OBSOLETE { - -// OBSOLETE /* Allocate more space for the deferred list. */ -// OBSOLETE if (cont_count >= cont_limit - 1) -// OBSOLETE { -// OBSOLETE cont_limit += 32; /* chunk size */ - -// OBSOLETE cont_list -// OBSOLETE = (struct cont_elem *) xrealloc (cont_list, -// OBSOLETE (cont_limit -// OBSOLETE * sizeof (struct cont_elem))); -// OBSOLETE if (!cont_list) -// OBSOLETE error ("Virtual memory exhausted\n"); -// OBSOLETE } - -// OBSOLETE /* Save state variables so we can process these stabs later. */ -// OBSOLETE cont_list[cont_count].sym_idx = symbuf_idx; -// OBSOLETE cont_list[cont_count].sym_end = symbuf_end; -// OBSOLETE cont_list[cont_count].symnum = symnum; -// OBSOLETE cont_list[cont_count].sym = sym; -// OBSOLETE cont_list[cont_count].stabs = p; -// OBSOLETE cont_list[cont_count].func = f; -// OBSOLETE cont_count++; -// OBSOLETE } - -// OBSOLETE /* Call deferred funtions in CONT_LIST. */ - -// OBSOLETE static void -// OBSOLETE process_now (struct objfile *objfile) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE int save_symbuf_idx; -// OBSOLETE int save_symbuf_end; -// OBSOLETE int save_symnum; -// OBSOLETE struct symbol *sym; -// OBSOLETE char *stabs; -// OBSOLETE int err; -// OBSOLETE int (*func) (struct objfile *, struct symbol *, char *); - -// OBSOLETE /* Save the state of our caller, we'll want to restore it before -// OBSOLETE returning. */ -// OBSOLETE save_symbuf_idx = symbuf_idx; -// OBSOLETE save_symbuf_end = symbuf_end; -// OBSOLETE save_symnum = symnum; - -// OBSOLETE /* Iterate over all the deferred stabs. */ -// OBSOLETE for (i = 0; i < cont_count; i++) -// OBSOLETE { -// OBSOLETE /* Restore the state for this deferred stab. */ -// OBSOLETE symbuf_idx = cont_list[i].sym_idx; -// OBSOLETE symbuf_end = cont_list[i].sym_end; -// OBSOLETE symnum = cont_list[i].symnum; -// OBSOLETE sym = cont_list[i].sym; -// OBSOLETE stabs = cont_list[i].stabs; -// OBSOLETE func = cont_list[i].func; - -// OBSOLETE /* Call the function to handle this deferrd stab. */ -// OBSOLETE err = (*func) (objfile, sym, stabs); -// OBSOLETE if (err) -// OBSOLETE error ("Internal error: unable to resolve stab.\n"); -// OBSOLETE } - -// OBSOLETE /* Restore our caller's state. */ -// OBSOLETE symbuf_idx = save_symbuf_idx; -// OBSOLETE symbuf_end = save_symbuf_end; -// OBSOLETE symnum = save_symnum; -// OBSOLETE cont_count = 0; -// OBSOLETE } -#endif /* OBSOLETE CFront */ - /* Name of last function encountered. Used in Solaris to approximate object file boundaries. */ static char *last_function_name; @@ -1040,7 +935,7 @@ find_corresponding_bincl_psymtab (char *name, int instance) for (bincl = bincl_list; bincl < next_bincl; bincl++) if (bincl->instance == instance - && STREQ (name, bincl->name)) + && strcmp (name, bincl->name) == 0) return bincl->pst; repeated_header_complaint (name, symnum); @@ -1712,12 +1607,12 @@ read_dbx_symtab (struct objfile *objfile) things like "break c-exp.y:435" need to work (I suppose the psymtab_include_list could be hashed or put in a binary tree, if profiling shows this is a major hog). */ - if (pst && STREQ (namestring, pst->filename)) + if (pst && strcmp (namestring, pst->filename) == 0) continue; { int i; for (i = 0; i < includes_used; i++) - if (STREQ (namestring, psymtab_include_list[i])) + if (strcmp (namestring, psymtab_include_list[i]) == 0) { i = -1; break; @@ -1838,22 +1733,6 @@ read_dbx_symtab (struct objfile *objfile) psymtab_language, objfile); p += 1; } -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* The semantics of C++ state that "struct foo { ... }" -// OBSOLETE also defines a typedef for "foo". Unfortuantely, cfront -// OBSOLETE never makes the typedef when translating from C++ to C. -// OBSOLETE We make the typedef here so that "ptype foo" works as -// OBSOLETE expected for cfront translated code. */ -// OBSOLETE else if (psymtab_language == language_cplus) -// OBSOLETE { -// OBSOLETE /* Also a typedef with the same name. */ -// OBSOLETE add_psymbol_to_list (namestring, p - namestring, -// OBSOLETE VAR_DOMAIN, LOC_TYPEDEF, -// OBSOLETE &objfile->static_psymbols, -// OBSOLETE nlist.n_value, 0, -// OBSOLETE psymtab_language, objfile); -// OBSOLETE } -#endif /* OBSOLETE CFront */ } goto check_enum; case 't': @@ -2088,11 +1967,6 @@ read_dbx_symtab (struct objfile *objfile) case '9': case '-': case '#': /* for symbol identification (used in live ranges) */ -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* added to support cfront stabs strings */ -// OBSOLETE case 'Z': /* for definition continuations */ -// OBSOLETE case 'P': /* for prototypes */ -#endif /* OBSOLETE CFront */ continue; case ':': @@ -2764,11 +2638,6 @@ read_ofile_symtab (struct partial_symtab *pst) pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* Process items which we had to "process_later" due to dependencies -// OBSOLETE on other stabs. */ -// OBSOLETE process_now (objfile); -#endif /* OBSOLETE CFront */ end_stabs (); } @@ -3300,12 +3169,12 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, int l = colon_pos - name; m = lookup_minimal_symbol_by_pc (last_pc_address); - if (m && STREQN (DEPRECATED_SYMBOL_NAME (m), name, l) + if (m && strncmp (DEPRECATED_SYMBOL_NAME (m), name, l) == 0 && DEPRECATED_SYMBOL_NAME (m)[l] == '\0') /* last_pc_address was in this function */ valu = SYMBOL_VALUE (m); else if (m && DEPRECATED_SYMBOL_NAME (m + 1) - && STREQN (DEPRECATED_SYMBOL_NAME (m + 1), name, l) + && strncmp (DEPRECATED_SYMBOL_NAME (m + 1), name, l) == 0 && DEPRECATED_SYMBOL_NAME (m + 1)[l] == '\0') /* last_pc_address was in last function */ valu = SYMBOL_VALUE (m + 1); @@ -3360,7 +3229,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, case N_OPT: /* Solaris 2: Compiler options */ if (name) { - if (STREQ (name, GCC2_COMPILED_FLAG_SYMBOL)) + if (strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0) { processing_gcc_compilation = 2; #if 0 /* Works, but is experimental. -fnf */ @@ -230,6 +230,21 @@ enum auto_boolean AUTO_BOOLEAN_AUTO }; +/* Potential ways that a function can return a value of a given type. */ +enum return_value_convention +{ + /* Where the return value has been squeezed into one or more + registers. */ + RETURN_VALUE_REGISTER_CONVENTION, + /* Commonly known as the "struct return convention". The caller + passes an additional hidden first parameter to the caller. That + parameter contains the address at which the value being returned + should be stored. While typically, and historically, used for + large structs, this is convention is applied to values of many + different types. */ + RETURN_VALUE_STRUCT_CONVENTION +}; + /* the cleanup list records things that have to be undone if an error happens (descriptors to be closed, memory to be freed, etc.) Each link in the chain records a function to call and an @@ -853,9 +868,10 @@ extern void xmfree (void *md, void *ptr); "libiberty.h". */ extern void xfree (void *); -/* Utility macros to allocate typed memory. Avoids errors like - ``struct foo *foo = xmalloc (sizeof bar)'' and ``struct foo *foo = - (struct foo *) xmalloc (sizeof bar)''. */ +/* Utility macros to allocate typed memory. Avoids errors like: + struct foo *foo = xmalloc (sizeof struct bar); and memset (foo, + sizeof (struct foo), 0). */ +#define XZALLOC(TYPE) ((TYPE*) memset (xmalloc (sizeof (TYPE)), 0, sizeof (TYPE))) #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) #define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE))) @@ -1264,4 +1280,36 @@ extern int use_windows; #define ISATTY(FP) (isatty (fileno (FP))) #endif +/* Ensure that V is aligned to an N byte boundary (B's assumed to be a + power of 2). Round up/down when necessary. Examples of correct + use include: + + addr = align_up (addr, 8); -- VALUE needs 8 byte alignment + write_memory (addr, value, len); + addr += len; + + and: + + sp = align_down (sp - len, 16); -- Keep SP 16 byte aligned + write_memory (sp, value, len); + + Note that uses such as: + + write_memory (addr, value, len); + addr += align_up (len, 8); + + and: + + sp -= align_up (len, 8); + write_memory (sp, value, len); + + are typically not correct as they don't ensure that the address (SP + or ADDR) is correctly aligned (relying on previous alignment to + keep things right). This is also why the methods are called + "align_..." instead of "round_..." as the latter reads better with + this incorrect coding style. */ + +extern ULONGEST align_up (ULONGEST v, int n); +extern ULONGEST align_down (ULONGEST v, int n); + #endif /* #ifndef DEFS_H */ diff --git a/gdb/disasm.c b/gdb/disasm.c index 5f4d07a..20d0ab3 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -337,7 +337,7 @@ gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) /* NOTE: cagney/2003-04-28: The original code, from the old Insight disassembler had a local optomization here. By default it would access the executable file, instead of the target memory (there - was a growing list of exceptions though). Unfortunatly, the + was a growing list of exceptions though). Unfortunately, the heuristic was flawed. Commands like "disassemble &variable" didn't work as they relied on the access going to the target. Further, it has been supperseeded by trust-read-only-sections diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index ce378b4..1bd7401 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,124 @@ +2003-11-11 Elena Zannoni <ezannoni@redhat.com> + + * stabs.texinfo: Add dircategory and direntry commands. + * annotate.texinfo: Ditto. + +2003-11-10 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Replace the + return_value method's "inval" and "outval" parameters with + "readbuf" and "writebuf". + +2003-10-28 Jim Blandy <jimb@redhat.com> + + * gdb.texinfo (The F request packet, The F reply packet): Renamed + from "The `F' request packet" and "The `F' reply packet", to make + texi2dvi happy. + (File-I/O remote protocol extension): Update menu entries, too. + +2003-10-26 Michael Chastain <mec@shout.net> + + * gdb.texinfo (Thread Stops): Document the issue with + premature return from system calls in multi-threaded programs. + +2003-10-24 Andrew Cagney <cagney@redhat.com> + + * annotate.texinfo: Fix "fortunatly"[sic]. + +2003-10-23 Kei Sakamoto <sakamoto.kei@renesas.com> + + * gdb.texinfo (Contributors to GDB): Replace "Renesas" + with "Hitachi" and "Mitsubishi". + +2003-10-20 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Document + gdbarch_return_value. Add cross references from + USE_STRUCT_CONVENTION, EXTRACT_RETURN_VALUE, and + STORE_RETURN_VALUE, and from/to EXTRACT_STRUCT_VALUE_ADDRESS. + +2003-10-18 Mark Kettenis <kettenis@gnu.org> + + * gdbint.texinfo (Target Architecture Definition): Document + regset_from_core_section. + +2003-10-16 Kei Sakamot Sakamoto <sakamoto.kei@renesas.com> + + * gdb.texinfo (M32R/D): Mention m32rsdi target. + +2003-10-15 Kevin Buettner <kevinb@redhat.com> + + From Anthony Green <green@redhat.com>: + * gdb.texinfo (Breakpoints related warnings): Insert into menu. + +2003-10-14 Kevin Buettner <kevinb@redhat.com> + + * gdb.texinfo (Breakpoint related warnings): New node. + * gdbint.texinfo (ADJUST_BREAKPOINT_ADDRESS): Document. + +2003-10-13 Daniel Jacobowitz <drow@mvista.com> + + * gdb.texinfo (Remote Protocol): Document v and vCont. + +2003-10-10 Kei Sakamoto <sakamoto.kei@renesas.com> + + * gdb.texinfo: Replace "Hitachi" and "Mitsubishi" with "Renesas". + * gdbint.texinfo: Ditto. + +2003-10-09 Andrew Cagney <cagney@redhat.com> + + From 2003-09-18 David Anderson <davea@sgi.com>: + * gdb.texinfo (GDB/MI Symbol Query): Replace "comamnd" with + "command". + +2003-10-03 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Deprecate + IBM6000_TARGET. Mention that it implies an RS/6000 system and not + just target. + +2003-10-02 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Rename + REGISTER_RAW_SIZE to DEPRECATED_REGISTER_RAW_SIZE. + * gdb.texinfo (Packets, Stop Reply Packets): Ditto. + * gdbint.texinfo (Target Architecture Definition): Rename + +2003-09-30 Andrew Cagney <cagney@redhat.com> + + REGISTER_VIRTUAL_SIZE to DEPRECATED_REGISTER_VIRTUAL_SIZE. + (Target Architecture Definition): + + * gdbint.texinfo (Target Architecture Definition): Rename + REGISTER_VIRTUAL_TYPE to DEPRECATED_REGISTER_VIRTUAL_TYPE. + +2003-09-29 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + documentation for NEED_TEXT_START_END. + + * gdbint.texinfo (Target Architecture Definition): Rename + NPC_REGNUM to DEPRECATED_NPC_REGNUM. Add cross reference to + TARGET_WRITE_PC. + +2003-09-22 Michael Chastain <mec@shout.net> + + * gdbint.texinfo (Testsuite Organization): Change gdb.c++ to gdb.cp. + +2003-09-21 Anthony Green <green@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Fix typos. + +2003-09-21 Mark Kettenis <kettenis@gnu.org> + + * gdbint.texinfo (Target Architecture Definition): Document + stabs_argument_has_addr. + +2003-09-18 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + documentation on REGISTER_NAMES. + 2003-09-13 Mark Kettenis <kettenis@gnu.org> * gdbint.texinfo (Target Architecture Definition): Replace diff --git a/gdb/doc/annotate.texinfo b/gdb/doc/annotate.texinfo index 401657d..901c6e1 100644 --- a/gdb/doc/annotate.texinfo +++ b/gdb/doc/annotate.texinfo @@ -1,6 +1,14 @@ \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename annotate.info + +@c This is a dir.info fragment to support semi-automated addition of +@c manuals to an info tree. +@dircategory Programming & development tools. +@direntry +* Annotate: (annotate). The obsolete annotation interface. +@end direntry + @c @include gdb-cfg.texi @c @@ -146,7 +154,7 @@ This chapter discusses the known problems. @section Dependant on @sc{cli} output The annotation interface works by interspersing markups with -@value{GDBN} normal command-line interpreter output. Unfortunatly, this +@value{GDBN} normal command-line interpreter output. Unfortunately, this makes the annotation client dependant on not just the annotations, but also the @sc{cli} output. This is because the client is forced to assume that specific @value{GDBN} commands provide specific information. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index cf69fd3..f470800 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -418,12 +418,13 @@ Fred Fish wrote most of the support for Unix System Vr4. He also enhanced the command-completion support to cover C@t{++} overloaded symbols. -Hitachi America, Ltd. sponsored the support for H8/300, H8/500, and -Super-H processors. +Hitachi America (now Renesas America), Ltd. sponsored the support for +H8/300, H8/500, and Super-H processors. NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx processors. -Mitsubishi sponsored the support for D10V, D30V, and M32R/D processors. +Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and M32R/D +processors. Toshiba sponsored the support for the TX39 Mips processor. @@ -2441,6 +2442,7 @@ all breakpoint in that range are operated on. * Break Commands:: Breakpoint command lists * Breakpoint Menus:: Breakpoint menus * Error in Breakpoints:: ``Cannot insert breakpoints'' +* Breakpoint related warnings:: ``Breakpoint address adjusted...'' @end menu @node Set Breaks @@ -3309,6 +3311,58 @@ watchpoints it needs to insert. When this message is printed, you need to disable or remove some of the hardware-assisted breakpoints and watchpoints, and then continue. +@node Breakpoint related warnings +@subsection ``Breakpoint address adjusted...'' +@cindex breakpoint address adjusted + +Some processor architectures place constraints on the addresses at +which breakpoints may be placed. For architectures thus constrained, +@value{GDBN} will attempt to adjust the breakpoint's address to comply +with the constraints dictated by the architecture. + +One example of such an architecture is the Fujitsu FR-V. The FR-V is +a VLIW architecture in which a number of RISC-like instructions may be +bundled together for parallel execution. The FR-V architecture +constrains the location of a breakpoint instruction within such a +bundle to the instruction with the lowest address. @value{GDBN} +honors this constraint by adjusting a breakpoint's address to the +first in the bundle. + +It is not uncommon for optimized code to have bundles which contain +instructions from different source statements, thus it may happen that +a breakpoint's address will be adjusted from one source statement to +another. Since this adjustment may significantly alter @value{GDBN}'s +breakpoint related behavior from what the user expects, a warning is +printed when the breakpoint is first set and also when the breakpoint +is hit. + +A warning like the one below is printed when setting a breakpoint +that's been subject to address adjustment: + +@smallexample +warning: Breakpoint address adjusted from 0x00010414 to 0x00010410. +@end smallexample + +Such warnings are printed both for user settable and @value{GDBN}'s +internal breakpoints. If you see one of these warnings, you should +verify that a breakpoint set at the adjusted address will have the +desired affect. If not, the breakpoint in question may be removed and +other breakpoints may be set which will have the desired behavior. +E.g., it may be sufficient to place the breakpoint at a later +instruction. A conditional breakpoint may also be useful in some +cases to prevent the breakpoint from triggering too often. + +@value{GDBN} will also issue a warning when stopping at one of these +adjusted breakpoints: + +@smallexample +warning: Breakpoint 1 address previously adjusted from 0x00010414 +to 0x00010410. +@end smallexample + +When this warning is encountered, it may be too late to take remedial +action except in cases where the breakpoint is hit earlier or more +frequently than expected. @node Continuing and Stepping @section Continuing and stepping @@ -3707,6 +3761,47 @@ allows you to examine the overall state of the program, including switching between threads, without worrying that things may change underfoot. +@cindex thread breakpoints and system calls +@cindex system calls and thread breakpoints +@cindex premature return from system calls +There is an unfortunate side effect. If one thread stops for a +breakpoint, or for some other reason, and another thread is blocked in a +system call, then the system call may return prematurely. This is a +consequence of the interaction between multiple threads and the signals +that @value{GDBN} uses to implement breakpoints and other events that +stop execution. + +To handle this problem, your program should check the return value of +each system call and react appropriately. This is good programming +style anyways. + +For example, do not write code like this: + +@smallexample + sleep (10); +@end smallexample + +The call to @code{sleep} will return early if a different thread stops +at a breakpoint or for some other reason. + +Instead, write this: + +@smallexample + int unslept = 10; + while (unslept > 0) + unslept = sleep (unslept); +@end smallexample + +A system call is allowed to return early, so the system is still +conforming to its specification. But @value{GDBN} does cause your +multi-threaded program to behave differently than it would without +@value{GDBN}. + +Also, @value{GDBN} uses internal breakpoints in the thread library to +monitor certain events such as thread creation and thread destruction. +When such an event happens, a system call in another thread may return +prematurely, even though your program does not appear to stop. + @cindex continuing threads @cindex threads, continuing Conversely, whenever you restart the program, @emph{all} threads start @@ -10481,7 +10576,7 @@ specifies a fixed address. @cindex choosing target byte order @cindex target byte order -Some types of processors, such as the MIPS, PowerPC, and Hitachi SH, +Some types of processors, such as the MIPS, PowerPC, and Renesas SH, offer the ability to run either big-endian or little-endian byte orders. Usually the executable or symbol will include a bit to designate the endian-ness, and you will not need to worry about @@ -10928,9 +11023,9 @@ For Motorola 680x0 architectures. @item sh-stub.c @cindex @file{sh-stub.c} -@cindex Hitachi +@cindex Renesas @cindex SH -For Hitachi SH architectures. +For Renesas SH architectures. @item sparc-stub.c @cindex @file{sparc-stub.c} @@ -11782,15 +11877,15 @@ configurations. @menu * ARM:: ARM -* H8/300:: Hitachi H8/300 -* H8/500:: Hitachi H8/500 -* M32R/D:: Mitsubishi M32R/D +* H8/300:: Renesas H8/300 +* H8/500:: Renesas H8/500 +* M32R/D:: Renesas M32R/D * M68K:: Motorola M68K * MIPS Embedded:: MIPS Embedded * OpenRISC 1000:: OpenRisc 1000 * PA:: HP PA Embedded * PowerPC: PowerPC -* SH:: Hitachi SH +* SH:: Renesas SH * Sparclet:: Tsqware Sparclet * Sparclite:: Fujitsu Sparclite * ST2000:: Tandem ST2000 @@ -11815,50 +11910,50 @@ ARM Demon monitor. @end table @node H8/300 -@subsection Hitachi H8/300 +@subsection Renesas H8/300 @table @code @kindex target hms@r{, with H8/300} @item target hms @var{dev} -A Hitachi SH, H8/300, or H8/500 board, attached via serial line to your host. +A Renesas SH, H8/300, or H8/500 board, attached via serial line to your host. Use special commands @code{device} and @code{speed} to control the serial line and the communications speed used. @kindex target e7000@r{, with H8/300} @item target e7000 @var{dev} -E7000 emulator for Hitachi H8 and SH. +E7000 emulator for Renesas H8 and SH. @kindex target sh3@r{, with H8/300} @kindex target sh3e@r{, with H8/300} @item target sh3 @var{dev} @itemx target sh3e @var{dev} -Hitachi SH-3 and SH-3E target systems. +Renesas SH-3 and SH-3E target systems. @end table @cindex download to H8/300 or H8/500 @cindex H8/300 or H8/500 download -@cindex download to Hitachi SH -@cindex Hitachi SH download -When you select remote debugging to a Hitachi SH, H8/300, or H8/500 -board, the @code{load} command downloads your program to the Hitachi +@cindex download to Renesas SH +@cindex Renesas SH download +When you select remote debugging to a Renesas SH, H8/300, or H8/500 +board, the @code{load} command downloads your program to the Renesas board and also opens it as the current executable target for @value{GDBN} on your host (like the @code{file} command). @value{GDBN} needs to know these things to talk to your -Hitachi SH, H8/300, or H8/500: +Renesas SH, H8/300, or H8/500: @enumerate @item that you want to use @samp{target hms}, the remote debugging interface -for Hitachi microprocessors, or @samp{target e7000}, the in-circuit -emulator for the Hitachi SH and the Hitachi 300H. (@samp{target hms} is -the default when @value{GDBN} is configured specifically for the Hitachi SH, +for Renesas microprocessors, or @samp{target e7000}, the in-circuit +emulator for the Renesas SH and the Renesas 300H. (@samp{target hms} is +the default when @value{GDBN} is configured specifically for the Renesas SH, H8/300, or H8/500.) @item -what serial device connects your host to your Hitachi board (the first +what serial device connects your host to your Renesas board (the first serial device available on your host is the default). @item @@ -11866,24 +11961,24 @@ what speed to use over the serial device. @end enumerate @menu -* Hitachi Boards:: Connecting to Hitachi boards. -* Hitachi ICE:: Using the E7000 In-Circuit Emulator. -* Hitachi Special:: Special @value{GDBN} commands for Hitachi micros. +* Renesas Boards:: Connecting to Renesas boards. +* Renesas ICE:: Using the E7000 In-Circuit Emulator. +* Renesas Special:: Special @value{GDBN} commands for Renesas micros. @end menu -@node Hitachi Boards -@subsubsection Connecting to Hitachi boards +@node Renesas Boards +@subsubsection Connecting to Renesas boards @c only for Unix hosts @kindex device -@cindex serial device, Hitachi micros +@cindex serial device, Renesas micros Use the special @code{@value{GDBN}} command @samp{device @var{port}} if you need to explicitly set the serial device. The default @var{port} is the first available port on your host. This is only necessary on Unix hosts, where it is typically something like @file{/dev/ttya}. @kindex speed -@cindex serial line speed, Hitachi micros +@cindex serial line speed, Renesas micros @code{@value{GDBN}} has another special command to set the communications speed: @samp{speed @var{bps}}. This command also is only used from Unix hosts; on DOS hosts, set the line speed as usual from outside @value{GDBN} with @@ -11891,7 +11986,7 @@ the DOS @code{mode} command (for instance, @w{@kbd{mode com2:9600,n,8,1,p}} for a 9600@dmn{bps} connection). The @samp{device} and @samp{speed} commands are available only when you -use a Unix host to debug your Hitachi microprocessor programs. If you +use a Unix host to debug your Renesas microprocessor programs. If you use a DOS host, @value{GDBN} depends on an auxiliary terminate-and-stay-resident program called @code{asynctsr} to communicate with the development board @@ -11901,7 +11996,7 @@ to set up the serial port on the DOS side. The following sample session illustrates the steps needed to start a program under @value{GDBN} control on an H8/300. The example uses a sample H8/300 program called @file{t.x}. The procedure is the same for -the Hitachi SH and the H8/500. +the Renesas SH and the H8/500. First hook up your development board. In this example, we use a board attached to serial port @code{COM2}; if you use a different serial @@ -11934,7 +12029,7 @@ connected, you can start up @value{GDBN}. Call @code{@value{GDBP}} with the name of your program as the argument. @code{@value{GDBN}} prompts you, as usual, with the prompt @samp{(@value{GDBP})}. Use two special commands to begin your debugging session: @samp{target hms} to specify -cross-debugging to the Hitachi board, and the @code{load} command to +cross-debugging to the Renesas board, and the @code{load} command to download your program to the board. @code{load} displays the names of the program's sections, and a @samp{*} for each 2K of data downloaded. (If you want to refresh @value{GDBN} data on symbols or on the @@ -11984,12 +12079,12 @@ to detect program completion. In either case, @value{GDBN} sees the effect of a @sc{reset} on the development board as a ``normal exit'' of your program. -@node Hitachi ICE +@node Renesas ICE @subsubsection Using the E7000 in-circuit emulator -@kindex target e7000@r{, with Hitachi ICE} +@kindex target e7000@r{, with Renesas ICE} You can use the E7000 in-circuit emulator to develop code for either the -Hitachi SH or the H8/300H. Use one of these forms of the @samp{target +Renesas SH or the H8/300H. Use one of these forms of the @samp{target e7000} command to connect @value{GDBN} to your E7000: @table @code @@ -12004,8 +12099,8 @@ If your E7000 is installed as a host on a TCP/IP network, you can just specify its hostname; @value{GDBN} uses @code{telnet} to connect. @end table -@node Hitachi Special -@subsubsection Special @value{GDBN} commands for Hitachi micros +@node Renesas Special +@subsubsection Special @value{GDBN} commands for Renesas micros Some @value{GDBN} commands are available only for the H8/300: @@ -12038,13 +12133,17 @@ memory}. The accepted values for @var{mod} are @code{small}, @end table @node M32R/D -@subsection Mitsubishi M32R/D +@subsection Renesas M32R/D @table @code @kindex target m32r @item target m32r @var{dev} -Mitsubishi M32R/D ROM monitor. +Renesas M32R/D ROM monitor. + +@kindex target m32rsdi +@item target m32rsdi @var{dev} +Renesas M32R SDI server, connected via parallel port to the board. @end table @@ -12391,25 +12490,25 @@ W89K monitor, running on a Winbond HPPA board. @end table @node SH -@subsection Hitachi SH +@subsection Renesas SH @table @code -@kindex target hms@r{, with Hitachi SH} +@kindex target hms@r{, with Renesas SH} @item target hms @var{dev} -A Hitachi SH board attached via serial line to your host. Use special +A Renesas SH board attached via serial line to your host. Use special commands @code{device} and @code{speed} to control the serial line and the communications speed used. -@kindex target e7000@r{, with Hitachi SH} +@kindex target e7000@r{, with Renesas SH} @item target e7000 @var{dev} -E7000 emulator for Hitachi SH. +E7000 emulator for Renesas SH. @kindex target sh3@r{, with SH} @kindex target sh3e@r{, with SH} @item target sh3 @var{dev} @item target sh3e @var{dev} -Hitachi SH-3 and SH-3E target systems. +Renesas SH-3 and SH-3E target systems. @end table @@ -17226,7 +17325,7 @@ Show the core addresses of the code for a source line. @subsubheading @value{GDBN} Command -The corresponding @value{GDBN} comamnd is @samp{info line}. +The corresponding @value{GDBN} command is @samp{info line}. @code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands. @subsubheading Example @@ -19517,9 +19616,9 @@ Reply: Each byte of register data is described by two hex digits. The bytes with the register are transmitted in target byte order. The size of each register and their position within the @samp{g} @var{packet} are -determined by the @value{GDBN} internal macros @var{REGISTER_RAW_SIZE} -and @var{REGISTER_NAME} macros. The specification of several standard -@code{g} packets is specified below. +determined by the @value{GDBN} internal macros +@var{DEPRECATED_REGISTER_RAW_SIZE} and @var{REGISTER_NAME} macros. The +specification of several standard @code{g} packets is specified below. @item E@var{NN} for an error. @end table @@ -19781,9 +19880,51 @@ Reserved for future use. Reserved for future use. -@item @code{v} --- reserved +@item @code{v} --- verbose packet prefix -Reserved for future use. +Packets starting with @code{v} are identified by a multi-letter name, +up to the first @code{;} or @code{?} (or the end of the packet). + +@item @code{vCont}[;@var{action}[@code{:}@var{tid}]]... --- extended resume +@cindex @code{vCont} packet + +Resume the inferior. Different actions may be specified for each thread. +If an action is specified with no @var{tid}, then it is applied to any +threads that don't have a specific action specified; if no default action is +specified then other threads should remain stopped. Specifying multiple +default actions is an error; specifying no actions is also an error. +Thread IDs are specified in hexadecimal. Currently supported actions are: + +@table @code +@item c +Continue. +@item C@var{sig} +Continue with signal @var{sig}. @var{sig} should be two hex digits. +@item s +Step. +@item S@var{sig} +Step with signal @var{sig}. @var{sig} should be two hex digits. +@end table + +The optional @var{addr} argument normally associated with these packets is +not supported in @code{vCont}. + +Reply: +@xref{Stop Reply Packets}, for the reply specifications. + +@item @code{vCont?} --- extended resume query +@cindex @code{vCont?} packet + +Query support for the @code{vCont} packet. + +Reply: +@table @samp +@item @code{vCont}[;@var{action}]... +The @code{vCont} packet is supported. Each @var{action} is a supported +command in the @code{vCont} packet. +@item +The @code{vCont} packet is not supported. +@end table @item @code{V} --- reserved @@ -19971,12 +20112,13 @@ conventions is used. @var{AA} = two hex digit signal number; @var{n...} = register number (hex), @var{r...} = target byte ordered register contents, size defined -by @code{REGISTER_RAW_SIZE}; @var{n...} = @samp{thread}, @var{r...} = -thread process ID, this is a hex integer; @var{n...} = (@samp{watch} | -@samp{rwatch} | @samp{awatch}, @var{r...} = data address, this is a hex -integer; @var{n...} = other string not starting with valid hex digit. -@value{GDBN} should ignore this @var{n...}, @var{r...} pair and go on -to the next. This way we can extend the protocol. +by @code{DEPRECATED_REGISTER_RAW_SIZE}; @var{n...} = @samp{thread}, +@var{r...} = thread process ID, this is a hex integer; @var{n...} = +(@samp{watch} | @samp{rwatch} | @samp{awatch}, @var{r...} = data +address, this is a hex integer; @var{n...} = other string not starting +with valid hex digit. @value{GDBN} should ignore this @var{n...}, +@var{r...} pair and go on to the next. This way we can extend the +protocol. @item W@var{AA} @@ -20269,8 +20411,8 @@ Example sequence of a target being stepped by a single instruction: @menu * File-I/O Overview:: * Protocol basics:: -* The `F' request packet:: -* The `F' reply packet:: +* The F request packet:: +* The F reply packet:: * Memory transfer:: * The Ctrl-C message:: * Console I/O:: @@ -20397,7 +20539,7 @@ Return value. After having done the needed type and value coercion, the target continues the latest continue or step action. -@node The `F' request packet +@node The F request packet @subsection The @code{F} request packet @cindex file-i/o request packet @cindex @code{F} request packet @@ -20424,7 +20566,7 @@ 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 +@node The F reply packet @subsection The @code{F} reply packet @cindex file-i/o reply packet @cindex @code{F} reply packet diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 31c6695..3170ce2 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -2505,7 +2505,7 @@ However, architectures with smaller word sizes are often cramped for address space, so they may choose a pointer representation that breaks this identity, and allows a larger code address space. -For example, the Mitsubishi D10V is a 16-bit VLIW processor whose +For example, the Renesas D10V is a 16-bit VLIW processor whose instructions are 32 bits long@footnote{Some D10V instructions are actually pairs of 16-bit sub-instructions. However, since you can't jump into the middle of such a pair, code addresses can only refer to @@ -2766,19 +2766,19 @@ You should not use @code{REGISTER_CONVERT_TO_VIRTUAL} for a register unless this macro returns a non-zero value for that register. @end deftypefn -@deftypefn {Target Macro} int REGISTER_RAW_SIZE (int @var{reg}) +@deftypefn {Target Macro} int DEPRECATED_REGISTER_RAW_SIZE (int @var{reg}) The size of register number @var{reg}'s raw value. This is the number of bytes the register will occupy in @code{registers}, or in a @value{GDBN} remote protocol packet. @end deftypefn -@deftypefn {Target Macro} int REGISTER_VIRTUAL_SIZE (int @var{reg}) +@deftypefn {Target Macro} int DEPRECATED_REGISTER_VIRTUAL_SIZE (int @var{reg}) The size of register number @var{reg}'s value, in its virtual format. This is the size a @code{struct value}'s buffer will have, holding that register's value. @end deftypefn -@deftypefn {Target Macro} struct type *REGISTER_VIRTUAL_TYPE (int @var{reg}) +@deftypefn {Target Macro} struct type *DEPRECATED_REGISTER_VIRTUAL_TYPE (int @var{reg}) This is the type of the virtual representation of register number @var{reg}. Note that there is no need for a macro giving a type for the register's raw form; once the register's value has been obtained, @value{GDBN} @@ -2787,7 +2787,7 @@ always uses the virtual form. @deftypefn {Target Macro} void REGISTER_CONVERT_TO_VIRTUAL (int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to}) Convert the value of register number @var{reg} to @var{type}, which -should always be @code{REGISTER_VIRTUAL_TYPE (@var{reg})}. The buffer +should always be @code{DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg})}. The buffer at @var{from} holds the register's value in raw format; the macro should convert the value to virtual format, and place it at @var{to}. @@ -2802,7 +2802,7 @@ value. @deftypefn {Target Macro} void REGISTER_CONVERT_TO_RAW (struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to}) Convert the value of register number @var{reg} to @var{type}, which -should always be @code{REGISTER_VIRTUAL_TYPE (@var{reg})}. The buffer +should always be @code{DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg})}. The buffer at @var{from} holds the register's value in raw format; the macro should convert the value to virtual format, and place it at @var{to}. @@ -3052,6 +3052,39 @@ custom breakpoint insertion and removal routines if @code{BREAKPOINT_FROM_PC} needs to read the target's memory for some reason. +@item ADJUST_BREAKPOINT_ADDRESS (@var{address}) +@findex ADJUST_BREAKPOINT_ADDRESS +@cindex breakpoint address adjusted +Given an address at which a breakpoint is desired, return a breakpoint +address adjusted to account for architectural constraints on +breakpoint placement. This method is not needed by most targets. + +The FR-V target (see @file{frv-tdep.c}) requires this method. +The FR-V is a VLIW architecture in which a number of RISC-like +instructions are grouped (packed) together into an aggregate +instruction or instruction bundle. When the processor executes +one of these bundles, the component instructions are executed +in parallel. + +In the course of optimization, the compiler may group instructions +from distinct source statements into the same bundle. The line number +information associated with one of the latter statements will likely +refer to some instruction other than the first one in the bundle. So, +if the user attempts to place a breakpoint on one of these latter +statements, @value{GDBN} must be careful to @emph{not} place the break +instruction on any instruction other than the first one in the bundle. +(Remember though that the instructions within a bundle execute +in parallel, so the @emph{first} instruction is the instruction +at the lowest address and has nothing to do with execution order.) + +The FR-V's @code{ADJUST_BREAKPOINT_ADDRESS} method will adjust a +breakpoint's address by scanning backwards for the beginning of +the bundle, returning the address of the bundle. + +Since the adjustment of a breakpoint may significantly alter a user's +expectation, @value{GDBN} prints a warning when an adjusted breakpoint +is initially set and each time that that breakpoint is hit. + @item DEPRECATED_CALL_DUMMY_WORDS @findex DEPRECATED_CALL_DUMMY_WORDS Pointer to an array of @code{LONGEST} words of data containing @@ -3186,13 +3219,17 @@ Define this to extract a function's return value of type @var{type} from the raw register state @var{regbuf} and copy that, in virtual format, into @var{valbuf}. +This method has been deprecated in favour of @code{gdbarch_return_value} +(@pxref{gdbarch_return_value}). + @item EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf}) @findex EXTRACT_STRUCT_VALUE_ADDRESS +@anchor{EXTRACT_STRUCT_VALUE_ADDRESS} When defined, extract from the array @var{regbuf} (containing the raw register state) the @code{CORE_ADDR} at which a function should return its structure value. -If not defined, @code{EXTRACT_RETURN_VALUE} is used. +@xref{gdbarch_return_value}. @item EXTRACT_STRUCT_VALUE_ADDRESS_P() @findex EXTRACT_STRUCT_VALUE_ADDRESS_P @@ -3382,9 +3419,9 @@ pointer. It examines the current state of the machine as needed. Define this if you need to supply your own definition for the function @code{DEPRECATED_GET_SAVED_REGISTER}. -@item IBM6000_TARGET -@findex IBM6000_TARGET -Shows that we are configured for an IBM RS/6000 target. This +@item DEPRECATED_IBM6000_TARGET +@findex DEPRECATED_IBM6000_TARGET +Shows that we are configured for an IBM RS/6000 system. This conditional should be eliminated (FIXME) and replaced by feature-specific macros. It was introduced in a haste and we are repenting at leisure. @@ -3483,11 +3520,6 @@ method like @code{INTEGER_TO_ADDRESS} certainly makes it possible for @xref{Target Architecture Definition, , Pointers Are Not Always Addresses}. -@item NEED_TEXT_START_END -@findex NEED_TEXT_START_END -Define this if @value{GDBN} should determine the start and end addresses of the -text section. (Seems dubious.) - @item NO_HIF_SUPPORT @findex NO_HIF_SUPPORT (Specific to the a29k.) @@ -3510,8 +3542,8 @@ Convert the raw contents of register @var{regnum} into a value of type @var{type}. @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}. -@item REGISTER_RAW_SIZE (@var{reg}) -@findex REGISTER_RAW_SIZE +@item DEPRECATED_REGISTER_RAW_SIZE (@var{reg}) +@findex DEPRECATED_REGISTER_RAW_SIZE Return the raw size of @var{reg}; defaults to the size of the register's virtual type. @xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @@ -3538,14 +3570,14 @@ floating-point. @samp{float_reggroup}. Any register with a valid name. @end table -@item REGISTER_VIRTUAL_SIZE (@var{reg}) -@findex REGISTER_VIRTUAL_SIZE +@item DEPRECATED_REGISTER_VIRTUAL_SIZE (@var{reg}) +@findex DEPRECATED_REGISTER_VIRTUAL_SIZE Return the virtual size of @var{reg}; defaults to the size of the register's virtual type. Return the virtual size of @var{reg}. @xref{Target Architecture Definition, , Raw and Virtual Register Representations}. -@item REGISTER_VIRTUAL_TYPE (@var{reg}) +@item DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg}) @findex REGISTER_VIRTUAL_TYPE Return the virtual type of @var{reg}. @xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @@ -3553,7 +3585,7 @@ Return the virtual type of @var{reg}. @item struct type *register_type (@var{gdbarch}, @var{reg}) @findex register_type If defined, return the type of register @var{reg}. This function -superseeds @code{REGISTER_VIRTUAL_TYPE}. @xref{Target Architecture +superseeds @code{DEPRECATED_REGISTER_VIRTUAL_TYPE}. @xref{Target Architecture Definition, , Raw and Virtual Register Representations}. @item REGISTER_CONVERT_TO_VIRTUAL(@var{reg}, @var{type}, @var{from}, @var{to}) @@ -3568,6 +3600,12 @@ Convert the value of register @var{reg} from its virtual form to its raw form. @xref{Target Architecture Definition, , Raw and Virtual Register Representations}. +@item const struct regset *regset_from_core_section (struct gdbarch * @var{gdbarch}, const char * @var{sect_name}, size_t @var{sect_size}) +@findex regset_from_core_section +Return the appropriate register set for a core file section with name +@var{sect_name} and size @var{sect_size}. + + @item RETURN_VALUE_ON_STACK(@var{type}) @findex RETURN_VALUE_ON_STACK @cindex returning structures by value @@ -3677,15 +3715,28 @@ be the number (greater than or equal to zero) of that register. This should only need to be defined if @code{TARGET_READ_PC} and @code{TARGET_WRITE_PC} are not defined. -@item NPC_REGNUM -@findex NPC_REGNUM +@item DEPRECATED_NPC_REGNUM +@findex DEPRECATED_NPC_REGNUM The number of the ``next program counter'' register, if defined. +@code{DEPRECATED_NPC_REGNUM} has been replaced by @code{TARGET_WRITE_PC} +(@pxref{TARGET_WRITE_PC}). + @item PARM_BOUNDARY @findex PARM_BOUNDARY If non-zero, round arguments to a boundary of this many bits before pushing them on the stack. +@item stabs_argument_has_addr (@var{gdbarch}, @var{type}) +@findex stabs_argument_has_addr +@findex DEPRECATED_REG_STRUCT_HAS_ADDR +@anchor{stabs_argument_has_addr} Define this to return nonzero if a +function argument of type @var{type} is passed by reference instead of +value. + +This method replaces @code{DEPRECATED_REG_STRUCT_HAS_ADDR} +(@pxref{DEPRECATED_REG_STRUCT_HAS_ADDR}). + @item PROCESS_LINENUMBER_HOOK @findex PROCESS_LINENUMBER_HOOK A hook defined for XCOFF reading. @@ -3756,14 +3807,13 @@ register buffer at run-time. Return the name of register @var{i} as a string. May return @code{NULL} or @code{NUL} to indicate that register @var{i} is not valid. -@item REGISTER_NAMES -@findex REGISTER_NAMES -Deprecated in favor of @code{REGISTER_NAME}. - @item DEPRECATED_REG_STRUCT_HAS_ADDR (@var{gcc_p}, @var{type}) @findex DEPRECATED_REG_STRUCT_HAS_ADDR -Define this to return 1 if the given type will be passed by pointer -rather than directly. +@anchor{DEPRECATED_REG_STRUCT_HAS_ADDR}Define this to return 1 if the +given type will be passed by pointer rather than directly. + +This method has been replaced by @code{stabs_argument_has_addr} +(@pxref{stabs_argument_has_addr}). @item SAVE_DUMMY_FRAME_TOS (@var{sp}) @findex SAVE_DUMMY_FRAME_TOS @@ -3778,6 +3828,48 @@ allocated on the stack. @xref{unwind_dummy_id}. Define this to convert sdb register numbers into @value{GDBN} regnums. If not defined, no conversion will be done. +@item enum return_value_convention gdbarch_return_value (struct gdbarch *@var{gdbarch}, struct type *@var{valtype}, struct regcache *@var{regcache}, void *@var{readbuf}, const void *@var{writebuf}) +@findex gdbarch_return_value +@anchor{gdbarch_return_value} Given a function with a return-value of +type @var{rettype}, return which return-value convention that function +would use. + +@value{GDBN} currently recognizes two function return-value conventions: +@code{RETURN_VALUE_REGISTER_CONVENTION} where the return value is found +in registers; and @code{RETURN_VALUE_STRUCT_CONVENTION} where the return +value is found in memory and the address of that memory location is +passed in as the function's first parameter. + +If the register convention is being used, and @var{writebuf} is +non-@code{NULL}, also copy the return-value in @var{writebuf} into +@var{regcache}. + +If the register convention is being used, and @var{readbuf} is +non-@code{NULL}, also copy the return value from @var{regcache} into +@var{readbuf} (@var{regcache} contains a copy of the registers from the +just returned function). + +@xref{EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how +return-values that use the struct convention are handled. + +@emph{Maintainer note: This method replaces separate predicate, extract, +store methods. By having only one method, the logic needed to determine +the return-value convention need only be implemented in one place. If +@value{GDBN} were written in an @sc{oo} language, this method would +instead return an object that knew how to perform the register +return-value extract and store.} + +@emph{Maintainer note: This method does not take a @var{gcc_p} +parameter, and such a parameter should not be added. If an architecture +that requires per-compiler or per-function information be identified, +then the replacement of @var{rettype} with @code{struct value} +@var{function} should be persued.} + +@emph{Maintainer note: The @var{regcache} parameter limits this methods +to the inner most frame. While replacing @var{regcache} with a +@code{struct frame_info} @var{frame} parameter would remove that +limitation there has yet to be a demonstrated need for such a change.} + @item SKIP_PERMANENT_BREAKPOINT @findex SKIP_PERMANENT_BREAKPOINT Advance the inferior's PC past a permanent breakpoint. @value{GDBN} normally @@ -3836,6 +3928,9 @@ A C expression that writes the function return value, found in @var{valbuf}, into the @var{regcache}. @var{type} is the type of the value that is to be returned. +This method has been deprecated in favour of @code{gdbarch_return_value} +(@pxref{gdbarch_return_value}). + @item SUN_FIXED_LBRAC_BUG @findex SUN_FIXED_LBRAC_BUG (Used only for Sun-3 and Sun-4 targets.) @@ -3909,6 +4004,7 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}. @findex TARGET_READ_PC @itemx TARGET_WRITE_PC (@var{val}, @var{pid}) @findex TARGET_WRITE_PC +@anchor{TARGET_WRITE_PC} @itemx TARGET_READ_SP @findex TARGET_READ_SP @itemx TARGET_READ_FP @@ -3970,6 +4066,9 @@ being considered is known to have been compiled by GCC; this is helpful for systems where GCC is known to use different calling convention than other compilers. +This method has been deprecated in favour of @code{gdbarch_return_value} +(@pxref{gdbarch_return_value}). + @item VALUE_TO_REGISTER(@var{type}, @var{regnum}, @var{from}, @var{to}) @findex VALUE_TO_REGISTER Convert a value of type @var{type} into the raw contents of register @@ -6381,7 +6480,7 @@ for prototypes). @item gdb.@var{lang} Language-specific tests for any language @var{lang} besides C. Examples are -@file{gdb.c++} and @file{gdb.java}. +@file{gdb.cp} and @file{gdb.java}. @item gdb.@var{platform} Non-portable tests. The tests are specific to a specific configuration diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo index bd59116..8597384 100644 --- a/gdb/doc/stabs.texinfo +++ b/gdb/doc/stabs.texinfo @@ -3,13 +3,12 @@ @c @finalout -@ifinfo -@format -START-INFO-DIR-ENTRY -* Stabs: (stabs). The "stabs" debugging information format. -END-INFO-DIR-ENTRY -@end format -@end ifinfo +@c This is a dir.info fragment to support semi-automated addition of +@c manuals to an info tree. +@dircategory Programming & development tools. +@direntry +* Stabs: (stabs). The "stabs" debugging information format. +@end direntry @ifinfo This document describes the stabs debugging symbol tables. diff --git a/gdb/dpx2-nat.c b/gdb/dpx2-nat.c index 04018db..488c06a 100644 --- a/gdb/dpx2-nat.c +++ b/gdb/dpx2-nat.c @@ -32,7 +32,7 @@ #include <sys/utsname.h> -/* this table must line up with REGISTER_NAMES in tm-68k.h */ +/* This table must line up with REGISTER_NAME in "m68k-tdep.c". */ /* symbols like 'A0' come from <sys/reg.h> */ static int regmap[] = { diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 36c7dbb..3b10c51 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -387,7 +387,7 @@ dummy_frame_this_id (struct frame_info *next_frame, } else { - /* Outch! We're not trying to find the innermost frame's ID yet + /* Ouch! 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. */ diff --git a/gdb/dve3900-rom.c b/gdb/dve3900-rom.c index 02a273c..665179f 100644 --- a/gdb/dve3900-rom.c +++ b/gdb/dve3900-rom.c @@ -471,7 +471,7 @@ fetch_bitmapped_register (int regno, struct bit_field *bf) /* supply register stores in target byte order, so swap here */ - store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), val); + store_unsigned_integer (regbuf, DEPRECATED_REGISTER_RAW_SIZE (regno), val); supply_register (regno, regbuf); } diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index d6b8f26..6e420cd 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -383,6 +383,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, insn_ptr = read_uleb128 (insn_ptr, insn_end, ®); insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1); + fs->regs.reg[reg].how = REG_SAVED_REG; fs->regs.reg[reg].loc.reg = utmp; break; @@ -770,7 +771,7 @@ dwarf2_frame_prev_register (struct frame_info *next_frame, void **this_cache, either a register and a signed offset that are added together or a DWARF expression that is evaluated. */ /* NOTE: cagney/2003-09-05: Should issue a complain. - Unfortunatly it turns out that DWARF2 CFI has a problem. + Unfortunately it turns out that DWARF2 CFI has a problem. Since CFI specifies the location at which a register was saved (not its value) it isn't possible to specify something like "unwound(REG) == REG + constant" using CFI @@ -885,6 +886,9 @@ struct comp_unit /* Base for DW_EH_PE_datarel encodings. */ bfd_vma dbase; + + /* Base for DW_EH_PE_textrel encodings. */ + bfd_vma tbase; }; const struct objfile_data *dwarf2_frame_data; @@ -1063,6 +1067,9 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, case DW_EH_PE_datarel: base = unit->dbase; break; + case DW_EH_PE_textrel: + base = unit->tbase; + break; case DW_EH_PE_aligned: base = 0; offset = buf - unit->dwarf_frame_buffer; @@ -1523,12 +1530,13 @@ dwarf2_build_frame_info (struct objfile *objfile) unit.objfile = objfile; unit.addr_size = objfile->obfd->arch_info->bits_per_address / 8; unit.dbase = 0; + unit.tbase = 0; /* First add the information from the .eh_frame section. That way, the FDEs from that section are searched last. */ if (dwarf_eh_frame_offset) { - asection *got; + asection *got, *txt; unit.cie = NULL; unit.dwarf_frame_buffer = dwarf2_read_section (objfile, @@ -1540,13 +1548,19 @@ dwarf2_build_frame_info (struct objfile *objfile) unit.dwarf_frame_section = dwarf_eh_frame_section; /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base - that for the i386/amd64 target, which currently is the only - target in GCC that supports/uses the DW_EH_PE_datarel - encoding. */ + that is used for the i386/amd64 target, which currently is + the only target in GCC that supports/uses the + DW_EH_PE_datarel encoding. */ got = bfd_get_section_by_name (unit.abfd, ".got"); if (got) unit.dbase = got->vma; + /* GCC emits the DW_EH_PE_textrel encoding type on sh and ia64 + so far. */ + txt = bfd_get_section_by_name (unit.abfd, ".text"); + if (txt) + unit.tbase = txt->vma; + frame_ptr = unit.dwarf_frame_buffer; while (frame_ptr < unit.dwarf_frame_buffer + unit.dwarf_frame_size) frame_ptr = decode_frame_entry (&unit, frame_ptr, 1); diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 3d1523b..cf00929 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -441,18 +441,6 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, result = dwarf_expr_fetch (ctx, 0); 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 = dwarf2_read_address (buf, - buf + (TARGET_ADDR_BIT - / TARGET_CHAR_BIT), - &bytes_read); - } result = result + offset; ctx->stack_len = before_stack_len; ctx->in_reg = 0; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index bfd9031..ffadd23 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -320,9 +320,16 @@ struct die_info unsigned int num_attrs; /* Number of attributes */ struct attribute *attrs; /* An array of attributes */ struct die_info *next_ref; /* Next die in ref hash table */ + + /* The dies in a compilation unit form an n-ary tree. PARENT + points to this die's parent; CHILD points to the first child of + this node; and all the children of a given node are chained + together via their SIBLING fields, terminated by a die whose + tag is zero. */ struct die_info *child; /* Its first child, if any. */ struct die_info *sibling; /* Its next sibling, if any. */ struct die_info *parent; /* Its parent, if any. */ + struct type *type; /* Cached type information */ }; @@ -1009,61 +1016,61 @@ dwarf2_has_info (bfd *abfd) static void dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) { - if (STREQ (sectp->name, INFO_SECTION)) + if (strcmp (sectp->name, INFO_SECTION) == 0) { dwarf_info_offset = sectp->filepos; dwarf_info_size = bfd_get_section_size_before_reloc (sectp); dwarf_info_section = sectp; } - else if (STREQ (sectp->name, ABBREV_SECTION)) + else if (strcmp (sectp->name, ABBREV_SECTION) == 0) { dwarf_abbrev_offset = sectp->filepos; dwarf_abbrev_size = bfd_get_section_size_before_reloc (sectp); dwarf_abbrev_section = sectp; } - else if (STREQ (sectp->name, LINE_SECTION)) + else if (strcmp (sectp->name, LINE_SECTION) == 0) { dwarf_line_offset = sectp->filepos; dwarf_line_size = bfd_get_section_size_before_reloc (sectp); dwarf_line_section = sectp; } - else if (STREQ (sectp->name, PUBNAMES_SECTION)) + else if (strcmp (sectp->name, PUBNAMES_SECTION) == 0) { dwarf_pubnames_offset = sectp->filepos; dwarf_pubnames_size = bfd_get_section_size_before_reloc (sectp); dwarf_pubnames_section = sectp; } - else if (STREQ (sectp->name, ARANGES_SECTION)) + else if (strcmp (sectp->name, ARANGES_SECTION) == 0) { dwarf_aranges_offset = sectp->filepos; dwarf_aranges_size = bfd_get_section_size_before_reloc (sectp); dwarf_aranges_section = sectp; } - else if (STREQ (sectp->name, LOC_SECTION)) + else if (strcmp (sectp->name, LOC_SECTION) == 0) { dwarf_loc_offset = sectp->filepos; dwarf_loc_size = bfd_get_section_size_before_reloc (sectp); dwarf_loc_section = sectp; } - else if (STREQ (sectp->name, MACINFO_SECTION)) + else if (strcmp (sectp->name, MACINFO_SECTION) == 0) { dwarf_macinfo_offset = sectp->filepos; dwarf_macinfo_size = bfd_get_section_size_before_reloc (sectp); dwarf_macinfo_section = sectp; } - else if (STREQ (sectp->name, STR_SECTION)) + else if (strcmp (sectp->name, STR_SECTION) == 0) { dwarf_str_offset = sectp->filepos; dwarf_str_size = bfd_get_section_size_before_reloc (sectp); dwarf_str_section = sectp; } - else if (STREQ (sectp->name, FRAME_SECTION)) + else if (strcmp (sectp->name, FRAME_SECTION) == 0) { dwarf_frame_offset = sectp->filepos; dwarf_frame_size = bfd_get_section_size_before_reloc (sectp); dwarf_frame_section = sectp; } - else if (STREQ (sectp->name, EH_FRAME_SECTION)) + else if (strcmp (sectp->name, EH_FRAME_SECTION) == 0) { flagword aflag = bfd_get_section_flags (ignore_abfd, sectp); if (aflag & SEC_HAS_CONTENTS) @@ -1073,7 +1080,7 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr) dwarf_eh_frame_section = sectp; } } - else if (STREQ (sectp->name, RANGES_SECTION)) + else if (strcmp (sectp->name, RANGES_SECTION) == 0) { dwarf_ranges_offset = sectp->filepos; dwarf_ranges_size = bfd_get_section_size_before_reloc (sectp); @@ -3443,8 +3450,14 @@ read_array_type (struct die_info *die, struct objfile *objfile, with a DW_FORM_block1 attribute. FIXME: GDB does not yet know how to handle dynamic arrays properly, treat them as arrays with unspecified - length for now. */ - high = -1; + length for now. + + FIXME: jimb/2003-09-22: GDB does not really know + how to handle arrays of unspecified length + either; we just represent them as zero-length + arrays. Choose an appropriate upper bound given + the lower bound we've computed above. */ + high = low - 1; } else { @@ -4240,7 +4253,6 @@ dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header) /* Empty the abbrev table for a new compilation unit. */ -/* ARGSUSED */ static void dwarf2_empty_abbrev_table (void *ptr_to_abbrevs_table) { @@ -7590,7 +7602,6 @@ decode_locdesc (struct dwarf_block *blk, struct objfile *objfile, /* memory allocation interface */ -/* ARGSUSED */ static void dwarf2_free_tmp_obstack (void *ignore) { diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 6f1c76a..5c18487 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1810,7 +1810,7 @@ handle_producer (char *producer) else { processing_gcc_compilation = - STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)); + strncmp (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)) == 0; } /* Select a demangling style if we can identify the producer and if diff --git a/gdb/elfread.c b/gdb/elfread.c index 8c27810..8814f89 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -80,59 +80,30 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) struct elfinfo *ei; ei = (struct elfinfo *) eip; - if (STREQ (sectp->name, ".debug")) + if (strcmp (sectp->name, ".debug") == 0) { ei->dboffset = sectp->filepos; ei->dbsize = bfd_get_section_size_before_reloc (sectp); } - else if (STREQ (sectp->name, ".line")) + else if (strcmp (sectp->name, ".line") == 0) { ei->lnoffset = sectp->filepos; ei->lnsize = bfd_get_section_size_before_reloc (sectp); } - else if (STREQ (sectp->name, ".stab")) + else if (strcmp (sectp->name, ".stab") == 0) { ei->stabsect = sectp; } - else if (STREQ (sectp->name, ".stab.index")) + else if (strcmp (sectp->name, ".stab.index") == 0) { ei->stabindexsect = sectp; } - else if (STREQ (sectp->name, ".mdebug")) + else if (strcmp (sectp->name, ".mdebug") == 0) { ei->mdebugsect = sectp; } } -#if 0 /* Currently unused */ - -char * -elf_interpreter (bfd *abfd) -{ - sec_ptr interp_sec; - unsigned size; - char *interp = NULL; - - interp_sec = bfd_get_section_by_name (abfd, ".interp"); - if (interp_sec) - { - size = bfd_section_size (abfd, interp_sec); - interp = alloca (size); - if (bfd_get_section_contents (abfd, interp_sec, interp, (file_ptr) 0, - size)) - { - interp = savestring (interp, size - 1); - } - else - { - interp = NULL; - } - } - return (interp); -} - -#endif - static struct minimal_symbol * record_minimal_symbol_and_info (char *name, CORE_ADDR address, enum minimal_symbol_type ms_type, char *info, /* FIXME, is this really char *? */ @@ -398,9 +369,17 @@ elf_symtab_read (struct objfile *objfile, int dynamic) = max (SECT_OFF_BSS (objfile), max (SECT_OFF_DATA (objfile), SECT_OFF_RODATA (objfile))); + + /* max_index is the largest index we'll + use into this array, so we must + allocate max_index+1 elements for it. + However, 'struct stab_section_info' + already includes one element, so we + need to allocate max_index aadditional + elements. */ size = (sizeof (struct stab_section_info) + (sizeof (CORE_ADDR) - * (max_index - 1))); + * max_index)); sectinfo = (struct stab_section_info *) xmmalloc (objfile->md, size); memset (sectinfo, 0, size); @@ -711,7 +690,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst) for (; maybe; maybe = maybe->next) { if (filename[0] == maybe->filename[0] - && STREQ (filename, maybe->filename)) + && strcmp (filename, maybe->filename) == 0) { /* We found a match. But there might be several source files (from different directories) with the same name. */ diff --git a/gdb/environ.c b/gdb/environ.c index 8612b0a..01eb57a 100644 --- a/gdb/environ.c +++ b/gdb/environ.c @@ -106,7 +106,7 @@ get_in_environ (const struct environ *e, const char *var) char *s; for (; (s = *vector) != NULL; vector++) - if (STREQN (s, var, len) && s[len] == '=') + if (strncmp (s, var, len) == 0 && s[len] == '=') return &s[len + 1]; return 0; @@ -123,7 +123,7 @@ set_in_environ (struct environ *e, const char *var, const char *value) char *s; for (i = 0; (s = vector[i]) != NULL; i++) - if (STREQN (s, var, len) && s[len] == '=') + if (strncmp (s, var, len) == 0 && s[len] == '=') break; if (s == 0) @@ -35,6 +35,7 @@ #include "infcall.h" #include "objc-lang.h" #include "block.h" +#include "parser-defs.h" /* Defined in symtab.c */ extern int hp_som_som_object_present; @@ -70,7 +71,8 @@ static struct value * evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos, enum noside noside) { - return (*exp->language_defn->evaluate_exp) (expect_type, exp, pos, noside); + return (*exp->language_defn->la_exp_desc->evaluate_exp) + (expect_type, exp, pos, noside); } /* Parse the string EXP as a C expression, evaluate it, diff --git a/gdb/event-top.c b/gdb/event-top.c index 21f8a7a..913e030 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -702,7 +702,7 @@ command_line_handler (char *rl) #define SERVER_COMMAND_LENGTH 7 server_command = (p - linebuffer > SERVER_COMMAND_LENGTH) - && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); + && strncmp (linebuffer, "server ", SERVER_COMMAND_LENGTH) == 0; if (server_command) { /* Note that we don't set `line'. Between this and the check in @@ -1084,7 +1084,6 @@ handle_sigwinch (int sig) /* Called by do_setshow_command. */ -/* ARGSUSED */ void set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c) { @@ -1092,7 +1091,6 @@ set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c) } /* Called by do_setshow_command. */ -/* ARGSUSED */ void set_async_annotation_level (char *args, int from_tty, struct cmd_list_element *c) { @@ -1100,7 +1098,6 @@ set_async_annotation_level (char *args, int from_tty, struct cmd_list_element *c } /* Called by do_setshow_command. */ -/* ARGSUSED */ void set_async_prompt (char *args, int from_tty, struct cmd_list_element *c) { @@ -1,7 +1,8 @@ /* Work with executable files, for GDB. - Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + + Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -30,6 +31,7 @@ #include "objfiles.h" #include "completer.h" #include "value.h" +#include "exec.h" #ifdef USG #include <sys/types.h> @@ -55,8 +57,6 @@ void (*file_changed_hook) (char *); /* Prototypes for local functions */ -static void add_to_section_table (bfd *, sec_ptr, void *); - static void exec_close (int); static void file_command (char *, int); @@ -65,8 +65,6 @@ static void set_section_command (char *, int); static void exec_files_info (struct target_ops *); -static void bfdsec_to_vmap (bfd *, sec_ptr, void *); - static int ignore (CORE_ADDR, char *); static void init_exec_ops (void); @@ -85,13 +83,6 @@ bfd *exec_bfd = NULL; int write_files = 0; -/* Text start and end addresses (KLUDGE) if needed */ - -#ifndef NEED_TEXT_START_END -#define NEED_TEXT_START_END (0) -#endif -CORE_ADDR text_end = 0; - struct vmap *vmap; void @@ -101,7 +92,6 @@ exec_open (char *args, int from_tty) exec_file_attach (args, from_tty); } -/* ARGSUSED */ static void exec_close (int quitting) { @@ -266,30 +256,9 @@ exec_file_attach (char *filename, int from_tty) scratch_pathname, bfd_errmsg (bfd_get_error ())); } - /* text_end is sometimes used for where to put call dummies. A - few ports use these for other purposes too. */ - if (NEED_TEXT_START_END) - { - struct section_table *p; - - /* Set text_start to the lowest address of the start of any - readonly code section and set text_end to the highest - address of the end of any readonly code section. */ - /* FIXME: The comment above does not match the code. The - code checks for sections with are either code *or* - readonly. */ - CORE_ADDR text_start = ~(CORE_ADDR) 0; - text_end = (CORE_ADDR) 0; - for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++) - if (bfd_get_section_flags (p->bfd, p->the_bfd_section) - & (SEC_CODE | SEC_READONLY)) - { - if (text_start > p->addr) - text_start = p->addr; - if (text_end < p->endaddr) - text_end = p->endaddr; - } - } +#ifdef DEPRECATED_HPUX_TEXT_END + DEPRECATED_HPUX_TEXT_END (&exec_ops); +#endif validate_files (); @@ -365,7 +334,8 @@ file_command (char *arg, int from_tty) we cast it back to its proper type. */ static void -add_to_section_table (bfd *abfd, sec_ptr asect, void *table_pp_char) +add_to_section_table (bfd *abfd, struct bfd_section *asect, + void *table_pp_char) { struct section_table **table_pp = (struct section_table **) table_pp_char; flagword aflag; @@ -386,7 +356,7 @@ add_to_section_table (bfd *abfd, sec_ptr asect, void *table_pp_char) Returns 0 if OK, 1 on error. */ int -build_section_table (bfd *some_bfd, struct section_table **start, +build_section_table (struct bfd *some_bfd, struct section_table **start, struct section_table **end) { unsigned count; @@ -404,7 +374,7 @@ build_section_table (bfd *some_bfd, struct section_table **start, } static void -bfdsec_to_vmap (bfd *abfd, sec_ptr sect, void *arg3) +bfdsec_to_vmap (struct bfd *abfd, struct bfd_section *sect, void *arg3) { struct vmap_and_bfd *vmap_bfd = (struct vmap_and_bfd *) arg3; struct vmap *vp; @@ -484,7 +454,6 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, int res; struct section_table *p; CORE_ADDR nextsectaddr, memend; - int (*xfer_fn) (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); asection *section = NULL; if (len <= 0) @@ -498,7 +467,6 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, } memend = memaddr + len; - xfer_fn = write ? bfd_set_section_contents : bfd_get_section_contents; nextsectaddr = memend; for (p = target->to_sections; p < target->to_sections_end; p++) @@ -511,8 +479,14 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, if (memend <= p->endaddr) { /* Entire transfer is within this section. */ - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); + if (write) + res = bfd_set_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); + else + res = bfd_get_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); return (res != 0) ? len : 0; } else if (memaddr >= p->endaddr) @@ -524,8 +498,14 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, { /* This section overlaps the transfer. Just do half. */ len = p->endaddr - memaddr; - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); + if (write) + res = bfd_set_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); + else + res = bfd_get_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); return (res != 0) ? len : 0; } } diff --git a/gdb/expprint.c b/gdb/expprint.c index a3001b1..5949475 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -36,11 +36,6 @@ #include <ctype.h> #endif -/* Prototypes for local functions */ - -static void print_subexp (struct expression *, int *, struct ui_file *, - enum precedence); - void print_expression (struct expression *exp, struct ui_file *stream) { @@ -53,10 +48,19 @@ print_expression (struct expression *exp, struct ui_file *stream) if the precedence of the main operator of this subexpression is less, parentheses are needed here. */ -static void +void print_subexp (struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec) { + exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec); +} + +/* Standard implementation of print_subexp for use in language_defn + vectors. */ +void +print_subexp_standard (struct expression *exp, int *pos, + struct ui_file *stream, enum precedence prec) +{ unsigned tem; const struct op_print *op_print_tab; int pc; @@ -547,10 +551,22 @@ op_string (enum exp_opcode op) /* Support for dumping the raw data from expressions in a human readable form. */ -static char *op_name (int opcode); +static char *op_name (struct expression *, enum exp_opcode); +static int dump_subexp_body (struct expression *exp, struct ui_file *, int); + +/* Name for OPCODE, when it appears in expression EXP. */ static char * -op_name (int opcode) +op_name (struct expression *exp, enum exp_opcode opcode) +{ + return exp->language_defn->la_exp_desc->op_name (opcode); +} + +/* Default name for the standard operator OPCODE (i.e., one defined in + the definition of enum exp_opcode). */ + +char * +op_name_standard (enum exp_opcode opcode) { switch (opcode) { @@ -737,8 +753,8 @@ op_name (int opcode) } void -dump_prefix_expression (struct expression *exp, struct ui_file *stream, - char *note) +dump_raw_expression (struct expression *exp, struct ui_file *stream, + char *note) { int elt; char *opcode_name; @@ -747,11 +763,6 @@ dump_prefix_expression (struct expression *exp, struct ui_file *stream, fprintf_filtered (stream, "Dump of expression @ "); gdb_print_host_address (exp, stream); - fprintf_filtered (stream, ", %s:\nExpression: `", note); - if (exp->elts[0].opcode != OP_TYPE) - print_expression (exp, stream); - else - fprintf_filtered (stream, "Type printing not yet supported...."); fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n", exp->language_defn->la_name, exp->nelts, (long) sizeof (union exp_element)); @@ -760,7 +771,7 @@ dump_prefix_expression (struct expression *exp, struct ui_file *stream, for (elt = 0; elt < exp->nelts; elt++) { fprintf_filtered (stream, "\t%5d ", elt); - opcode_name = op_name (exp->elts[elt].opcode); + opcode_name = op_name (exp, exp->elts[elt].opcode); fprintf_filtered (stream, "%20s ", opcode_name); print_longest (stream, 'd', 0, exp->elts[elt].longconst); @@ -778,10 +789,11 @@ dump_prefix_expression (struct expression *exp, struct ui_file *stream, } } -static int dump_subexp (struct expression *exp, struct ui_file *stream, - int elt); +/* Dump the subexpression of prefix expression EXP whose operator is at + position ELT onto STREAM. Returns the position of the next + subexpression in EXP. */ -static int +int dump_subexp (struct expression *exp, struct ui_file *stream, int elt) { static int indent = 0; @@ -794,9 +806,34 @@ dump_subexp (struct expression *exp, struct ui_file *stream, int elt) fprintf_filtered (stream, " "); indent += 2; - fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode)); + fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode)); - switch (exp->elts[elt++].opcode) + elt = dump_subexp_body (exp, stream, elt); + + indent -= 2; + + return elt; +} + +/* Dump the operands of prefix expression EXP whose opcode is at + position ELT onto STREAM. Returns the position of the next + subexpression in EXP. */ + +static int +dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt) +{ + return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt); +} + +/* Default value for subexp_body in exp_descriptor vector. */ + +int +dump_subexp_body_standard (struct expression *exp, + struct ui_file *stream, int elt) +{ + int opcode = exp->elts[elt++].opcode; + + switch (opcode) { case TERNOP_COND: case TERNOP_SLICE: @@ -914,7 +951,7 @@ dump_subexp (struct expression *exp, struct ui_file *stream, int elt) break; case OP_FUNCALL: { - int nargs; + int i, nargs; nargs = longest_to_int (exp->elts[elt].longconst); @@ -1006,20 +1043,17 @@ dump_subexp (struct expression *exp, struct ui_file *stream, int elt) fprintf_filtered (stream, "Unknown format"); } - indent -= 2; - return elt; } void -dump_postfix_expression (struct expression *exp, struct ui_file *stream, - char *note) +dump_prefix_expression (struct expression *exp, struct ui_file *stream) { int elt; fprintf_filtered (stream, "Dump of expression @ "); gdb_print_host_address (exp, stream); - fprintf_filtered (stream, ", %s:\nExpression: `", note); + fputs_filtered (", after conversion to prefix form:\nExpression: `", stream); if (exp->elts[0].opcode != OP_TYPE) print_expression (exp, stream); else diff --git a/gdb/expression.h b/gdb/expression.h index da95fcb..03b45c2 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -322,7 +322,27 @@ enum exp_opcode OP_EXPRSTRING, /* An Objective C Foundation Class NSString constant */ - OP_OBJC_NSSTRING + OP_OBJC_NSSTRING, + + /* First extension operator. Individual language modules define + extra operators they need as constants with values + OP_LANGUAGE_SPECIFIC0 + k, for k >= 0, using a separate + enumerated type definition: + enum foo_extension_operator { + BINOP_MOGRIFY = OP_EXTENDED0, + BINOP_FROB, + ... + }; */ + OP_EXTENDED0, + + /* Last possible extension operator. Defined to provide an + explicit and finite number of extended operators. */ + OP_EXTENDED_LAST = 0xff + /* NOTE: Eventually, we expect to convert to an object-oriented + formulation for expression operators that does away with the + need for these extension operators, and indeed for this + entire enumeration type. Therefore, consider the OP_EXTENDED + definitions to be a temporary measure. */ }; union exp_element @@ -393,11 +413,7 @@ extern void print_expression (struct expression *, struct ui_file *); extern char *op_string (enum exp_opcode); -extern void dump_prefix_expression (struct expression *, - struct ui_file *, - char *); -extern void dump_postfix_expression (struct expression *, - struct ui_file *, - char *); +extern void dump_raw_expression (struct expression *, struct ui_file *, char *); +extern void dump_prefix_expression (struct expression *, struct ui_file *); #endif /* !defined (EXPRESSION_H) */ diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 495ec6a..308e807 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -476,7 +476,7 @@ variable: name_not_typename else { struct minimal_symbol *msymbol; - register char *arg = copy_name ($1.stoken); + char *arg = copy_name ($1.stoken); msymbol = lookup_minimal_symbol_linkage_or_natural (arg); @@ -641,15 +641,15 @@ name_not_typename : NAME static int parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; + char *p; + int len; int parsed_float; YYSTYPE *putithere; { - register LONGEST n = 0; - register LONGEST prevn = 0; - register int c; - register int base = input_radix; + LONGEST n = 0; + LONGEST prevn = 0; + int c; + int base = input_radix; int unsigned_p = 0; int long_p = 0; ULONGEST high_bit; @@ -944,8 +944,8 @@ yylex () { for (i = 0; boolean_values[i].name != NULL; i++) { - if STREQN (tokstart, boolean_values[i].name, - strlen (boolean_values[i].name)) + if (strncmp (tokstart, boolean_values[i].name, + strlen (boolean_values[i].name)) == 0) { lexptr += strlen (boolean_values[i].name); yylval.lval = boolean_values[i].value; @@ -957,7 +957,7 @@ yylex () /* See if it is a special .foo. operator */ for (i = 0; dot_ops[i].operator != NULL; i++) - if (STREQN (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator))) + if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0) { lexptr += strlen (dot_ops[i].operator); yylval.opcode = dot_ops[i].opcode; @@ -1018,7 +1018,7 @@ yylex () { /* It's a number. */ int got_dot = 0, got_e = 0, got_d = 0, toktype; - register char *p = tokstart; + char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) @@ -1114,8 +1114,8 @@ yylex () /* Catch specific keywords. */ for (i = 0; f77_keywords[i].operator != NULL; i++) - if (STREQN(tokstart, f77_keywords[i].operator, - strlen(f77_keywords[i].operator))) + if (strncmp (tokstart, f77_keywords[i].operator, + strlen(f77_keywords[i].operator)) == 0) { /* lexptr += strlen(f77_keywords[i].operator); */ yylval.opcode = f77_keywords[i].opcode; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 52f56b3..9ad4792 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -462,9 +462,9 @@ const struct language_defn f_language_defn = range_check_on, type_check_on, case_sensitive_off, + &exp_descriptor_standard, f_parse, /* parser */ f_error, /* parser error function */ - evaluate_subexp_standard, f_printchar, /* Print character constant */ f_printstr, /* function to print string constant */ f_emit_char, /* Function to print a single character */ @@ -484,6 +484,7 @@ const struct language_defn f_language_defn = 0, /* arrays are first-class (not c-style) */ 1, /* String lower bound */ &builtin_type_f_character, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -672,8 +673,8 @@ add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab) parser have fits. */ - if (STREQ (name, BLANK_COMMON_NAME_ORIGINAL) || - STREQ (name, BLANK_COMMON_NAME_MF77)) + if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 + || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) { xfree (name); @@ -776,7 +777,7 @@ find_first_common_named (char *name) while (tmp != NULL) { - if (STREQ (tmp->name, name)) + if (strcmp (tmp->name, name) == 0) return (tmp); else tmp = tmp->next; @@ -847,8 +848,8 @@ patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum) /* For blank common blocks, change the canonical reprsentation of a blank name */ - if ((STREQ (name, BLANK_COMMON_NAME_ORIGINAL)) || - (STREQ (name, BLANK_COMMON_NAME_MF77))) + if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 + || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) { xfree (name); name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1); @@ -860,7 +861,7 @@ patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum) while (tmp != NULL) { if (COMMON_NEEDS_PATCHING (tmp)) - if (STREQ (tmp->name, name)) + if (strcmp (tmp->name, name) == 0) patch_common_entries (tmp, offset, secnum); tmp = tmp->next; diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index f6b4263..2a6d232 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -330,6 +330,11 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); break; + case TYPE_CODE_REF: + fprintf_filtered (stream, "REF TO -> ( "); + f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); + break; + case TYPE_CODE_VOID: fprintf_filtered (stream, "VOID"); break; diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index cc337e9..805590f 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -276,6 +276,7 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ + static void f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, CORE_ADDR address, struct ui_file *stream, int format, @@ -295,13 +296,13 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, stream, format, deref_ref, recurse, pretty, elts); fprintf_filtered (stream, ") "); } - if (*elts >= print_max && i < F77_DIM_SIZE (nss)) { + if (*elts >= print_max && i < F77_DIM_SIZE (nss)) fprintf_filtered (stream, "..."); - } } else { - for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++, (*elts)++) + for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < print_max; + i++, (*elts)++) { val_print (TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (ndimensions), @@ -312,7 +313,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, if (i != (F77_DIM_SIZE (nss) - 1)) fprintf_filtered (stream, ", "); - if ((( *elts) == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1))) + if ((*elts == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1))) fprintf_filtered (stream, "..."); } } @@ -383,11 +384,7 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset, deref_ref, recurse, pretty); fprintf_filtered (stream, ")"); break; -#if 0 - /* Array of unspecified length: treat like pointer to first elt. */ - valaddr = (char *) &address; - /* FALL THROUGH */ -#endif + case TYPE_CODE_PTR: if (format && format != 's') { @@ -408,7 +405,7 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset, } if (addressprint && format != 's') - fprintf_filtered (stream, "0x%s", paddr_nz (addr)); + print_address_numeric (addr, 1, stream); /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ @@ -418,9 +415,47 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset, && addr != 0) i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream); - /* Return number of characters printed, plus one for the - terminating null if we have "reached the end". */ - return (i + (print_max && i != print_max)); + /* Return number of characters printed, including the terminating + '\0' if we reached the end. val_print_string takes care including + the terminating '\0' if necessary. */ + return i; + } + break; + + case TYPE_CODE_REF: + elttype = check_typedef (TYPE_TARGET_TYPE (type)); + if (addressprint) + { + CORE_ADDR addr + = extract_typed_address (valaddr + embedded_offset, type); + fprintf_filtered (stream, "@"); + print_address_numeric (addr, 1, stream); + if (deref_ref) + fputs_filtered (": ", stream); + } + /* De-reference the reference. */ + if (deref_ref) + { + if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) + { + struct value *deref_val = + value_at + (TYPE_TARGET_TYPE (type), + unpack_pointer (lookup_pointer_type (builtin_type_void), + valaddr + embedded_offset), + NULL); + val_print (VALUE_TYPE (deref_val), + VALUE_CONTENTS (deref_val), + 0, + VALUE_ADDRESS (deref_val), + stream, + format, + deref_ref, + recurse, + pretty); + } + else + fputs_filtered ("???", stream); } break; diff --git a/gdb/fbsd-proc.c b/gdb/fbsd-proc.c index 6c47979..16813a9 100644 --- a/gdb/fbsd-proc.c +++ b/gdb/fbsd-proc.c @@ -1,5 +1,6 @@ /* FreeBSD-specific methods for using the /proc file system. - Copyright 2002 Free Software Foundation, Inc. + + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -48,34 +49,29 @@ child_pid_to_exec_file (int pid) } static int -read_mapping (FILE *mapfile, - unsigned long *start, - unsigned long *end, +read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end, char *protection) { + /* FreeBSD 5.1-RELEASE uses a 256-byte buffer. */ + char buf[256]; int resident, privateresident; unsigned long obj; - int ref_count, shadow_count; - unsigned flags; - char cow[5], access[4]; - char type[8]; - int ret; - - /* The layout is described in /usr/src/miscfs/procfs/procfs_map.c. */ - ret = fscanf (mapfile, "%lx %lx %d %d %lx %s %d %d %x %s %s %s\n", - start, end, - &resident, &privateresident, &obj, - protection, - &ref_count, &shadow_count, &flags, cow, access, type); + int ret = EOF; + + /* As of FreeBSD 5.0-RELEASE, the layout is described in + /usr/src/sys/fs/procfs/procfs_map.c. Somewhere in 5.1-CURRENT a + new column was added to the procfs map. Therefore we can't use + fscanf since we need to support older releases too. */ + if (fgets (buf, sizeof buf, mapfile) != NULL) + ret = sscanf (buf, "%lx %lx %d %d %lx %s", start, end, + &resident, &privateresident, &obj, protection); return (ret != 0 && ret != EOF); } static int -fbsd_find_memory_regions (int (*func) (CORE_ADDR, - unsigned long, - int, int, int, - void *), +fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long, + int, int, int, void *), void *obfd) { pid_t pid = ptid_get_pid (inferior_ptid); @@ -127,21 +123,20 @@ fbsd_make_corefile_notes (bfd *obfd, int *note_size) gregset_t gregs; fpregset_t fpregs; char *note_data = NULL; + Elf_Internal_Ehdr *i_ehdrp; + + /* Put a "FreeBSD" label in the ELF header. */ + i_ehdrp = elf_elfheader (obfd); + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; fill_gregset (&gregs, -1); - note_data = (char *) elfcore_write_prstatus (obfd, - note_data, - note_size, - ptid_get_pid (inferior_ptid), - stop_signal, - &gregs); + note_data = elfcore_write_prstatus (obfd, note_data, note_size, + ptid_get_pid (inferior_ptid), + stop_signal, &gregs); fill_fpregset (&fpregs, -1); - note_data = (char *) elfcore_write_prfpreg (obfd, - note_data, - note_size, - &fpregs, - sizeof (fpregs)); + note_data = elfcore_write_prfpreg (obfd, note_data, note_size, + &fpregs, sizeof (fpregs)); if (get_exec_file (0)) { @@ -151,11 +146,8 @@ fbsd_make_corefile_notes (bfd *obfd, int *note_size) if (get_inferior_args ()) psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL); - note_data = (char *) elfcore_write_prpsinfo (obfd, - note_data, - note_size, - fname, - psargs); + note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, + fname, psargs); } make_cleanup (xfree, note_data); diff --git a/gdb/findvar.c b/gdb/findvar.c index 1489978..dc82bfe 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -289,16 +289,16 @@ value_of_register (int regnum, struct frame_info *frame) DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum), raw_buffer, VALUE_CONTENTS_RAW (reg_val)); } - else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum)) + else if (DEPRECATED_REGISTER_RAW_SIZE (regnum) == DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)) memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer, - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); else internal_error (__FILE__, __LINE__, "Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size", REGISTER_NAME (regnum), regnum, - REGISTER_RAW_SIZE (regnum), - REGISTER_VIRTUAL_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum), + DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); VALUE_LVAL (reg_val) = lval; VALUE_ADDRESS (reg_val) = addr; VALUE_REGNO (reg_val) = regnum; @@ -647,7 +647,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) /* Copy all of the data out, whereever it may be. */ for (local_regnum = regnum, value_bytes_copied = 0; value_bytes_copied < len; - (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum), + (value_bytes_copied += DEPRECATED_REGISTER_RAW_SIZE (local_regnum), ++local_regnum)) { int realnum; @@ -713,9 +713,9 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) some fiddling with the last register copied here for little endian machines. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && len < REGISTER_RAW_SIZE (regnum)) + && len < DEPRECATED_REGISTER_RAW_SIZE (regnum)) /* Big-endian, and we want less than full size. */ - VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len; + VALUE_OFFSET (v) = DEPRECATED_REGISTER_RAW_SIZE (regnum) - len; else VALUE_OFFSET (v) = 0; memcpy (VALUE_CONTENTS_RAW (v), value_bytes + VALUE_OFFSET (v), len); diff --git a/gdb/frame.c b/gdb/frame.c index 4e88018..a405a6b 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -65,7 +65,7 @@ struct frame_info /* The frame's type. */ /* FIXME: cagney/2003-04-02: Should instead be returning - ->unwind->type. Unfortunatly, legacy code is still explicitly + ->unwind->type. Unfortunately, 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; @@ -144,9 +144,10 @@ static unsigned int backtrace_limit = UINT_MAX; void fprint_frame_id (struct ui_file *file, struct frame_id id) { - fprintf_unfiltered (file, "{stack=0x%s,code=0x%s}", + fprintf_unfiltered (file, "{stack=0x%s,code=0x%s,special=0x%s}", paddr_nz (id.stack_addr), - paddr_nz (id.code_addr)); + paddr_nz (id.code_addr), + paddr_nz (id.special_addr)); } static void @@ -234,7 +235,7 @@ get_frame_id (struct frame_info *fi) fi->unwind = frame_unwind_find_by_frame (fi->next); /* 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 + directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ gdb_assert (fi->unwind->type != UNKNOWN_FRAME); @@ -256,14 +257,22 @@ get_frame_id (struct frame_info *fi) const struct frame_id null_frame_id; /* All zeros. */ struct frame_id -frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr) +frame_id_build_special (CORE_ADDR stack_addr, CORE_ADDR code_addr, + CORE_ADDR special_addr) { struct frame_id id; id.stack_addr = stack_addr; id.code_addr = code_addr; + id.special_addr = special_addr; return id; } +struct frame_id +frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr) +{ + return frame_id_build_special (stack_addr, code_addr, 0); +} + int frame_id_p (struct frame_id l) { @@ -292,8 +301,14 @@ frame_id_eq (struct frame_id l, struct frame_id r) 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. */ + else if (l.code_addr != r.code_addr) + /* If .code addresses are different, the frames are different. */ + eq = 0; + else if (l.special_addr == 0 || r.special_addr == 0) + /* A zero special addr is a wild card (or unused), always succeed. */ + eq = 1; + else if (l.special_addr == r.special_addr) + /* Frames are equal. */ eq = 1; else /* No luck. */ @@ -320,7 +335,7 @@ 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 .stack but - different .code). */ + different .code and/or .special address). */ inner = INNER_THAN (l.stack_addr, r.stack_addr); if (frame_debug) { @@ -477,7 +492,7 @@ frame_pop (struct frame_info *this_frame) 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 + functionality. Unfortunately, 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. @@ -524,7 +539,7 @@ frame_register_unwind (struct frame_info *frame, int regnum, frame->unwind = frame_unwind_find_by_frame (frame->next); /* 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 + directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ gdb_assert (frame->unwind->type != UNKNOWN_FRAME); @@ -629,7 +644,7 @@ frame_unwind_register_signed (struct frame_info *frame, int regnum) { char buf[MAX_REGISTER_SIZE]; frame_unwind_register (frame, regnum, buf); - return extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); + return extract_signed_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); } LONGEST @@ -643,7 +658,7 @@ frame_unwind_register_unsigned (struct frame_info *frame, int regnum) { char buf[MAX_REGISTER_SIZE]; frame_unwind_register (frame, regnum, buf); - return extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); + return extract_unsigned_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); } ULONGEST @@ -658,7 +673,7 @@ frame_unwind_signed_register (struct frame_info *frame, int regnum, { char buf[MAX_REGISTER_SIZE]; frame_unwind_register (frame, regnum, buf); - (*val) = extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); + (*val) = extract_signed_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); } void @@ -667,48 +682,7 @@ frame_unwind_unsigned_register (struct frame_info *frame, int regnum, { char buf[MAX_REGISTER_SIZE]; frame_unwind_register (frame, regnum, buf); - (*val) = extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum)); -} - -void -frame_read_register (struct frame_info *frame, int regnum, void *buf) -{ - gdb_assert (frame != NULL && frame->next != NULL); - frame_unwind_register (frame->next, regnum, buf); -} - -void -frame_read_unsigned_register (struct frame_info *frame, int regnum, - ULONGEST *val) -{ - /* NOTE: cagney/2002-10-31: There is a bit of dogma here - there is - always a frame. Both this, and the equivalent - frame_read_signed_register() function, can only be called with a - valid frame. If, for some reason, this function is called - without a frame then the problem isn't here, but rather in the - caller. It should of first created a frame and then passed that - in. */ - /* NOTE: cagney/2002-10-31: As a side bar, keep in mind that the - ``current_frame'' should not be treated as a special case. While - ``get_next_frame (current_frame) == NULL'' currently holds, it - should, as far as possible, not be relied upon. In the future, - ``get_next_frame (current_frame)'' may instead simply return a - normal frame object that simply always gets register values from - the register cache. Consequently, frame code should try to avoid - tests like ``if get_next_frame() == NULL'' and instead just rely - on recursive frame calls (like the below code) when manipulating - a frame chain. */ - gdb_assert (frame != NULL && frame->next != NULL); - frame_unwind_unsigned_register (frame->next, regnum, val); -} - -void -frame_read_signed_register (struct frame_info *frame, int regnum, - LONGEST *val) -{ - /* See note above in frame_read_unsigned_register(). */ - gdb_assert (frame != NULL && frame->next != NULL); - frame_unwind_signed_register (frame->next, regnum, val); + (*val) = extract_unsigned_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); } void @@ -744,7 +718,8 @@ put_frame_register (struct frame_info *frame, int regnum, const void *buf) /* frame_register_read () Find and return the value of REGNUM for the specified stack frame. - The number of bytes copied is REGISTER_RAW_SIZE (REGNUM). + The number of bytes copied is DEPRECATED_REGISTER_RAW_SIZE + (REGNUM). Returns 0 if the register value could not be found. */ @@ -844,7 +819,7 @@ frame_saved_regs_zalloc (struct frame_info *fi) } CORE_ADDR * -get_frame_saved_regs (struct frame_info *fi) +deprecated_get_frame_saved_regs (struct frame_info *fi) { return fi->saved_regs; } @@ -978,7 +953,7 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, int *realnump, void *bufferp) { /* HACK: New code is passed the next frame and this cache. - Unfortunatly, old code expects this frame. Since this is a + Unfortunately, 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. @@ -986,16 +961,16 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, struct frame_info *frame = next_frame->prev; gdb_assert (frame != NULL); - if (get_frame_saved_regs (frame) == NULL) + if (deprecated_get_frame_saved_regs (frame) == NULL) { /* If nothing's initialized the saved regs, do it now. */ gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ()); DEPRECATED_FRAME_INIT_SAVED_REGS (frame); - gdb_assert (get_frame_saved_regs (frame) != NULL); + gdb_assert (deprecated_get_frame_saved_regs (frame) != NULL); } - if (get_frame_saved_regs (frame) != NULL - && get_frame_saved_regs (frame)[regnum] != 0) + if (deprecated_get_frame_saved_regs (frame) != NULL + && deprecated_get_frame_saved_regs (frame)[regnum] != 0) { if (regnum == SP_REGNUM) { @@ -1007,8 +982,8 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, if (bufferp != NULL) /* NOTE: cagney/2003-05-09: In-lined store_address with it's body - store_unsigned_integer. */ - store_unsigned_integer (bufferp, REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + store_unsigned_integer (bufferp, DEPRECATED_REGISTER_RAW_SIZE (regnum), + deprecated_get_frame_saved_regs (frame)[regnum]); } else { @@ -1016,7 +991,7 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, a local copy of its value. */ *optimizedp = 0; *lvalp = lval_memory; - *addrp = get_frame_saved_regs (frame)[regnum]; + *addrp = deprecated_get_frame_saved_regs (frame)[regnum]; *realnump = -1; if (bufferp != NULL) { @@ -1034,15 +1009,15 @@ legacy_saved_regs_prev_register (struct frame_info *next_frame, if (regs[regnum] == NULL) { regs[regnum] - = frame_obstack_zalloc (REGISTER_RAW_SIZE (regnum)); - read_memory (get_frame_saved_regs (frame)[regnum], regs[regnum], - REGISTER_RAW_SIZE (regnum)); + = frame_obstack_zalloc (DEPRECATED_REGISTER_RAW_SIZE (regnum)); + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], regs[regnum], + DEPRECATED_REGISTER_RAW_SIZE (regnum)); } - memcpy (bufferp, regs[regnum], REGISTER_RAW_SIZE (regnum)); + memcpy (bufferp, regs[regnum], DEPRECATED_REGISTER_RAW_SIZE (regnum)); #else /* Read the value in from memory. */ - read_memory (get_frame_saved_regs (frame)[regnum], bufferp, - REGISTER_RAW_SIZE (regnum)); + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], bufferp, + DEPRECATED_REGISTER_RAW_SIZE (regnum)); #endif } } @@ -1139,8 +1114,8 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized, } DEPRECATED_FRAME_INIT_SAVED_REGS (frame); - if (get_frame_saved_regs (frame) != NULL - && get_frame_saved_regs (frame)[regnum] != 0) + if (deprecated_get_frame_saved_regs (frame) != NULL + && deprecated_get_frame_saved_regs (frame)[regnum] != 0) { if (lval) /* found it saved on the stack */ *lval = lval_memory; @@ -1150,16 +1125,16 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized, /* NOTE: cagney/2003-05-09: In-line store_address with it's body - store_unsigned_integer. */ store_unsigned_integer (raw_buffer, - REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + DEPRECATED_REGISTER_RAW_SIZE (regnum), + deprecated_get_frame_saved_regs (frame)[regnum]); } else { if (addrp) /* any other register */ - *addrp = get_frame_saved_regs (frame)[regnum]; + *addrp = deprecated_get_frame_saved_regs (frame)[regnum]; if (raw_buffer) - read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer, - REGISTER_RAW_SIZE (regnum)); + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer, + DEPRECATED_REGISTER_RAW_SIZE (regnum)); } return; } @@ -1334,7 +1309,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) 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 + Unfortunately 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; @@ -1444,7 +1419,7 @@ legacy_get_prev_frame (struct frame_info *this_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 + info. Unfortunately 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 @@ -1531,7 +1506,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) prev->unwind = frame_unwind_find_by_frame (this_frame->next); /* 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 + directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ prev->type = prev->unwind->type; @@ -2184,7 +2159,7 @@ get_frame_type (struct frame_info *frame) frame->unwind = frame_unwind_find_by_frame (frame->next); /* 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 + directly. Unfortunately, legacy code, called by legacy_get_prev_frame, explicitly set the frames type using the method deprecated_set_frame_type(). */ gdb_assert (frame->unwind->type != UNKNOWN_FRAME); diff --git a/gdb/frame.h b/gdb/frame.h index 7ce81d0..c31f41e 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -95,8 +95,6 @@ struct frame_id 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 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) @@ -104,15 +102,33 @@ struct frame_id 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; + /* The frame's special address. This shall be constant through out the + lifetime of the frame. This is used for architectures that may have + frames that do not change the stack but are still distinct and have + some form of distinct identifier (e.g. the ia64 which uses a 2nd + stack for registers). This field is treated as unordered - i.e. will + not be used in frame ordering comparisons such as frame_id_inner(). + A zero in this field will be treated as a wild-card when comparing + frames for equality. */ + CORE_ADDR special_addr; }; /* Methods for constructing and comparing Frame IDs. - NOTE: Given frameless functions A and B, where A calls B (and hence + NOTE: Given stackless functions A and B, where A calls B (and hence B is inner-to A). The relationships: !eq(A,B); !eq(B,A); - !inner(A,B); !inner(B,A); all hold. This is because, while B is - inner to A, B is not strictly inner to A (being frameless, they - have the same .base value). */ + !inner(A,B); !inner(B,A); all hold. + + This is because, while B is inner-to A, B is not strictly inner-to A. + Being stackless, they have an identical .stack_addr value, and differ + only by their unordered .code_addr and/or .special_addr values. + + Because frame_id_inner is only used as a safety net (e.g., + detect a corrupt stack) the lack of strictness is not a problem. + Code needing to determine an exact relationship between two frames + must instead use frame_id_eq and frame_id_unwind. For instance, + in the above, to determine that A stepped-into B, the equation + "A.id != B.id && A.id == id_unwind (B)" can be used. */ /* For convenience. All fields are zero. */ extern const struct frame_id null_frame_id; @@ -120,10 +136,21 @@ extern const struct frame_id null_frame_id; /* 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). */ + to indicate a wild card). The special identifier address is + defaulted to zero. */ extern struct frame_id frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr); +/* Construct a special frame ID. The first parameter is the frame's constant + stack address (typically the outer-bound), the second is the + frame's constant code address (typically the entry point) (or zero, + to indicate a wild card), and the third parameter is the frame's + special identifier address (or zero to indicate a wild card or + unused default). */ +extern struct frame_id frame_id_build_special (CORE_ADDR stack_addr, + CORE_ADDR code_addr, + CORE_ADDR special_addr); + /* Returns non-zero when L is a valid frame (a valid frame has a non-zero .base). */ extern int frame_id_p (struct frame_id l); @@ -398,22 +425,6 @@ extern void frame_register (struct frame_info *frame, int regnum, CORE_ADDR *addrp, int *realnump, void *valuep); -/* More convenient interface to frame_register(). */ -/* NOTE: cagney/2002-09-13: Return void as one day these functions may - be changed to return an indication that the read succeeded. */ - -/* Use get_frame_register. */ -extern void frame_read_register (struct frame_info *frame, int regnum, - void *buf); - -/* Use get_frame_register_signed. */ -extern void frame_read_signed_register (struct frame_info *frame, - int regnum, LONGEST *val); - -/* Use get_frame_register_unsigned. */ -extern void frame_read_unsigned_register (struct frame_info *frame, - int regnum, ULONGEST *val); - /* The reverse. Store a register value relative to the specified frame. Note: this call makes the frame's state undefined. The register and frame caches must be flushed. */ @@ -591,11 +602,11 @@ extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *, extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); /* 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 - the register is unavailable) if either: the register isn't cached; - or the register has been optimized out. Problem is, neither check - is exactly correct. A register can't be optimized out (it may not + function called get_frame_register_p(). This slightly weird (and + older) variant of get_frame_register() returns zero (indicating the + register is unavailable) if either: the register isn't cached; or + the register has been optimized out. Problem is, neither check is + exactly correct. A register can't be optimized out (it may not have been saved as part of a function call); The fact that a register isn't in the register cache doesn't mean that the register isn't available (it could have been fetched from memory). */ @@ -618,7 +629,7 @@ extern void return_command (char *, int); You might think that the below global can simply be replaced by a call to either get_selected_frame() or select_frame(). - Unfortunatly, it isn't that easy. + Unfortunately, it isn't that easy. The relevant code needs to be audited to determine if it is possible (or pratical) to instead pass the applicable frame in as a @@ -671,7 +682,7 @@ extern struct frame_extra_info *get_frame_extra_info (struct frame_info *fi); SP_REGNUM where the value of the register in the previous frame is stored). */ extern CORE_ADDR *frame_saved_regs_zalloc (struct frame_info *); -extern CORE_ADDR *get_frame_saved_regs (struct frame_info *); +extern CORE_ADDR *deprecated_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 @@ -682,8 +693,8 @@ extern void deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc); /* FIXME: cagney/2002-12-18: Has the frame's base changed? Or to be - more exact, whas that initial guess at the frame's base as returned - by deprecated_read_fp() wrong. If it was, fix it. This shouldn't + more exact, was that initial guess at the frame's base as returned + by deprecated_read_fp() wrong? If it was, fix it. This shouldn't be necessary since the code should be getting the frame's base correct from the outset. diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index fe53e56..e08ebe4 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -30,6 +30,10 @@ #include "frame-base.h" #include "trad-frame.h" #include "dis-asm.h" +#include "gdb_assert.h" +#include "sim-regno.h" +#include "gdb/sim-frv.h" +#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */ extern void _initialize_frv_tdep (void); @@ -37,19 +41,15 @@ static gdbarch_init_ftype frv_gdbarch_init; static gdbarch_register_name_ftype frv_register_name; static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; +static gdbarch_adjust_breakpoint_address_ftype frv_gdbarch_adjust_breakpoint_address; 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_frameless_function_invocation_ftype frv_frameless_function_invocation; static gdbarch_deprecated_push_arguments_ftype frv_push_arguments; static gdbarch_deprecated_saved_pc_after_call_ftype frv_saved_pc_after_call; -/* Register numbers. You can change these as needed, but don't forget - to update the simulator accordingly. */ +/* Register numbers. The order in which these appear define the + remote protocol, so take care in changing them. */ enum { - /* The total number of registers we know exist. */ - frv_num_regs = 147, - /* Register numbers 0 -- 63 are always reserved for general-purpose registers. The chip at hand may have less. */ first_gpr_regnum = 0, @@ -63,10 +63,12 @@ enum { first_fpr_regnum = 64, last_fpr_regnum = 127, - /* Register numbers 128 on up are always reserved for special-purpose - registers. */ - first_spr_regnum = 128, + /* The PC register. */ pc_regnum = 128, + + /* Register numbers 129 on up are always reserved for special-purpose + registers. */ + first_spr_regnum = 129, psr_regnum = 129, ccr_regnum = 130, cccr_regnum = 131, @@ -78,7 +80,21 @@ enum { dbar3_regnum = 140, lr_regnum = 145, lcr_regnum = 146, - last_spr_regnum = 146 + iacc0h_regnum = 147, + iacc0l_regnum = 148, + last_spr_regnum = 148, + + /* The total number of registers we know exist. */ + frv_num_regs = last_spr_regnum + 1, + + /* Pseudo registers */ + first_pseudo_regnum = frv_num_regs, + + /* iacc0 - the 64-bit concatenation of iacc0h and iacc0l. */ + iacc0_regnum = first_pseudo_regnum + 0, + + last_pseudo_regnum = iacc0_regnum, + frv_num_pseudo_regs = last_pseudo_regnum - first_pseudo_regnum + 1, }; static LONGEST frv_call_dummy_words[] = @@ -154,17 +170,14 @@ new_variant (void) /* By default, don't supply any general-purpose or floating-point register names. */ - var->register_names = (char **) xmalloc (frv_num_regs * sizeof (char *)); - for (r = 0; r < frv_num_regs; r++) + var->register_names + = (char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs) + * sizeof (char *)); + for (r = 0; r < frv_num_regs + frv_num_pseudo_regs; r++) var->register_names[r] = ""; - /* Do, however, supply default names for the special-purpose + /* Do, however, supply default names for the known special-purpose registers. */ - for (r = first_spr_regnum; r <= last_spr_regnum; ++r) - { - sprintf (buf, "x%d", r); - var->register_names[r] = xstrdup (buf); - } var->register_names[pc_regnum] = "pc"; var->register_names[lr_regnum] = "lr"; @@ -182,6 +195,11 @@ new_variant (void) var->register_names[dbar2_regnum] = "dbar2"; var->register_names[dbar3_regnum] = "dbar3"; + /* iacc0 (Only found on MB93405.) */ + var->register_names[iacc0h_regnum] = "iacc0h"; + var->register_names[iacc0l_regnum] = "iacc0l"; + var->register_names[iacc0_regnum] = "iacc0"; + return var; } @@ -229,38 +247,93 @@ frv_register_name (int reg) { if (reg < 0) return "?toosmall?"; - if (reg >= frv_num_regs) + if (reg >= frv_num_regs + frv_num_pseudo_regs) return "?toolarge?"; return CURRENT_VARIANT->register_names[reg]; } -static int -frv_register_raw_size (int reg) +static struct type * +frv_register_type (struct gdbarch *gdbarch, int reg) { - return 4; + if (reg >= first_fpr_regnum && reg <= last_fpr_regnum) + return builtin_type_float; + else if (reg == iacc0_regnum) + return builtin_type_int64; + else + return builtin_type_int32; } -static int -frv_register_virtual_size (int reg) +static void +frv_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, + int reg, void *buffer) { - return 4; + if (reg == iacc0_regnum) + { + regcache_raw_read (regcache, iacc0h_regnum, buffer); + regcache_raw_read (regcache, iacc0l_regnum, (bfd_byte *) buffer + 4); + } } -static struct type * -frv_register_virtual_type (int reg) +static void +frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, + int reg, const void *buffer) { - if (reg >= 64 && reg <= 127) - return builtin_type_float; - else - return builtin_type_int; + if (reg == iacc0_regnum) + { + regcache_raw_write (regcache, iacc0h_regnum, buffer); + regcache_raw_write (regcache, iacc0l_regnum, (bfd_byte *) buffer + 4); + } } static int -frv_register_byte (int reg) +frv_register_sim_regno (int reg) { - return (reg * 4); + static const int spr_map[] = + { + H_SPR_PSR, /* psr_regnum */ + H_SPR_CCR, /* ccr_regnum */ + H_SPR_CCCR, /* cccr_regnum */ + -1, /* 132 */ + -1, /* 133 */ + -1, /* 134 */ + H_SPR_TBR, /* tbr_regnum */ + H_SPR_BRR, /* brr_regnum */ + H_SPR_DBAR0, /* dbar0_regnum */ + H_SPR_DBAR1, /* dbar1_regnum */ + H_SPR_DBAR2, /* dbar2_regnum */ + H_SPR_DBAR3, /* dbar3_regnum */ + -1, /* 141 */ + -1, /* 142 */ + -1, /* 143 */ + -1, /* 144 */ + H_SPR_LR, /* lr_regnum */ + H_SPR_LCR, /* lcr_regnum */ + H_SPR_IACC0H, /* iacc0h_regnum */ + H_SPR_IACC0L /* iacc0l_regnum */ + }; + + gdb_assert (reg >= 0 && reg < NUM_REGS); + + if (first_gpr_regnum <= reg && reg <= last_gpr_regnum) + return reg - first_gpr_regnum + SIM_FRV_GR0_REGNUM; + else if (first_fpr_regnum <= reg && reg <= last_fpr_regnum) + return reg - first_fpr_regnum + SIM_FRV_FR0_REGNUM; + else if (pc_regnum == reg) + return SIM_FRV_PC_REGNUM; + else if (reg >= first_spr_regnum + && reg < first_spr_regnum + sizeof (spr_map) / sizeof (spr_map[0])) + { + int spr_reg_offset = spr_map[reg - first_spr_regnum]; + + if (spr_reg_offset < 0) + return SIM_REGNO_DOES_NOT_EXIST; + else + return SIM_FRV_SPR0_REGNUM + spr_reg_offset; + } + + internal_error (__FILE__, __LINE__, "Bad register number %d", reg); } static const unsigned char * @@ -271,6 +344,51 @@ frv_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenp) return breakpoint; } +/* Define the maximum number of instructions which may be packed into a + bundle (VLIW instruction). */ +static const int max_instrs_per_bundle = 8; + +/* Define the size (in bytes) of an FR-V instruction. */ +static const int frv_instr_size = 4; + +/* Adjust a breakpoint's address to account for the FR-V architecture's + constraint that a break instruction must not appear as any but the + first instruction in the bundle. */ +static CORE_ADDR +frv_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr) +{ + int count = max_instrs_per_bundle; + CORE_ADDR addr = bpaddr - frv_instr_size; + CORE_ADDR func_start = get_pc_function_start (bpaddr); + + /* Find the end of the previous packing sequence. This will be indicated + by either attempting to access some inaccessible memory or by finding + an instruction word whose packing bit is set to one. */ + while (count-- > 0 && addr >= func_start) + { + char instr[frv_instr_size]; + int status; + + status = read_memory_nobpt (addr, instr, sizeof instr); + + if (status != 0) + break; + + /* This is a big endian architecture, so byte zero will have most + significant byte. The most significant bit of this byte is the + packing bit. */ + if (instr[0] & 0x80) + break; + + addr -= frv_instr_size; + } + + if (count > 0) + bpaddr = addr + frv_instr_size; + + return bpaddr; +} + /* Return true if REG is a caller-saves ("scratch") register, false otherwise. */ @@ -732,20 +850,35 @@ frv_frame_unwind_cache (struct frame_info *next_frame, } static void -frv_extract_return_value (struct type *type, char *regbuf, char *valbuf) +frv_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) { - memcpy (valbuf, (regbuf - + frv_register_byte (8) - + (TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0)), - TYPE_LENGTH (type)); + int len = TYPE_LENGTH (type); + + if (len <= 4) + { + ULONGEST gpr8_val; + regcache_cooked_read_unsigned (regcache, 8, &gpr8_val); + store_unsigned_integer (valbuf, len, gpr8_val); + } + else if (len == 8) + { + ULONGEST regval; + regcache_cooked_read_unsigned (regcache, 8, ®val); + store_unsigned_integer (valbuf, 4, regval); + regcache_cooked_read_unsigned (regcache, 9, ®val); + store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, regval); + } + else + internal_error (__FILE__, __LINE__, "Illegal return value length: %d", len); } static CORE_ADDR -frv_extract_struct_value_address (char *regbuf) +frv_extract_struct_value_address (struct regcache *regcache) { - return extract_unsigned_integer (regbuf + - frv_register_byte (struct_return_regnum), - 4); + ULONGEST addr; + regcache_cooked_read_unsigned (regcache, struct_return_regnum, &addr); + return addr; } static void @@ -760,14 +893,11 @@ frv_frameless_function_invocation (struct frame_info *frame) return frameless_look_for_prologue (frame); } -#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1)) -#define ROUND_DOWN(n,a) ((n) & ~((a)-1)) - static CORE_ADDR frv_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) { /* Require dword alignment. */ - return ROUND_DOWN (sp, 8); + return align_down (sp, 8); } static CORE_ADDR @@ -795,14 +925,14 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, stack_space = 0; for (argnum = 0; argnum < nargs; ++argnum) - stack_space += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), 4); + stack_space += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), 4); stack_space -= (6 * 4); if (stack_space > 0) sp -= stack_space; /* Make sure stack is dword aligned. */ - sp = ROUND_DOWN (sp, 8); + sp = align_down (sp, 8); stack_offset = 0; @@ -852,7 +982,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, argnum, *((int *)val), stack_offset, (int) (sp + stack_offset)); #endif write_memory (sp + stack_offset, val, partial_len); - stack_offset += ROUND_UP(partial_len, 4); + stack_offset += align_up (partial_len, 4); } len -= partial_len; val += partial_len; @@ -870,19 +1000,26 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, } static void -frv_store_return_value (struct type *type, char *valbuf) +frv_store_return_value (struct type *type, struct regcache *regcache, + const void *valbuf) { - int length = TYPE_LENGTH (type); - int reg8_offset = frv_register_byte (8); - - if (length <= 4) - deprecated_write_register_bytes (reg8_offset + (4 - length), valbuf, - length); - else if (length == 8) - deprecated_write_register_bytes (reg8_offset, valbuf, length); + int len = TYPE_LENGTH (type); + + if (len <= 4) + { + bfd_byte val[4]; + memset (val, 0, sizeof (val)); + memcpy (val + (4 - len), valbuf, len); + regcache_cooked_write (regcache, 8, val); + } + else if (len == 8) + { + regcache_cooked_write (regcache, 8, valbuf); + regcache_cooked_write (regcache, 9, (bfd_byte *) valbuf + 4); + } else internal_error (__FILE__, __LINE__, - "Don't know how to return a %d-byte value.", length); + "Don't know how to return a %d-byte value.", len); } @@ -966,7 +1103,7 @@ frv_frame_this_id (struct frame_info *next_frame, /* This is meant to halt the backtrace at "_start". Make sure we don't halt it at a generic dummy frame. */ - if (deprecated_inside_entry_file (func)) + if (inside_entry_func (func)) return; /* Check if the stack is empty. */ @@ -1101,32 +1238,32 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_num_regs (gdbarch, frv_num_regs); + set_gdbarch_num_pseudo_regs (gdbarch, frv_num_pseudo_regs); + set_gdbarch_sp_regnum (gdbarch, sp_regnum); set_gdbarch_deprecated_fp_regnum (gdbarch, fp_regnum); set_gdbarch_pc_regnum (gdbarch, pc_regnum); set_gdbarch_register_name (gdbarch, frv_register_name); - set_gdbarch_deprecated_register_size (gdbarch, 4); - set_gdbarch_deprecated_register_bytes (gdbarch, frv_num_regs * 4); - set_gdbarch_deprecated_register_byte (gdbarch, frv_register_byte); - set_gdbarch_deprecated_register_raw_size (gdbarch, frv_register_raw_size); - set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); - set_gdbarch_deprecated_register_virtual_size (gdbarch, frv_register_virtual_size); - set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4); - set_gdbarch_deprecated_register_virtual_type (gdbarch, frv_register_virtual_type); + set_gdbarch_register_type (gdbarch, frv_register_type); + set_gdbarch_register_sim_regno (gdbarch, frv_register_sim_regno); + + set_gdbarch_pseudo_register_read (gdbarch, frv_pseudo_register_read); + set_gdbarch_pseudo_register_write (gdbarch, frv_pseudo_register_write); set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue); set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc); + set_gdbarch_adjust_breakpoint_address (gdbarch, frv_gdbarch_adjust_breakpoint_address); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); - set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, frv_extract_return_value); 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); + set_gdbarch_store_return_value (gdbarch, frv_store_return_value); + set_gdbarch_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); /* Frame stuff. */ set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc); diff --git a/gdb/gcore.c b/gdb/gcore.c index 5bf09fd..d1525dd 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -62,7 +62,7 @@ gcore_command (char *args, int from_tty) } if (info_verbose) - fprintf_filtered (gdb_stdout, + fprintf_filtered (gdb_stdout, "Opening corefile '%s' for output.\n", corefilename); /* Open the output file. */ @@ -84,11 +84,11 @@ gcore_command (char *args, int from_tty) { note_sec = bfd_make_section_anyway (obfd, "note0"); if (note_sec == NULL) - error ("Failed to create 'note' section for corefile: %s", + error ("Failed to create 'note' section for corefile: %s", bfd_errmsg (bfd_get_error ())); bfd_set_section_vma (obfd, note_sec, 0); - bfd_set_section_flags (obfd, note_sec, + bfd_set_section_flags (obfd, note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_ALLOC); bfd_set_section_alignment (obfd, note_sec, 0); bfd_set_section_size (obfd, note_sec, note_size); @@ -161,7 +161,7 @@ default_gcore_target (void) and store its limits in *BOTTOM and *TOP. Return non-zero if successful. */ -static int +static int derive_stack_segment (bfd_vma *bottom, bfd_vma *top) { struct frame_info *fi, *tmp_fi; @@ -209,7 +209,7 @@ derive_stack_segment (bfd_vma *bottom, bfd_vma *top) the static data sections. Store its limits in *BOTTOM and *TOP. Return non-zero if successful. */ -static int +static int derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) { bfd_vma top_of_data_memory = 0; @@ -285,7 +285,6 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) return 0; } -/* ARGSUSED */ static void make_output_phdrs (bfd *obfd, asection *osec, void *ignored) { @@ -307,55 +306,73 @@ make_output_phdrs (bfd *obfd, asection *osec, void *ignored) bfd_record_phdr (obfd, p_type, 1, p_flags, 0, 0, 0, 0, 1, &osec); } -static asection * -make_mem_sec (bfd *obfd, bfd_vma addr, bfd_size_type size, - unsigned int flags, unsigned int alignment) +static int +gcore_create_callback (CORE_ADDR vaddr, unsigned long size, + int read, int write, int exec, void *data) { + bfd *obfd = data; asection *osec; + flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD; + + if (write == 0) + { + /* See if this region of memory lies inside a known file on disk. + If so, we can avoid copying its contents by clearing SEC_LOAD. */ + struct objfile *objfile; + struct obj_section *objsec; + + ALL_OBJSECTIONS (objfile, objsec) + { + bfd *abfd = objfile->obfd; + asection *asec = objsec->the_bfd_section; + bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd, + asec); + bfd_vma start = objsec->addr & -align; + bfd_vma end = (objsec->endaddr + align - 1) & -align; + /* Match if either the entire memory region lies inside the + section (i.e. a mapping covering some pages of a large + segment) or the entire section lies inside the memory region + (i.e. a mapping covering multiple small sections). + + This BFD was synthesized from reading target memory, + we don't want to omit that. */ + if (((vaddr >= start && vaddr + size <= end) + || (start >= vaddr && end <= vaddr + size)) + && !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY)) + { + flags &= ~SEC_LOAD; + goto keep; /* break out of two nested for loops */ + } + } + + keep: + flags |= SEC_READONLY; + } + + if (exec) + flags |= SEC_CODE; + else + flags |= SEC_DATA; osec = bfd_make_section_anyway (obfd, "load"); if (osec == NULL) { warning ("Couldn't make gcore segment: %s", bfd_errmsg (bfd_get_error ())); - return NULL; + return 1; } if (info_verbose) { fprintf_filtered (gdb_stdout, "Save segment, %lld bytes at 0x%s\n", - (long long) size, paddr_nz (addr)); + (long long) size, paddr_nz (vaddr)); } bfd_set_section_size (obfd, osec, size); - bfd_set_section_vma (obfd, osec, addr); + bfd_set_section_vma (obfd, osec, vaddr); bfd_section_lma (obfd, osec) = 0; /* ??? bfd_set_section_lma? */ - bfd_set_section_alignment (obfd, osec, alignment); - bfd_set_section_flags (obfd, osec, - flags | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS); - return osec; -} - -static int -gcore_create_callback (CORE_ADDR vaddr, unsigned long size, - int read, int write, int exec, void *data) -{ - flagword flags = 0; - - if (write == 0) - { - flags |= SEC_READONLY; - /* Mark readonly sections as zero-sized, such that we can avoid - copying their contents. */ - size = 0; - } - - if (exec) - flags |= SEC_CODE; - else - flags |= SEC_DATA; - - return ((make_mem_sec (data, vaddr, size, flags, 0)) == NULL); + bfd_set_section_flags (obfd, osec, flags); + return 0; } static int @@ -381,7 +398,7 @@ objfile_find_memory_regions (int (*func) (CORE_ADDR, unsigned long, int size = bfd_section_size (ibfd, isec); int ret; - ret = (*func) (objsec->addr, bfd_section_size (ibfd, isec), + ret = (*func) (objsec->addr, bfd_section_size (ibfd, isec), 1, /* All sections will be readable. */ (flags & SEC_READONLY) == 0, /* Writable. */ (flags & SEC_CODE) != 0, /* Executable. */ @@ -393,7 +410,7 @@ objfile_find_memory_regions (int (*func) (CORE_ADDR, unsigned long, /* Make a stack segment. */ if (derive_stack_segment (&temp_bottom, &temp_top)) - (*func) (temp_bottom, temp_top - temp_bottom, + (*func) (temp_bottom, temp_top - temp_bottom, 1, /* Stack section will be readable. */ 1, /* Stack section will be writable. */ 0, /* Stack section will not be executable. */ @@ -417,9 +434,8 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) struct cleanup *old_chain = NULL; void *memhunk; - /* Read-only sections are marked as zero-size. We don't have to - copy their contents. */ - if (size == 0) + /* Read-only sections are marked; we don't have to copy their contents. */ + if ((bfd_get_section_flags (obfd, osec) & SEC_LOAD) == 0) return; /* Only interested in "load" sections. */ @@ -432,12 +448,12 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) error ("Not enough memory to create corefile."); old_chain = make_cleanup (xfree, memhunk); - if (target_read_memory (bfd_section_vma (obfd, osec), + if (target_read_memory (bfd_section_vma (obfd, osec), memhunk, size) != 0) warning ("Memory read failed for corefile section, %ld bytes at 0x%s\n", (long) size, paddr (bfd_section_vma (obfd, osec))); if (!bfd_set_section_contents (obfd, osec, memhunk, 0, size)) - warning ("Failed to write corefile contents (%s).", + warning ("Failed to write corefile contents (%s).", bfd_errmsg (bfd_get_error ())); do_cleanups (old_chain); /* Frees MEMHUNK. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 974a3c0..f73a4f6 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -52,12 +52,7 @@ /* Static function declarations */ -static void verify_gdbarch (struct gdbarch *gdbarch); static void alloc_gdbarch_data (struct gdbarch *); -static void init_gdbarch_swap (struct gdbarch *); -static void clear_gdbarch_swap (struct gdbarch *); -static void swapout_gdbarch_swap (struct gdbarch *); -static void swapin_gdbarch_swap (struct gdbarch *); /* Non-zero if we want to trace architecture code. */ @@ -203,22 +198,24 @@ struct gdbarch gdbarch_pointer_to_address_ftype *pointer_to_address; 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_deprecated_pop_frame_ftype *deprecated_pop_frame; gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return; + gdbarch_return_value_ftype *return_value; + gdbarch_return_value_on_stack_ftype *return_value_on_stack; 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; gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value; + gdbarch_use_struct_convention_ftype *use_struct_convention; gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address; - gdbarch_use_struct_convention_ftype *use_struct_convention; gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs; gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info; gdbarch_skip_prologue_ftype *skip_prologue; gdbarch_prologue_frameless_p_ftype *prologue_frameless_p; gdbarch_inner_than_ftype *inner_than; gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; + gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; CORE_ADDR decr_pc_after_break; @@ -238,6 +235,7 @@ struct gdbarch gdbarch_deprecated_stack_align_ftype *deprecated_stack_align; gdbarch_frame_align_ftype *frame_align; gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr; + gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr; int frame_red_zone_size; int parm_boundary; const struct floatformat * float_format; @@ -249,6 +247,7 @@ struct gdbarch gdbarch_software_single_step_ftype *software_single_step; gdbarch_print_insn_ftype *print_insn; gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; + gdbarch_skip_solib_resolver_ftype *skip_solib_resolver; gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline; gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp; @@ -266,6 +265,7 @@ struct gdbarch gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags; gdbarch_register_reggroup_p_ftype *register_reggroup_p; gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument; + gdbarch_regset_from_core_section_ftype *regset_from_core_section; }; @@ -371,22 +371,24 @@ struct gdbarch startup_gdbarch = 0, /* pointer_to_address */ 0, /* address_to_pointer */ 0, /* integer_to_address */ - 0, /* return_value_on_stack */ 0, /* deprecated_pop_frame */ 0, /* deprecated_store_struct_return */ + 0, /* return_value */ + 0, /* return_value_on_stack */ 0, /* extract_return_value */ 0, /* store_return_value */ 0, /* deprecated_extract_return_value */ 0, /* deprecated_store_return_value */ + 0, /* use_struct_convention */ 0, /* extract_struct_value_address */ 0, /* deprecated_extract_struct_value_address */ - 0, /* use_struct_convention */ 0, /* deprecated_frame_init_saved_regs */ 0, /* deprecated_init_extra_frame_info */ 0, /* skip_prologue */ 0, /* prologue_frameless_p */ 0, /* inner_than */ 0, /* breakpoint_from_pc */ + 0, /* adjust_breakpoint_address */ 0, /* memory_insert_breakpoint */ 0, /* memory_remove_breakpoint */ 0, /* decr_pc_after_break */ @@ -406,17 +408,19 @@ struct gdbarch startup_gdbarch = 0, /* deprecated_stack_align */ 0, /* frame_align */ 0, /* deprecated_reg_struct_has_addr */ + default_stabs_argument_has_addr, /* stabs_argument_has_addr */ 0, /* frame_red_zone_size */ 0, /* parm_boundary */ 0, /* float_format */ 0, /* double_format */ 0, /* long_double_format */ - 0, /* convert_from_func_ptr_addr */ + convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */ 0, /* addr_bits_remove */ 0, /* smash_text_address */ 0, /* software_single_step */ 0, /* print_insn */ 0, /* skip_trampoline_code */ + 0, /* skip_solib_resolver */ 0, /* in_solib_call_trampoline */ 0, /* in_solib_return_trampoline */ 0, /* pc_in_sigtramp */ @@ -434,24 +438,12 @@ struct gdbarch startup_gdbarch = 0, /* address_class_name_to_type_flags */ default_register_reggroup_p, /* register_reggroup_p */ 0, /* fetch_pointer_argument */ + 0, /* regset_from_core_section */ /* startup_gdbarch() */ }; struct gdbarch *current_gdbarch = &startup_gdbarch; -/* Do any initialization needed for a non-multiarch configuration - after the _initialize_MODULE functions have been run. */ -void -initialize_non_multiarch (void) -{ - alloc_gdbarch_data (&startup_gdbarch); - /* Ensure that all swap areas are zeroed so that they again think - they are starting from scratch. */ - clear_gdbarch_swap (&startup_gdbarch); - init_gdbarch_swap (&startup_gdbarch); -} - - /* Create a new ``struct gdbarch'' based on information provided by ``struct gdbarch_info''. */ @@ -540,10 +532,12 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; current_gdbarch->deprecated_frame_args_address = get_frame_base; current_gdbarch->deprecated_frame_locals_address = get_frame_base; - current_gdbarch->convert_from_func_ptr_addr = core_addr_identity; + current_gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr; + current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity; current_gdbarch->addr_bits_remove = core_addr_identity; current_gdbarch->smash_text_address = core_addr_identity; current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code; + current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver; current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline; current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; current_gdbarch->pc_in_sigtramp = legacy_pc_in_sigtramp; @@ -588,10 +582,16 @@ gdbarch_free (struct gdbarch *arch) } -/* Ensure that all values in a GDBARCH are reasonable. */ +/* Ensure that all values in a GDBARCH are reasonable. */ + +/* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it + just happens to match the global variable ``current_gdbarch''. That + way macros refering to that variable get the local and not the global + version - ulgh. Once everything is parameterised with gdbarch, this + will go away. */ static void -verify_gdbarch (struct gdbarch *gdbarch) +verify_gdbarch (struct gdbarch *current_gdbarch) { struct ui_file *log; struct cleanup *cleanups; @@ -600,9 +600,9 @@ verify_gdbarch (struct gdbarch *gdbarch) log = mem_fileopen (); cleanups = make_cleanup_ui_file_delete (log); /* fundamental */ - if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN) + if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN) fprintf_unfiltered (log, "\n\tbyte-order"); - if (gdbarch->bfd_arch_info == NULL) + if (current_gdbarch->bfd_arch_info == NULL) fprintf_unfiltered (log, "\n\tbfd_arch_info"); /* Check those that need to be defined for the given multi-arch level. */ /* Skip verify of short_bit, invalid_p == 0 */ @@ -613,11 +613,11 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of double_bit, invalid_p == 0 */ /* Skip verify of long_double_bit, invalid_p == 0 */ /* Skip verify of ptr_bit, invalid_p == 0 */ - if (gdbarch->addr_bit == 0) - gdbarch->addr_bit = TARGET_PTR_BIT; + if (current_gdbarch->addr_bit == 0) + current_gdbarch->addr_bit = TARGET_PTR_BIT; /* Skip verify of bfd_vma_bit, invalid_p == 0 */ - if (gdbarch->char_signed == -1) - gdbarch->char_signed = 1; + if (current_gdbarch->char_signed == -1) + current_gdbarch->char_signed = 1; /* Skip verify of read_pc, has predicate */ /* Skip verify of write_pc, invalid_p == 0 */ /* Skip verify of read_sp, has predicate */ @@ -625,7 +625,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of pseudo_register_read, has predicate */ /* Skip verify of pseudo_register_write, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->num_regs == -1)) + && (current_gdbarch->num_regs == -1)) fprintf_unfiltered (log, "\n\tnum_regs"); /* Skip verify of num_pseudo_regs, invalid_p == 0 */ /* Skip verify of sp_regnum, invalid_p == 0 */ @@ -685,37 +685,39 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of pointer_to_address, invalid_p == 0 */ /* 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 deprecated_pop_frame, has predicate */ /* Skip verify of deprecated_store_struct_return, has predicate */ + /* Skip verify of return_value, has predicate */ + /* Skip verify of return_value_on_stack, invalid_p == 0 */ /* Skip verify of extract_return_value, invalid_p == 0 */ /* Skip verify of store_return_value, invalid_p == 0 */ + /* Skip verify of use_struct_convention, invalid_p == 0 */ /* Skip verify of extract_struct_value_address, has predicate */ /* Skip verify of deprecated_extract_struct_value_address, has predicate */ - /* Skip verify of use_struct_convention, invalid_p == 0 */ /* Skip verify of deprecated_frame_init_saved_regs, has predicate */ /* Skip verify of deprecated_init_extra_frame_info, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->skip_prologue == 0)) + && (current_gdbarch->skip_prologue == 0)) fprintf_unfiltered (log, "\n\tskip_prologue"); /* Skip verify of prologue_frameless_p, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->inner_than == 0)) + && (current_gdbarch->inner_than == 0)) fprintf_unfiltered (log, "\n\tinner_than"); if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->breakpoint_from_pc == 0)) + && (current_gdbarch->breakpoint_from_pc == 0)) fprintf_unfiltered (log, "\n\tbreakpoint_from_pc"); + /* Skip verify of adjust_breakpoint_address, has predicate */ /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */ /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->decr_pc_after_break == -1)) + && (current_gdbarch->decr_pc_after_break == -1)) fprintf_unfiltered (log, "\n\tdecr_pc_after_break"); if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->function_start_offset == -1)) + && (current_gdbarch->function_start_offset == -1)) fprintf_unfiltered (log, "\n\tfunction_start_offset"); /* Skip verify of remote_translate_xfer_address, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->frame_args_skip == -1)) + && (current_gdbarch->frame_args_skip == -1)) fprintf_unfiltered (log, "\n\tframe_args_skip"); /* Skip verify of frameless_function_invocation, invalid_p == 0 */ /* Skip verify of deprecated_frame_chain, has predicate */ @@ -730,20 +732,22 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of deprecated_stack_align, has predicate */ /* Skip verify of frame_align, has predicate */ /* Skip verify of deprecated_reg_struct_has_addr, has predicate */ - if (gdbarch->float_format == 0) - gdbarch->float_format = default_float_format (gdbarch); - if (gdbarch->double_format == 0) - gdbarch->double_format = default_double_format (gdbarch); - if (gdbarch->long_double_format == 0) - gdbarch->long_double_format = default_double_format (gdbarch); + /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */ + if (current_gdbarch->float_format == 0) + current_gdbarch->float_format = default_float_format (current_gdbarch); + if (current_gdbarch->double_format == 0) + current_gdbarch->double_format = default_double_format (current_gdbarch); + if (current_gdbarch->long_double_format == 0) + current_gdbarch->long_double_format = default_double_format (current_gdbarch); /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ /* Skip verify of addr_bits_remove, invalid_p == 0 */ /* Skip verify of smash_text_address, invalid_p == 0 */ /* Skip verify of software_single_step, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->print_insn == 0)) + && (current_gdbarch->print_insn == 0)) fprintf_unfiltered (log, "\n\tprint_insn"); /* Skip verify of skip_trampoline_code, invalid_p == 0 */ + /* Skip verify of skip_solib_resolver, invalid_p == 0 */ /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */ /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ /* Skip verify of pc_in_sigtramp, invalid_p == 0 */ @@ -761,6 +765,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_class_name_to_type_flags, has predicate */ /* Skip verify of register_reggroup_p, invalid_p == 0 */ /* Skip verify of fetch_pointer_argument, has predicate */ + /* Skip verify of regset_from_core_section, has predicate */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -780,24 +785,42 @@ verify_gdbarch (struct gdbarch *gdbarch) will go away. */ void -gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) +gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) { fprintf_unfiltered (file, "gdbarch_dump: GDB_MULTI_ARCH = %d\n", GDB_MULTI_ARCH); fprintf_unfiltered (file, + "gdbarch_dump: convert_from_func_ptr_addr = 0x%08lx\n", + (long) current_gdbarch->convert_from_func_ptr_addr); + fprintf_unfiltered (file, "gdbarch_dump: gdbarch_frame_align_p() = %d\n", gdbarch_frame_align_p (current_gdbarch)); fprintf_unfiltered (file, "gdbarch_dump: frame_align = 0x%08lx\n", (long) current_gdbarch->frame_align); fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n", + gdbarch_regset_from_core_section_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: regset_from_core_section = 0x%08lx\n", + (long) current_gdbarch->regset_from_core_section); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_return_value_p() = %d\n", + gdbarch_return_value_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: return_value = 0x%08lx\n", + (long) current_gdbarch->return_value); + fprintf_unfiltered (file, "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", (long) current_gdbarch->in_function_epilogue_p); fprintf_unfiltered (file, "gdbarch_dump: register_reggroup_p = 0x%08lx\n", (long) current_gdbarch->register_reggroup_p); fprintf_unfiltered (file, + "gdbarch_dump: stabs_argument_has_addr = 0x%08lx\n", + (long) current_gdbarch->stabs_argument_has_addr); + fprintf_unfiltered (file, "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n", gdbarch_pseudo_register_read_p (current_gdbarch)); fprintf_unfiltered (file, @@ -860,6 +883,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->addr_bits_remove /*ADDR_BITS_REMOVE ()*/); #endif + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n", + gdbarch_adjust_breakpoint_address_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: adjust_breakpoint_address = 0x%08lx\n", + (long) current_gdbarch->adjust_breakpoint_address); #ifdef BELIEVE_PCC_PROMOTION fprintf_unfiltered (file, "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n", @@ -935,16 +964,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: construct_inferior_arguments = 0x%08lx\n", (long) current_gdbarch->construct_inferior_arguments); -#ifdef CONVERT_FROM_FUNC_PTR_ADDR - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "CONVERT_FROM_FUNC_PTR_ADDR(addr)", - XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr))); - fprintf_unfiltered (file, - "gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = <0x%08lx>\n", - (long) current_gdbarch->convert_from_func_ptr_addr - /*CONVERT_FROM_FUNC_PTR_ADDR ()*/); -#endif #ifdef CONVERT_REGISTER_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1517,6 +1536,25 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_register_convert_to_virtual /*DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL ()*/); #endif +#ifdef DEPRECATED_REGISTER_RAW_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_RAW_SIZE_P()", + XSTRING (DEPRECATED_REGISTER_RAW_SIZE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_RAW_SIZE_P() = %d\n", + DEPRECATED_REGISTER_RAW_SIZE_P ()); +#endif +#ifdef DEPRECATED_REGISTER_RAW_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_RAW_SIZE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_RAW_SIZE (reg_nr))); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_RAW_SIZE = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_raw_size + /*DEPRECATED_REGISTER_RAW_SIZE ()*/); +#endif #ifdef DEPRECATED_REGISTER_SIZE fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n", @@ -1525,6 +1563,44 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DEPRECATED_REGISTER_SIZE = %d\n", DEPRECATED_REGISTER_SIZE); #endif +#ifdef DEPRECATED_REGISTER_VIRTUAL_SIZE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_SIZE_P()", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_SIZE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_VIRTUAL_SIZE_P() = %d\n", + DEPRECATED_REGISTER_VIRTUAL_SIZE_P ()); +#endif +#ifdef DEPRECATED_REGISTER_VIRTUAL_SIZE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_SIZE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_SIZE (reg_nr))); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_VIRTUAL_SIZE = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_virtual_size + /*DEPRECATED_REGISTER_VIRTUAL_SIZE ()*/); +#endif +#ifdef DEPRECATED_REGISTER_VIRTUAL_TYPE_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_TYPE_P()", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_TYPE_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_VIRTUAL_TYPE_P() = %d\n", + DEPRECATED_REGISTER_VIRTUAL_TYPE_P ()); +#endif +#ifdef DEPRECATED_REGISTER_VIRTUAL_TYPE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_REGISTER_VIRTUAL_TYPE(reg_nr)", + XSTRING (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr))); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_REGISTER_VIRTUAL_TYPE = <0x%08lx>\n", + (long) current_gdbarch->deprecated_register_virtual_type + /*DEPRECATED_REGISTER_VIRTUAL_TYPE ()*/); +#endif #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2044,25 +2120,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->register_name /*REGISTER_NAME ()*/); #endif -#ifdef REGISTER_RAW_SIZE_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_RAW_SIZE_P()", - XSTRING (REGISTER_RAW_SIZE_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_RAW_SIZE_P() = %d\n", - REGISTER_RAW_SIZE_P ()); -#endif -#ifdef REGISTER_RAW_SIZE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_RAW_SIZE(reg_nr)", - XSTRING (REGISTER_RAW_SIZE (reg_nr))); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_RAW_SIZE = <0x%08lx>\n", - (long) current_gdbarch->deprecated_register_raw_size - /*REGISTER_RAW_SIZE ()*/); -#endif #ifdef REGISTER_SIM_REGNO fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2089,44 +2146,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: register_type = 0x%08lx\n", (long) current_gdbarch->register_type); -#ifdef REGISTER_VIRTUAL_SIZE_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_VIRTUAL_SIZE_P()", - XSTRING (REGISTER_VIRTUAL_SIZE_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_VIRTUAL_SIZE_P() = %d\n", - REGISTER_VIRTUAL_SIZE_P ()); -#endif -#ifdef REGISTER_VIRTUAL_SIZE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_VIRTUAL_SIZE(reg_nr)", - XSTRING (REGISTER_VIRTUAL_SIZE (reg_nr))); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_VIRTUAL_SIZE = <0x%08lx>\n", - (long) current_gdbarch->deprecated_register_virtual_size - /*REGISTER_VIRTUAL_SIZE ()*/); -#endif -#ifdef REGISTER_VIRTUAL_TYPE_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_VIRTUAL_TYPE_P()", - XSTRING (REGISTER_VIRTUAL_TYPE_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_VIRTUAL_TYPE_P() = %d\n", - REGISTER_VIRTUAL_TYPE_P ()); -#endif -#ifdef REGISTER_VIRTUAL_TYPE - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "REGISTER_VIRTUAL_TYPE(reg_nr)", - XSTRING (REGISTER_VIRTUAL_TYPE (reg_nr))); - fprintf_unfiltered (file, - "gdbarch_dump: REGISTER_VIRTUAL_TYPE = <0x%08lx>\n", - (long) current_gdbarch->deprecated_register_virtual_type - /*REGISTER_VIRTUAL_TYPE ()*/); -#endif fprintf_unfiltered (file, "gdbarch_dump: remote_translate_xfer_address = 0x%08lx\n", (long) current_gdbarch->remote_translate_xfer_address); @@ -2198,6 +2217,16 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->skip_prologue /*SKIP_PROLOGUE ()*/); #endif +#ifdef SKIP_SOLIB_RESOLVER + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SKIP_SOLIB_RESOLVER(pc)", + XSTRING (SKIP_SOLIB_RESOLVER (pc))); + fprintf_unfiltered (file, + "gdbarch_dump: SKIP_SOLIB_RESOLVER = <0x%08lx>\n", + (long) current_gdbarch->skip_solib_resolver + /*SKIP_SOLIB_RESOLVER ()*/); +#endif #ifdef SKIP_TRAMPOLINE_CODE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4205,23 +4234,6 @@ set_gdbarch_integer_to_address (struct gdbarch *gdbarch, } int -gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->return_value_on_stack != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n"); - return gdbarch->return_value_on_stack (type); -} - -void -set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, - gdbarch_return_value_on_stack_ftype return_value_on_stack) -{ - gdbarch->return_value_on_stack = return_value_on_stack; -} - -int gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -4269,6 +4281,47 @@ set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, gdbarch->deprecated_store_struct_return = deprecated_store_struct_return; } +int +gdbarch_return_value_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->return_value != NULL; +} + +enum return_value_convention +gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->return_value != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n"); + return gdbarch->return_value (gdbarch, valtype, regcache, readbuf, writebuf); +} + +void +set_gdbarch_return_value (struct gdbarch *gdbarch, + gdbarch_return_value_ftype return_value) +{ + gdbarch->return_value = return_value; +} + +int +gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->return_value_on_stack != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n"); + return gdbarch->return_value_on_stack (type); +} + +void +set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, + gdbarch_return_value_on_stack_ftype return_value_on_stack) +{ + gdbarch->return_value_on_stack = return_value_on_stack; +} + void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf) { @@ -4338,6 +4391,23 @@ set_gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, } int +gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->use_struct_convention != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_use_struct_convention called\n"); + return gdbarch->use_struct_convention (gcc_p, value_type); +} + +void +set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, + gdbarch_use_struct_convention_ftype use_struct_convention) +{ + gdbarch->use_struct_convention = use_struct_convention; +} + +int gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -4386,23 +4456,6 @@ set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, } int -gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->use_struct_convention != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_use_struct_convention called\n"); - return gdbarch->use_struct_convention (gcc_p, value_type); -} - -void -set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, - gdbarch_use_struct_convention_ftype use_struct_convention) -{ - gdbarch->use_struct_convention = use_struct_convention; -} - -int gdbarch_deprecated_frame_init_saved_regs_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -4519,6 +4572,30 @@ set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, } int +gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->adjust_breakpoint_address != NULL; +} + +CORE_ADDR +gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->adjust_breakpoint_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_adjust_breakpoint_address called\n"); + return gdbarch->adjust_breakpoint_address (gdbarch, bpaddr); +} + +void +set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, + gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address) +{ + gdbarch->adjust_breakpoint_address = adjust_breakpoint_address; +} + +int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache) { gdb_assert (gdbarch != NULL); @@ -4931,6 +5008,23 @@ set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, } int +gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->stabs_argument_has_addr != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n"); + return gdbarch->stabs_argument_has_addr (gdbarch, type); +} + +void +set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, + gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr) +{ + gdbarch->stabs_argument_has_addr = stabs_argument_has_addr; +} + +int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -5011,13 +5105,13 @@ set_gdbarch_long_double_format (struct gdbarch *gdbarch, } CORE_ADDR -gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr) +gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n"); - return gdbarch->convert_from_func_ptr_addr (addr); + return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ); } void @@ -5119,6 +5213,23 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch->skip_trampoline_code = skip_trampoline_code; } +CORE_ADDR +gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->skip_solib_resolver != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_solib_resolver called\n"); + return gdbarch->skip_solib_resolver (pc); +} + +void +set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, + gdbarch_skip_solib_resolver_ftype skip_solib_resolver) +{ + gdbarch->skip_solib_resolver = skip_solib_resolver; +} + int gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) { @@ -5450,6 +5561,30 @@ set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch->fetch_pointer_argument = fetch_pointer_argument; } +int +gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->regset_from_core_section != NULL; +} + +const struct regset * +gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->regset_from_core_section != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n"); + return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size); +} + +void +set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, + gdbarch_regset_from_core_section_ftype regset_from_core_section) +{ + gdbarch->regset_from_core_section = regset_from_core_section; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ @@ -5590,31 +5725,21 @@ register_gdbarch_swap (void *data, } static void -clear_gdbarch_swap (struct gdbarch *gdbarch) -{ - struct gdbarch_swap *curr; - for (curr = gdbarch->swap; - curr != NULL; - curr = curr->next) - { - memset (curr->source->data, 0, curr->source->sizeof_data); - } -} - -static void -init_gdbarch_swap (struct gdbarch *gdbarch) +current_gdbarch_swap_init_hack (void) { struct gdbarch_swap_registration *rego; - struct gdbarch_swap **curr = &gdbarch->swap; + struct gdbarch_swap **curr = ¤t_gdbarch->swap; for (rego = gdbarch_swap_registry.registrations; rego != NULL; rego = rego->next) { if (rego->data != NULL) { - (*curr) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdbarch_swap); + (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, + struct gdbarch_swap); (*curr)->source = rego; - (*curr)->swap = gdbarch_obstack_zalloc (gdbarch, rego->sizeof_data); + (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, + rego->sizeof_data); (*curr)->next = NULL; curr = &(*curr)->next; } @@ -5623,24 +5748,35 @@ init_gdbarch_swap (struct gdbarch *gdbarch) } } -static void -swapout_gdbarch_swap (struct gdbarch *gdbarch) +static struct gdbarch * +current_gdbarch_swap_out_hack (void) { + struct gdbarch *old_gdbarch = current_gdbarch; struct gdbarch_swap *curr; - for (curr = gdbarch->swap; + + gdb_assert (old_gdbarch != NULL); + for (curr = old_gdbarch->swap; curr != NULL; curr = curr->next) - memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + { + memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + memset (curr->source->data, 0, curr->source->sizeof_data); + } + current_gdbarch = NULL; + return old_gdbarch; } static void -swapin_gdbarch_swap (struct gdbarch *gdbarch) +current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) { struct gdbarch_swap *curr; - for (curr = gdbarch->swap; + + gdb_assert (current_gdbarch == NULL); + for (curr = new_gdbarch->swap; curr != NULL; curr = curr->next) memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); + current_gdbarch = new_gdbarch; } @@ -5763,50 +5899,24 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches, } -/* Update the current architecture. Return ZERO if the update request - failed. */ +/* Find an architecture that matches the specified INFO. Create a new + architecture if needed. Return that new architecture. Assumes + that there is no current architecture. */ -int -gdbarch_update_p (struct gdbarch_info info) +static struct gdbarch * +find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info) { struct gdbarch *new_gdbarch; - struct gdbarch *old_gdbarch; struct gdbarch_registration *rego; + /* The existing architecture has been swapped out - all this code + works from a clean slate. */ + gdb_assert (current_gdbarch == NULL); + /* Fill in missing parts of the INFO struct using a number of - sources: ``set ...''; INFOabfd supplied; existing target. */ - - /* ``(gdb) set architecture ...'' */ - if (info.bfd_arch_info == NULL - && !TARGET_ARCHITECTURE_AUTO) - info.bfd_arch_info = TARGET_ARCHITECTURE; - if (info.bfd_arch_info == NULL - && info.abfd != NULL - && bfd_get_arch (info.abfd) != bfd_arch_unknown - && bfd_get_arch (info.abfd) != bfd_arch_obscure) - info.bfd_arch_info = bfd_get_arch_info (info.abfd); - if (info.bfd_arch_info == NULL) - info.bfd_arch_info = TARGET_ARCHITECTURE; - - /* ``(gdb) set byte-order ...'' */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN - && !TARGET_BYTE_ORDER_AUTO) - info.byte_order = TARGET_BYTE_ORDER; - /* From the INFO struct. */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN - && info.abfd != NULL) - info.byte_order = (bfd_big_endian (info.abfd) ? BFD_ENDIAN_BIG - : bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE - : BFD_ENDIAN_UNKNOWN); - /* From the current target. */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN) - info.byte_order = TARGET_BYTE_ORDER; - - /* ``(gdb) set osabi ...'' is handled by gdbarch_lookup_osabi. */ - if (info.osabi == GDB_OSABI_UNINITIALIZED) - info.osabi = gdbarch_lookup_osabi (info.abfd); - if (info.osabi == GDB_OSABI_UNINITIALIZED) - info.osabi = current_gdbarch->osabi; + sources: "set ..."; INFOabfd supplied; and the existing + architecture. */ + gdbarch_info_fill (old_gdbarch, &info); /* Must have found some sort of architecture. */ gdb_assert (info.bfd_arch_info != NULL); @@ -5814,28 +5924,28 @@ gdbarch_update_p (struct gdbarch_info info) if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.bfd_arch_info %s\n", + "find_arch_by_info: info.bfd_arch_info %s\n", (info.bfd_arch_info != NULL ? info.bfd_arch_info->printable_name : "(null)")); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.byte_order %d (%s)\n", + "find_arch_by_info: info.byte_order %d (%s)\n", info.byte_order, (info.byte_order == BFD_ENDIAN_BIG ? "big" : info.byte_order == BFD_ENDIAN_LITTLE ? "little" : "default")); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.osabi %d (%s)\n", + "find_arch_by_info: info.osabi %d (%s)\n", info.osabi, gdbarch_osabi_name (info.osabi)); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.abfd 0x%lx\n", + "find_arch_by_info: info.abfd 0x%lx\n", (long) info.abfd); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.tdep_info 0x%lx\n", + "find_arch_by_info: info.tdep_info 0x%lx\n", (long) info.tdep_info); } - /* Find the target that knows about this architecture. */ + /* Find the tdep code that knows about this architecture. */ for (rego = gdbarch_registry; rego != NULL; rego = rego->next) @@ -5844,86 +5954,61 @@ gdbarch_update_p (struct gdbarch_info info) if (rego == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n"); + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "No matching architecture\n"); return 0; } - /* Swap the data belonging to the old target out setting the - installed data to zero. This stops the ->init() function trying - to refer to the previous architecture's global data structures. */ - swapout_gdbarch_swap (current_gdbarch); - clear_gdbarch_swap (current_gdbarch); - - /* Save the previously selected architecture, setting the global to - NULL. This stops ->init() trying to use the previous - architecture's configuration. The previous architecture may not - even be of the same architecture family. The most recent - architecture of the same family is found at the head of the - rego->arches list. */ - old_gdbarch = current_gdbarch; - current_gdbarch = NULL; - - /* Ask the target for a replacement architecture. */ + /* Ask the tdep code for an architecture that matches "info". */ new_gdbarch = rego->init (info, rego->arches); - /* Did the target like it? No. Reject the change and revert to the - old architecture. */ + /* Did the tdep code like it? No. Reject the change and revert to + the old architecture. */ if (new_gdbarch == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n"); - swapin_gdbarch_swap (old_gdbarch); - current_gdbarch = old_gdbarch; - return 0; + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Target rejected architecture\n"); + return NULL; } - /* Did the architecture change? No. Oops, put the old architecture - back. */ - if (old_gdbarch == new_gdbarch) + /* Is this a pre-existing architecture (as determined by already + being initialized)? Move it to the front of the architecture + list (keeping the list sorted Most Recently Used). */ + if (new_gdbarch->initialized_p) { + struct gdbarch_list **list; + struct gdbarch_list *this; if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n", + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Previous architecture 0x%08lx (%s) selected\n", (long) new_gdbarch, new_gdbarch->bfd_arch_info->printable_name); - swapin_gdbarch_swap (old_gdbarch); - current_gdbarch = old_gdbarch; - return 1; + /* Find the existing arch in the list. */ + for (list = ®o->arches; + (*list) != NULL && (*list)->gdbarch != new_gdbarch; + list = &(*list)->next); + /* It had better be in the list of architectures. */ + gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch); + /* Unlink THIS. */ + this = (*list); + (*list) = this->next; + /* Insert THIS at the front. */ + this->next = rego->arches; + rego->arches = this; + /* Return it. */ + return new_gdbarch; } - /* Is this a pre-existing architecture? Yes. Move it to the front - of the list of architectures (keeping the list sorted Most - Recently Used) and then copy it in. */ - { - struct gdbarch_list **list; - for (list = ®o->arches; - (*list) != NULL; - list = &(*list)->next) - { - if ((*list)->gdbarch == new_gdbarch) - { - struct gdbarch_list *this; - if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, - new_gdbarch->bfd_arch_info->printable_name); - /* Unlink this. */ - this = (*list); - (*list) = this->next; - /* Insert in the front. */ - this->next = rego->arches; - rego->arches = this; - /* Copy the new architecture in. */ - current_gdbarch = new_gdbarch; - swapin_gdbarch_swap (new_gdbarch); - architecture_changed_event (); - return 1; - } - } - } - - /* Prepend this new architecture to the architecture list (keep the - list sorted Most Recently Used). */ + /* It's a new architecture. */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + + /* Insert the new architecture into the front of the architecture + list (keep the list sorted Most Recently Used). */ { struct gdbarch_list *this = XMALLOC (struct gdbarch_list); this->next = rego->arches; @@ -5931,37 +6016,59 @@ gdbarch_update_p (struct gdbarch_info info) rego->arches = this; } - /* Switch to this new architecture marking it initialized. */ - current_gdbarch = new_gdbarch; - current_gdbarch->initialized_p = 1; - if (gdbarch_debug) - { - fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: New architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, - new_gdbarch->bfd_arch_info->printable_name); - } - /* Check that the newly installed architecture is valid. Plug in any post init values. */ new_gdbarch->dump_tdep = rego->dump_tdep; verify_gdbarch (new_gdbarch); + new_gdbarch->initialized_p = 1; - /* Initialize the per-architecture memory (swap) areas. - CURRENT_GDBARCH must be update before these modules are - called. */ - init_gdbarch_swap (new_gdbarch); - - /* Initialize the per-architecture data. CURRENT_GDBARCH - must be updated before these modules are called. */ - architecture_changed_event (); + /* Initialize any per-architecture swap areas. This phase requires + a valid global CURRENT_GDBARCH. Set it momentarially, and then + swap the entire architecture out. */ + current_gdbarch = new_gdbarch; + current_gdbarch_swap_init_hack (); + current_gdbarch_swap_out_hack (); if (gdbarch_debug) - gdbarch_dump (current_gdbarch, gdb_stdlog); + gdbarch_dump (new_gdbarch, gdb_stdlog); - return 1; + return new_gdbarch; } +struct gdbarch * +gdbarch_find_by_info (struct gdbarch_info info) +{ + /* Save the previously selected architecture, setting the global to + NULL. This stops things like gdbarch->init() trying to use the + previous architecture's configuration. The previous architecture + may not even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + + /* Find the specified architecture. */ + struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info); + + /* Restore the existing architecture. */ + gdb_assert (current_gdbarch == NULL); + current_gdbarch_swap_in_hack (old_gdbarch); + + return new_gdbarch; +} + +/* Make the specified architecture current, swapping the existing one + out. */ + +void +deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) +{ + gdb_assert (new_gdbarch != NULL); + gdb_assert (current_gdbarch != NULL); + gdb_assert (new_gdbarch->initialized_p); + current_gdbarch_swap_out_hack (); + current_gdbarch_swap_in_hack (new_gdbarch); + architecture_changed_event (); +} extern void _initialize_gdbarch (void); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 65006ca..3affac5 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -43,7 +43,9 @@ struct objfile; struct minimal_symbol; struct regcache; struct reggroup; +struct regset; struct disassemble_info; +struct target_ops; extern struct gdbarch *current_gdbarch; @@ -422,9 +424,7 @@ extern void set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dw #define DWARF_REG_TO_REGNUM(dwarf_regnr) (gdbarch_dwarf_reg_to_regnum (current_gdbarch, dwarf_regnr)) #endif -/* Convert from an sdb register number to an internal gdb register number. - This should be defined in tm.h, if REGISTER_NAMES is not set up - to map one to one onto the sdb register numbers. */ +/* Convert from an sdb register number to an internal gdb register number. */ typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr); extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr); @@ -456,7 +456,7 @@ extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register #define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr)) #endif -/* REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. */ +/* REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. */ extern int gdbarch_register_type_p (struct gdbarch *gdbarch); @@ -464,31 +464,31 @@ typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, in extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type); -/* REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. */ +/* REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. */ -#if defined (REGISTER_VIRTUAL_TYPE) -/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_TYPE */ -#if !defined (REGISTER_VIRTUAL_TYPE_P) -#define REGISTER_VIRTUAL_TYPE_P() (1) +#if defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_VIRTUAL_TYPE */ +#if !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE_P() (1) #endif #endif extern int gdbarch_deprecated_register_virtual_type_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE_P) -#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_TYPE" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_TYPE_P) -#define REGISTER_VIRTUAL_TYPE_P() (gdbarch_deprecated_register_virtual_type_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE_P) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE_P() (gdbarch_deprecated_register_virtual_type_p (current_gdbarch)) #endif typedef struct type * (gdbarch_deprecated_register_virtual_type_ftype) (int reg_nr); extern struct type * gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_deprecated_register_virtual_type (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_type_ftype *deprecated_register_virtual_type); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE) -#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_TYPE" #endif -#if !defined (REGISTER_VIRTUAL_TYPE) -#define REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_deprecated_register_virtual_type (current_gdbarch, reg_nr)) +#if !defined (DEPRECATED_REGISTER_VIRTUAL_TYPE) +#define DEPRECATED_REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_deprecated_register_virtual_type (current_gdbarch, reg_nr)) #endif /* DEPRECATED_REGISTER_BYTES can be deleted. The value is computed @@ -541,29 +541,29 @@ extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbar DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print registers. */ -#if defined (REGISTER_RAW_SIZE) -/* Legacy for systems yet to multi-arch REGISTER_RAW_SIZE */ -#if !defined (REGISTER_RAW_SIZE_P) -#define REGISTER_RAW_SIZE_P() (1) +#if defined (DEPRECATED_REGISTER_RAW_SIZE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_RAW_SIZE */ +#if !defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#define DEPRECATED_REGISTER_RAW_SIZE_P() (1) #endif #endif extern int gdbarch_deprecated_register_raw_size_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_RAW_SIZE_P) -#error "Non multi-arch definition of REGISTER_RAW_SIZE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_RAW_SIZE" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_RAW_SIZE_P) -#define REGISTER_RAW_SIZE_P() (gdbarch_deprecated_register_raw_size_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_REGISTER_RAW_SIZE_P) +#define DEPRECATED_REGISTER_RAW_SIZE_P() (gdbarch_deprecated_register_raw_size_p (current_gdbarch)) #endif typedef int (gdbarch_deprecated_register_raw_size_ftype) (int reg_nr); extern int gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_raw_size_ftype *deprecated_register_raw_size); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_RAW_SIZE) -#error "Non multi-arch definition of REGISTER_RAW_SIZE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_RAW_SIZE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_RAW_SIZE" #endif -#if !defined (REGISTER_RAW_SIZE) -#define REGISTER_RAW_SIZE(reg_nr) (gdbarch_deprecated_register_raw_size (current_gdbarch, reg_nr)) +#if !defined (DEPRECATED_REGISTER_RAW_SIZE) +#define DEPRECATED_REGISTER_RAW_SIZE(reg_nr) (gdbarch_deprecated_register_raw_size (current_gdbarch, reg_nr)) #endif /* If all registers have identical raw and virtual sizes and those @@ -571,29 +571,29 @@ extern void set_gdbarch_deprecated_register_raw_size (struct gdbarch *gdbarch, g DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print registers. */ -#if defined (REGISTER_VIRTUAL_SIZE) -/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_SIZE */ -#if !defined (REGISTER_VIRTUAL_SIZE_P) -#define REGISTER_VIRTUAL_SIZE_P() (1) +#if defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_VIRTUAL_SIZE */ +#if !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE_P() (1) #endif #endif extern int gdbarch_deprecated_register_virtual_size_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE_P) -#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_SIZE" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_SIZE_P) -#define REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_register_virtual_size_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE_P) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_register_virtual_size_p (current_gdbarch)) #endif typedef int (gdbarch_deprecated_register_virtual_size_ftype) (int reg_nr); extern int gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, int reg_nr); extern void set_gdbarch_deprecated_register_virtual_size (struct gdbarch *gdbarch, gdbarch_deprecated_register_virtual_size_ftype *deprecated_register_virtual_size); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_SIZE) -#error "Non multi-arch definition of REGISTER_VIRTUAL_SIZE" +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +#error "Non multi-arch definition of DEPRECATED_REGISTER_VIRTUAL_SIZE" #endif -#if !defined (REGISTER_VIRTUAL_SIZE) -#define REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_deprecated_register_virtual_size (current_gdbarch, reg_nr)) +#if !defined (DEPRECATED_REGISTER_VIRTUAL_SIZE) +#define DEPRECATED_REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_deprecated_register_virtual_size (current_gdbarch, reg_nr)) #endif /* DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been @@ -1393,16 +1393,6 @@ extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_int #define INTEGER_TO_ADDRESS(type, buf) (gdbarch_integer_to_address (current_gdbarch, type, buf)) #endif -typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type); -extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type); -extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (RETURN_VALUE_ON_STACK) -#error "Non multi-arch definition of RETURN_VALUE_ON_STACK" -#endif -#if !defined (RETURN_VALUE_ON_STACK) -#define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type)) -#endif - #if defined (DEPRECATED_POP_FRAME) /* Legacy for systems yet to multi-arch DEPRECATED_POP_FRAME */ #if !defined (DEPRECATED_POP_FRAME_P) @@ -1455,6 +1445,34 @@ extern void set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, #define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (gdbarch_deprecated_store_struct_return (current_gdbarch, addr, sp)) #endif +/* It has been suggested that this, well actually its predecessor, + should take the type/value of the function to be called and not the + return type. This is left as an exercise for the reader. */ + +extern int gdbarch_return_value_p (struct gdbarch *gdbarch); + +typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf); +extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf); +extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value); + +/* The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, + STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded + into RETURN_VALUE. For the moment do not try to fold in + EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug + info, and the level of effort, it may well be possible to find the + address of a structure being return on the stack. Someone else can + make that change. */ + +typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type); +extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type); +extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (RETURN_VALUE_ON_STACK) +#error "Non multi-arch definition of RETURN_VALUE_ON_STACK" +#endif +#if !defined (RETURN_VALUE_ON_STACK) +#define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type)) +#endif + typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, void *valbuf); extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf); extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value); @@ -1495,6 +1513,16 @@ extern void set_gdbarch_deprecated_store_return_value (struct gdbarch *gdbarch, #define DEPRECATED_STORE_RETURN_VALUE(type, valbuf) (gdbarch_deprecated_store_return_value (current_gdbarch, type, valbuf)) #endif +typedef int (gdbarch_use_struct_convention_ftype) (int gcc_p, struct type *value_type); +extern int gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type); +extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_use_struct_convention_ftype *use_struct_convention); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (USE_STRUCT_CONVENTION) +#error "Non multi-arch definition of USE_STRUCT_CONVENTION" +#endif +#if !defined (USE_STRUCT_CONVENTION) +#define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type)) +#endif + #if defined (EXTRACT_STRUCT_VALUE_ADDRESS) /* Legacy for systems yet to multi-arch EXTRACT_STRUCT_VALUE_ADDRESS */ #if !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) @@ -1545,16 +1573,6 @@ extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regbuf)) #endif -typedef int (gdbarch_use_struct_convention_ftype) (int gcc_p, struct type *value_type); -extern int gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type); -extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_use_struct_convention_ftype *use_struct_convention); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (USE_STRUCT_CONVENTION) -#error "Non multi-arch definition of USE_STRUCT_CONVENTION" -#endif -#if !defined (USE_STRUCT_CONVENTION) -#define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type)) -#endif - #if defined (DEPRECATED_FRAME_INIT_SAVED_REGS) /* Legacy for systems yet to multi-arch DEPRECATED_FRAME_INIT_SAVED_REGS */ #if !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P) @@ -1645,6 +1663,12 @@ extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_bre #define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr)) #endif +extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr); +extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); +extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address); + typedef int (gdbarch_memory_insert_breakpoint_ftype) (CORE_ADDR addr, char *contents_cache); extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache); extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint); @@ -1939,6 +1963,9 @@ 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); +/* DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by + stabs_argument_has_addr. */ + #if defined (DEPRECATED_REG_STRUCT_HAS_ADDR) /* Legacy for systems yet to multi-arch DEPRECATED_REG_STRUCT_HAS_ADDR */ #if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P) @@ -1964,6 +1991,10 @@ extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, #define DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_deprecated_reg_struct_has_addr (current_gdbarch, gcc_p, type)) #endif +typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type); +extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type); +extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr); + extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch); extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_RED_ZONE_SIZE) @@ -2009,15 +2040,9 @@ extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struc #define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch)) #endif -typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (CORE_ADDR addr); -extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr); +typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); +extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ); extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CONVERT_FROM_FUNC_PTR_ADDR) -#error "Non multi-arch definition of CONVERT_FROM_FUNC_PTR_ADDR" -#endif -#if !defined (CONVERT_FROM_FUNC_PTR_ADDR) -#define CONVERT_FROM_FUNC_PTR_ADDR(addr) (gdbarch_convert_from_func_ptr_addr (current_gdbarch, addr)) -#endif /* On some machines there are bits in addresses which are not really part of the address, but are used by the kernel, the hardware, etc. @@ -2109,6 +2134,20 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s #define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc)) #endif +/* If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER + evaluates non-zero, this is the address where the debugger will place + a step-resume breakpoint to get us past the dynamic linker. */ + +typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (CORE_ADDR pc); +extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_SOLIB_RESOLVER) +#error "Non multi-arch definition of SKIP_SOLIB_RESOLVER" +#endif +#if !defined (SKIP_SOLIB_RESOLVER) +#define SKIP_SOLIB_RESOLVER(pc) (gdbarch_skip_solib_resolver (current_gdbarch, pc)) +#endif + /* For SVR4 shared libraries, each call goes through a small piece of trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates to nonzero if we are currently stopped in one of these. */ @@ -2360,6 +2399,15 @@ extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch #define FETCH_POINTER_ARGUMENT(frame, argi, type) (gdbarch_fetch_pointer_argument (current_gdbarch, frame, argi, type)) #endif +/* Return the appropriate register set for a core file section with + name SECT_NAME and size SECT_SIZE. */ + +extern int gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch); + +typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); @@ -2507,6 +2555,27 @@ extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size); extern int gdbarch_update_p (struct gdbarch_info info); +/* Helper function. Find an architecture matching info. + + INFO should be initialized using gdbarch_info_init, relevant fields + set, and then finished using gdbarch_info_fill. + + Returns the corresponding architecture, or NULL if no matching + architecture was found. "current_gdbarch" is not updated. */ + +extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); + + +/* Helper function. Set the global "current_gdbarch" to "gdbarch". + + FIXME: kettenis/20031124: Of the functions that follow, only + gdbarch_from_bfd is supposed to survive. The others will + dissappear since in the future GDB will (hopefully) be truly + multi-arch. However, for now we're still stuck with the concept of + a single active architecture. */ + +extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch); + /* Register per-architecture data-pointer. @@ -2596,11 +2665,6 @@ extern void set_gdbarch_from_file (bfd *); extern void initialize_current_architecture (void); -/* For non-multiarched targets, do any initialization of the default - gdbarch object necessary after the _initialize_MODULE functions - have run. */ -extern void initialize_non_multiarch (void); - /* gdbarch trace variable */ extern int gdbarch_debug; diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0884c3c..95db711 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -323,8 +323,9 @@ do # You cannot specify both a zero INVALID_P and a POSTDEFAULT. - # Variable declarations can refer to ``gdbarch'' which will - # contain the current architecture. Care should be taken. + # Variable declarations can refer to ``current_gdbarch'' which + # will contain the current architecture. Care should be + # taken. invalid_p ) : ;; @@ -463,16 +464,14 @@ f:2:ECOFF_REG_TO_REGNUM:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no # Provide a default mapping from a DWARF register number to a gdb REGNUM. f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0 # Convert from an sdb register number to an internal gdb register number. -# This should be defined in tm.h, if REGISTER_NAMES is not set up -# to map one to one onto the sdb register numbers. f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 f::REGISTER_NAME:const char *:register_name:int regnr:regnr -# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. +# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr -# REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. -F:2:REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr +# REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE. +F:2:DEPRECATED_REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr # DEPRECATED_REGISTER_BYTES can be deleted. The value is computed # from REGISTER_TYPE. v::DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes @@ -488,12 +487,12 @@ F::DEPRECATED_REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::gene # sizes agree with the value computed from REGISTER_TYPE, # DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print # registers. -F:2:REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size +F:2:DEPRECATED_REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size # If all registers have identical raw and virtual sizes and those # sizes agree with the value computed from REGISTER_TYPE, # DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print # registers. -F:2:REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size +F:2:DEPRECATED_REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size # DEPRECATED_MAX_REGISTER_RAW_SIZE can be deleted. It has been # replaced by the constant MAX_REGISTER_SIZE. V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size @@ -595,19 +594,33 @@ f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, const voi f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0 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:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:- # 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 -# + +# It has been suggested that this, well actually its predecessor, +# should take the type/value of the function to be called and not the +# return type. This is left as an exercise for the reader. + +M:::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf:valtype, regcache, readbuf, writebuf + +# The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, +# STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded +# into RETURN_VALUE. For the moment do not try to fold in +# EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug +# info, and the level of effort, it may well be possible to find the +# address of a structure being return on the stack. Someone else can +# make that change. + +f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0 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 f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf f:2:DEPRECATED_STORE_RETURN_VALUE:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf -# +f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 + F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf -f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 # F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame @@ -616,6 +629,7 @@ f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0 f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0 f:2:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0 f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0: +M:2:ADJUST_BREAKPOINT_ADDRESS:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1 @@ -648,14 +662,17 @@ F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame # alignment. F:2:DEPRECATED_STACK_ALIGN:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp M:::CORE_ADDR:frame_align:CORE_ADDR address:address +# DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by +# stabs_argument_has_addr. F:2:DEPRECATED_REG_STRUCT_HAS_ADDR:int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type +m:::int:stabs_argument_has_addr:struct type *type:type:::default_stabs_argument_has_addr::0 v::FRAME_RED_ZONE_SIZE:int:frame_red_zone_size 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 -v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)::%s:(TARGET_DOUBLE_FORMAT)->name -v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (gdbarch)::%s:(TARGET_LONG_DOUBLE_FORMAT)->name -f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::core_addr_identity::0 +v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (current_gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name +v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_DOUBLE_FORMAT)->name +v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_LONG_DOUBLE_FORMAT)->name +m:::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ:::convert_from_func_ptr_addr_identity::0 # On some machines there are bits in addresses which are not really # part of the address, but are used by the kernel, the hardware, etc. # for special purposes. ADDR_BITS_REMOVE takes out any such bits so @@ -666,7 +683,7 @@ f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR ad # sort of generic thing to handle alignment or segmentation (it's # possible it should be in TARGET_READ_PC instead). f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_identity::0 -# It is not at all clear why SMASH_TEXT_ADDRESS is not folded into +# It is not at all clear why SMASH_TEXT_ADDRESS is not folded into # ADDR_BITS_REMOVE. f:2:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_addr_identity::0 # FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if @@ -684,6 +701,10 @@ f::TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, struct disassemble_info *info:v f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0 +# If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER +# evaluates non-zero, this is the address where the debugger will place +# a step-resume breakpoint to get us past the dynamic linker. +f:2:SKIP_SOLIB_RESOLVER:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::0 # For SVR4 shared libraries, each call goes through a small piece of # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates # to nonzero if we are currently stopped in one of these. @@ -744,8 +765,12 @@ M:2:ADDRESS_CLASS_TYPE_FLAGS_TO_NAME:const char *:address_class_type_flags_to_na M:2:ADDRESS_CLASS_NAME_TO_TYPE_FLAGS:int:address_class_name_to_type_flags:const char *name, int *type_flags_ptr:name, type_flags_ptr # Is a register in a group m:::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p::0 -# Fetch the pointer to the ith function argument. +# Fetch the pointer to the ith function argument. F::FETCH_POINTER_ARGUMENT:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type + +# Return the appropriate register set for a core file section with +# name SECT_NAME and size SECT_SIZE. +M:::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size EOF } @@ -850,7 +875,9 @@ struct objfile; struct minimal_symbol; struct regcache; struct reggroup; +struct regset; struct disassemble_info; +struct target_ops; extern struct gdbarch *current_gdbarch; @@ -1134,6 +1161,27 @@ extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size); extern int gdbarch_update_p (struct gdbarch_info info); +/* Helper function. Find an architecture matching info. + + INFO should be initialized using gdbarch_info_init, relevant fields + set, and then finished using gdbarch_info_fill. + + Returns the corresponding architecture, or NULL if no matching + architecture was found. "current_gdbarch" is not updated. */ + +extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); + + +/* Helper function. Set the global "current_gdbarch" to "gdbarch". + + FIXME: kettenis/20031124: Of the functions that follow, only + gdbarch_from_bfd is supposed to survive. The others will + dissappear since in the future GDB will (hopefully) be truly + multi-arch. However, for now we're still stuck with the concept of + a single active architecture. */ + +extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch); + /* Register per-architecture data-pointer. @@ -1223,11 +1271,6 @@ extern void set_gdbarch_from_file (bfd *); extern void initialize_current_architecture (void); -/* For non-multiarched targets, do any initialization of the default - gdbarch object necessary after the _initialize_MODULE functions - have run. */ -extern void initialize_non_multiarch (void); - /* gdbarch trace variable */ extern int gdbarch_debug; @@ -1267,12 +1310,7 @@ cat <<EOF /* Static function declarations */ -static void verify_gdbarch (struct gdbarch *gdbarch); static void alloc_gdbarch_data (struct gdbarch *); -static void init_gdbarch_swap (struct gdbarch *); -static void clear_gdbarch_swap (struct gdbarch *); -static void swapout_gdbarch_swap (struct gdbarch *); -static void swapin_gdbarch_swap (struct gdbarch *); /* Non-zero if we want to trace architecture code. */ @@ -1396,24 +1434,11 @@ cat <<EOF }; struct gdbarch *current_gdbarch = &startup_gdbarch; - -/* Do any initialization needed for a non-multiarch configuration - after the _initialize_MODULE functions have been run. */ -void -initialize_non_multiarch (void) -{ - alloc_gdbarch_data (&startup_gdbarch); - /* Ensure that all swap areas are zeroed so that they again think - they are starting from scratch. */ - clear_gdbarch_swap (&startup_gdbarch); - init_gdbarch_swap (&startup_gdbarch); -} EOF # Create a new gdbarch struct -printf "\n" -printf "\n" cat <<EOF + /* Create a new \`\`struct gdbarch'' based on information provided by \`\`struct gdbarch_info''. */ EOF @@ -1504,13 +1529,19 @@ gdbarch_free (struct gdbarch *arch) EOF # verify a new architecture -printf "\n" -printf "\n" -printf "/* Ensure that all values in a GDBARCH are reasonable. */\n" -printf "\n" cat <<EOF + + +/* Ensure that all values in a GDBARCH are reasonable. */ + +/* NOTE/WARNING: The parameter is called \`\`current_gdbarch'' so that it + just happens to match the global variable \`\`current_gdbarch''. That + way macros refering to that variable get the local and not the global + version - ulgh. Once everything is parameterised with gdbarch, this + will go away. */ + static void -verify_gdbarch (struct gdbarch *gdbarch) +verify_gdbarch (struct gdbarch *current_gdbarch) { struct ui_file *log; struct cleanup *cleanups; @@ -1519,9 +1550,9 @@ verify_gdbarch (struct gdbarch *gdbarch) log = mem_fileopen (); cleanups = make_cleanup_ui_file_delete (log); /* fundamental */ - if (gdbarch->byte_order == BFD_ENDIAN_UNKNOWN) + if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN) fprintf_unfiltered (log, "\n\tbyte-order"); - if (gdbarch->bfd_arch_info == NULL) + if (current_gdbarch->bfd_arch_info == NULL) fprintf_unfiltered (log, "\n\tbfd_arch_info"); /* Check those that need to be defined for the given multi-arch level. */ EOF @@ -1539,15 +1570,15 @@ do elif [ -n "${invalid_p}" -a -n "${postdefault}" ] then printf " if (${invalid_p})\n" - printf " gdbarch->${function} = ${postdefault};\n" + printf " current_gdbarch->${function} = ${postdefault};\n" elif [ -n "${predefault}" -a -n "${postdefault}" ] then - printf " if (gdbarch->${function} == ${predefault})\n" - printf " gdbarch->${function} = ${postdefault};\n" + printf " if (current_gdbarch->${function} == ${predefault})\n" + printf " current_gdbarch->${function} = ${postdefault};\n" elif [ -n "${postdefault}" ] then - printf " if (gdbarch->${function} == 0)\n" - printf " gdbarch->${function} = ${postdefault};\n" + printf " if (current_gdbarch->${function} == 0)\n" + printf " current_gdbarch->${function} = ${postdefault};\n" elif [ -n "${invalid_p}" ] then printf " if ((GDB_MULTI_ARCH ${gt_level})\n" @@ -1556,7 +1587,7 @@ do elif [ -n "${predefault}" ] then printf " if ((GDB_MULTI_ARCH ${gt_level})\n" - printf " && (gdbarch->${function} == ${predefault}))\n" + printf " && (current_gdbarch->${function} == ${predefault}))\n" printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n" fi fi @@ -1585,7 +1616,7 @@ cat <<EOF will go away. */ void -gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) +gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) { fprintf_unfiltered (file, "gdbarch_dump: GDB_MULTI_ARCH = %d\\n", @@ -1927,31 +1958,21 @@ register_gdbarch_swap (void *data, } static void -clear_gdbarch_swap (struct gdbarch *gdbarch) -{ - struct gdbarch_swap *curr; - for (curr = gdbarch->swap; - curr != NULL; - curr = curr->next) - { - memset (curr->source->data, 0, curr->source->sizeof_data); - } -} - -static void -init_gdbarch_swap (struct gdbarch *gdbarch) +current_gdbarch_swap_init_hack (void) { struct gdbarch_swap_registration *rego; - struct gdbarch_swap **curr = &gdbarch->swap; + struct gdbarch_swap **curr = ¤t_gdbarch->swap; for (rego = gdbarch_swap_registry.registrations; rego != NULL; rego = rego->next) { if (rego->data != NULL) { - (*curr) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdbarch_swap); + (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, + struct gdbarch_swap); (*curr)->source = rego; - (*curr)->swap = gdbarch_obstack_zalloc (gdbarch, rego->sizeof_data); + (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, + rego->sizeof_data); (*curr)->next = NULL; curr = &(*curr)->next; } @@ -1960,24 +1981,35 @@ init_gdbarch_swap (struct gdbarch *gdbarch) } } -static void -swapout_gdbarch_swap (struct gdbarch *gdbarch) +static struct gdbarch * +current_gdbarch_swap_out_hack (void) { + struct gdbarch *old_gdbarch = current_gdbarch; struct gdbarch_swap *curr; - for (curr = gdbarch->swap; + + gdb_assert (old_gdbarch != NULL); + for (curr = old_gdbarch->swap; curr != NULL; curr = curr->next) - memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + { + memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); + memset (curr->source->data, 0, curr->source->sizeof_data); + } + current_gdbarch = NULL; + return old_gdbarch; } static void -swapin_gdbarch_swap (struct gdbarch *gdbarch) +current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) { struct gdbarch_swap *curr; - for (curr = gdbarch->swap; + + gdb_assert (current_gdbarch == NULL); + for (curr = new_gdbarch->swap; curr != NULL; curr = curr->next) memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); + current_gdbarch = new_gdbarch; } @@ -2100,50 +2132,24 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches, } -/* Update the current architecture. Return ZERO if the update request - failed. */ +/* Find an architecture that matches the specified INFO. Create a new + architecture if needed. Return that new architecture. Assumes + that there is no current architecture. */ -int -gdbarch_update_p (struct gdbarch_info info) +static struct gdbarch * +find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info) { struct gdbarch *new_gdbarch; - struct gdbarch *old_gdbarch; struct gdbarch_registration *rego; + /* The existing architecture has been swapped out - all this code + works from a clean slate. */ + gdb_assert (current_gdbarch == NULL); + /* Fill in missing parts of the INFO struct using a number of - sources: \`\`set ...''; INFOabfd supplied; existing target. */ - - /* \`\`(gdb) set architecture ...'' */ - if (info.bfd_arch_info == NULL - && !TARGET_ARCHITECTURE_AUTO) - info.bfd_arch_info = TARGET_ARCHITECTURE; - if (info.bfd_arch_info == NULL - && info.abfd != NULL - && bfd_get_arch (info.abfd) != bfd_arch_unknown - && bfd_get_arch (info.abfd) != bfd_arch_obscure) - info.bfd_arch_info = bfd_get_arch_info (info.abfd); - if (info.bfd_arch_info == NULL) - info.bfd_arch_info = TARGET_ARCHITECTURE; - - /* \`\`(gdb) set byte-order ...'' */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN - && !TARGET_BYTE_ORDER_AUTO) - info.byte_order = TARGET_BYTE_ORDER; - /* From the INFO struct. */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN - && info.abfd != NULL) - info.byte_order = (bfd_big_endian (info.abfd) ? BFD_ENDIAN_BIG - : bfd_little_endian (info.abfd) ? BFD_ENDIAN_LITTLE - : BFD_ENDIAN_UNKNOWN); - /* From the current target. */ - if (info.byte_order == BFD_ENDIAN_UNKNOWN) - info.byte_order = TARGET_BYTE_ORDER; - - /* \`\`(gdb) set osabi ...'' is handled by gdbarch_lookup_osabi. */ - if (info.osabi == GDB_OSABI_UNINITIALIZED) - info.osabi = gdbarch_lookup_osabi (info.abfd); - if (info.osabi == GDB_OSABI_UNINITIALIZED) - info.osabi = current_gdbarch->osabi; + sources: "set ..."; INFOabfd supplied; and the existing + architecture. */ + gdbarch_info_fill (old_gdbarch, &info); /* Must have found some sort of architecture. */ gdb_assert (info.bfd_arch_info != NULL); @@ -2151,28 +2157,28 @@ gdbarch_update_p (struct gdbarch_info info) if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.bfd_arch_info %s\n", + "find_arch_by_info: info.bfd_arch_info %s\n", (info.bfd_arch_info != NULL ? info.bfd_arch_info->printable_name : "(null)")); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.byte_order %d (%s)\n", + "find_arch_by_info: info.byte_order %d (%s)\n", info.byte_order, (info.byte_order == BFD_ENDIAN_BIG ? "big" : info.byte_order == BFD_ENDIAN_LITTLE ? "little" : "default")); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.osabi %d (%s)\n", + "find_arch_by_info: info.osabi %d (%s)\n", info.osabi, gdbarch_osabi_name (info.osabi)); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.abfd 0x%lx\n", + "find_arch_by_info: info.abfd 0x%lx\n", (long) info.abfd); fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: info.tdep_info 0x%lx\n", + "find_arch_by_info: info.tdep_info 0x%lx\n", (long) info.tdep_info); } - /* Find the target that knows about this architecture. */ + /* Find the tdep code that knows about this architecture. */ for (rego = gdbarch_registry; rego != NULL; rego = rego->next) @@ -2181,86 +2187,61 @@ gdbarch_update_p (struct gdbarch_info info) if (rego == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\\n"); + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "No matching architecture\n"); return 0; } - /* Swap the data belonging to the old target out setting the - installed data to zero. This stops the ->init() function trying - to refer to the previous architecture's global data structures. */ - swapout_gdbarch_swap (current_gdbarch); - clear_gdbarch_swap (current_gdbarch); - - /* Save the previously selected architecture, setting the global to - NULL. This stops ->init() trying to use the previous - architecture's configuration. The previous architecture may not - even be of the same architecture family. The most recent - architecture of the same family is found at the head of the - rego->arches list. */ - old_gdbarch = current_gdbarch; - current_gdbarch = NULL; - - /* Ask the target for a replacement architecture. */ + /* Ask the tdep code for an architecture that matches "info". */ new_gdbarch = rego->init (info, rego->arches); - /* Did the target like it? No. Reject the change and revert to the - old architecture. */ + /* Did the tdep code like it? No. Reject the change and revert to + the old architecture. */ if (new_gdbarch == NULL) { if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\\n"); - swapin_gdbarch_swap (old_gdbarch); - current_gdbarch = old_gdbarch; - return 0; + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Target rejected architecture\n"); + return NULL; } - /* Did the architecture change? No. Oops, put the old architecture - back. */ - if (old_gdbarch == new_gdbarch) + /* Is this a pre-existing architecture (as determined by already + being initialized)? Move it to the front of the architecture + list (keeping the list sorted Most Recently Used). */ + if (new_gdbarch->initialized_p) { + struct gdbarch_list **list; + struct gdbarch_list *this; if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\\n", + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "Previous architecture 0x%08lx (%s) selected\n", (long) new_gdbarch, new_gdbarch->bfd_arch_info->printable_name); - swapin_gdbarch_swap (old_gdbarch); - current_gdbarch = old_gdbarch; - return 1; + /* Find the existing arch in the list. */ + for (list = ®o->arches; + (*list) != NULL && (*list)->gdbarch != new_gdbarch; + list = &(*list)->next); + /* It had better be in the list of architectures. */ + gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch); + /* Unlink THIS. */ + this = (*list); + (*list) = this->next; + /* Insert THIS at the front. */ + this->next = rego->arches; + rego->arches = this; + /* Return it. */ + return new_gdbarch; } - /* Is this a pre-existing architecture? Yes. Move it to the front - of the list of architectures (keeping the list sorted Most - Recently Used) and then copy it in. */ - { - struct gdbarch_list **list; - for (list = ®o->arches; - (*list) != NULL; - list = &(*list)->next) - { - if ((*list)->gdbarch == new_gdbarch) - { - struct gdbarch_list *this; - if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, - new_gdbarch->bfd_arch_info->printable_name); - /* Unlink this. */ - this = (*list); - (*list) = this->next; - /* Insert in the front. */ - this->next = rego->arches; - rego->arches = this; - /* Copy the new architecture in. */ - current_gdbarch = new_gdbarch; - swapin_gdbarch_swap (new_gdbarch); - architecture_changed_event (); - return 1; - } - } - } - - /* Prepend this new architecture to the architecture list (keep the - list sorted Most Recently Used). */ + /* It's a new architecture. */ + if (gdbarch_debug) + fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " + "New architecture 0x%08lx (%s) selected\n", + (long) new_gdbarch, + new_gdbarch->bfd_arch_info->printable_name); + + /* Insert the new architecture into the front of the architecture + list (keep the list sorted Most Recently Used). */ { struct gdbarch_list *this = XMALLOC (struct gdbarch_list); this->next = rego->arches; @@ -2268,37 +2249,59 @@ gdbarch_update_p (struct gdbarch_info info) rego->arches = this; } - /* Switch to this new architecture marking it initialized. */ - current_gdbarch = new_gdbarch; - current_gdbarch->initialized_p = 1; - if (gdbarch_debug) - { - fprintf_unfiltered (gdb_stdlog, - "gdbarch_update: New architecture 0x%08lx (%s) selected\\n", - (long) new_gdbarch, - new_gdbarch->bfd_arch_info->printable_name); - } - /* Check that the newly installed architecture is valid. Plug in any post init values. */ new_gdbarch->dump_tdep = rego->dump_tdep; verify_gdbarch (new_gdbarch); + new_gdbarch->initialized_p = 1; - /* Initialize the per-architecture memory (swap) areas. - CURRENT_GDBARCH must be update before these modules are - called. */ - init_gdbarch_swap (new_gdbarch); - - /* Initialize the per-architecture data. CURRENT_GDBARCH - must be updated before these modules are called. */ - architecture_changed_event (); + /* Initialize any per-architecture swap areas. This phase requires + a valid global CURRENT_GDBARCH. Set it momentarially, and then + swap the entire architecture out. */ + current_gdbarch = new_gdbarch; + current_gdbarch_swap_init_hack (); + current_gdbarch_swap_out_hack (); if (gdbarch_debug) - gdbarch_dump (current_gdbarch, gdb_stdlog); + gdbarch_dump (new_gdbarch, gdb_stdlog); - return 1; + return new_gdbarch; } +struct gdbarch * +gdbarch_find_by_info (struct gdbarch_info info) +{ + /* Save the previously selected architecture, setting the global to + NULL. This stops things like gdbarch->init() trying to use the + previous architecture's configuration. The previous architecture + may not even be of the same architecture family. The most recent + architecture of the same family is found at the head of the + rego->arches list. */ + struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + + /* Find the specified architecture. */ + struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info); + + /* Restore the existing architecture. */ + gdb_assert (current_gdbarch == NULL); + current_gdbarch_swap_in_hack (old_gdbarch); + + return new_gdbarch; +} + +/* Make the specified architecture current, swapping the existing one + out. */ + +void +deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) +{ + gdb_assert (new_gdbarch != NULL); + gdb_assert (current_gdbarch != NULL); + gdb_assert (new_gdbarch->initialized_p); + current_gdbarch_swap_out_hack (); + current_gdbarch_swap_in_hack (new_gdbarch); + architecture_changed_event (); +} extern void _initialize_gdbarch (void); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 42dab16..603c33f 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,20 @@ +2003-10-13 Daniel Jacobowitz <drow@mvista.com> + + * linux-low.c (linux_resume): Take a struct thread_resume * + argument. + (linux_wait): Update call. + (resume_ptr): New static variable. + (linux_continue_one_thread): Renamed from + linux_continue_one_process. Use resume_ptr. + (linux_resume): Use linux_continue_one_thread. + * server.c (handle_v_cont, handle_v_requests): New functions. + (myresume): New function. + (main): Handle 'v' case. + * target.h (struct thread_resume): New type. + (struct target_ops): Change argument of "resume" to struct + thread_resume *. + (myresume): Delete macro. + 2003-08-08 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (install-only): Create dest dir. Support DESTDIR. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 55c187c..68b3f65 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -52,7 +52,7 @@ int using_threads; static void linux_resume_one_process (struct inferior_list_entry *entry, int step, int signal); -static void linux_resume (int step, int signal); +static void linux_resume (struct thread_resume *resume_info); static void stop_all_processes (void); static int linux_wait_for_event (struct thread_info *child); @@ -652,7 +652,12 @@ retry: /* No stepping, no signal - unless one is pending already, of course. */ if (child == NULL) - linux_resume (0, 0); + { + struct thread_resume resume_info; + resume_info.thread = -1; + resume_info.step = resume_info.sig = resume_info.leave_stopped = 0; + linux_resume (&resume_info); + } } enable_async_io (); @@ -868,33 +873,48 @@ linux_resume_one_process (struct inferior_list_entry *entry, perror_with_name ("ptrace"); } -/* This function is called once per process other than the first - one. The first process we are told the signal to continue - with, and whether to step or continue; for all others, any - existing signals will be marked in status_pending_p to be - reported momentarily, and we preserve the stepping flag. */ +static struct thread_resume *resume_ptr; + +/* This function is called once per thread. We look up the thread + in RESUME_PTR, which will tell us whether to resume, step, or leave + the thread stopped; and what signal, if any, it should be sent. + For threads which we aren't explicitly told otherwise, we preserve + the stepping flag; this is used for stepping over gdbserver-placed + breakpoints. If the thread has a status pending, it may not actually + be resumed. */ static void -linux_continue_one_process (struct inferior_list_entry *entry) +linux_continue_one_thread (struct inferior_list_entry *entry) { struct process_info *process; + struct thread_info *thread; + int ndx, step; + + thread = (struct thread_info *) entry; + process = get_thread_process (thread); + + ndx = 0; + while (resume_ptr[ndx].thread != -1 && resume_ptr[ndx].thread != entry->id) + ndx++; + + if (resume_ptr[ndx].leave_stopped) + return; + + if (resume_ptr[ndx].thread == -1) + step = process->stepping || resume_ptr[ndx].step; + else + step = resume_ptr[ndx].step; - process = (struct process_info *) entry; - linux_resume_one_process (entry, process->stepping, 0); + linux_resume_one_process (&process->head, step, resume_ptr[ndx].sig); } static void -linux_resume (int step, int signal) +linux_resume (struct thread_resume *resume_info) { - struct process_info *process; - - process = get_thread_process (current_inferior); - - /* If the current process has a status pending, this signal will - be enqueued and sent later. */ - linux_resume_one_process (&process->head, step, signal); + /* Yes, this is quadratic. If it ever becomes a problem then it's + fairly easy to fix. Yes, the use of a global here is rather ugly. */ - if (cont_thread == 0 || cont_thread == -1) - for_each_inferior (&all_processes, linux_continue_one_process); + resume_ptr = resume_info; + for_each_inferior (&all_threads, linux_continue_one_thread); } #ifdef HAVE_LINUX_USRREGS diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 81fde5b..dffff2e 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -125,6 +125,155 @@ handle_query (char *own_buf) own_buf[0] = 0; } +/* Parse vCont packets. */ +void +handle_v_cont (char *own_buf, char *status, unsigned char *signal) +{ + char *p, *q; + int n = 0, i = 0; + struct thread_resume *resume_info, default_action; + + /* Count the number of semicolons in the packet. There should be one + for every action. */ + p = &own_buf[5]; + while (p) + { + n++; + p++; + p = strchr (p, ';'); + } + /* Allocate room for one extra action, for the default remain-stopped + behavior; if no default action is in the list, we'll need the extra + slot. */ + resume_info = malloc ((n + 1) * sizeof (resume_info[0])); + + default_action.thread = -1; + default_action.leave_stopped = 1; + default_action.step = 0; + default_action.sig = 0; + + p = &own_buf[5]; + i = 0; + while (*p) + { + p++; + + resume_info[i].leave_stopped = 0; + + if (p[0] == 's' || p[0] == 'S') + resume_info[i].step = 1; + else if (p[0] == 'c' || p[0] == 'C') + resume_info[i].step = 0; + else + goto err; + + if (p[0] == 'S' || p[0] == 'C') + { + int sig; + sig = strtol (p + 1, &q, 16); + if (p == q) + goto err; + p = q; + + if (!target_signal_to_host_p (sig)) + goto err; + resume_info[i].sig = target_signal_to_host (sig); + } + else + { + resume_info[i].sig = 0; + p = p + 1; + } + + if (p[0] == 0) + { + resume_info[i].thread = -1; + default_action = resume_info[i]; + + /* Note: we don't increment i here, we'll overwrite this entry + the next time through. */ + } + else if (p[0] == ':') + { + resume_info[i].thread = strtol (p + 1, &q, 16); + if (p == q) + goto err; + p = q; + if (p[0] != ';' && p[0] != 0) + goto err; + + i++; + } + } + + resume_info[i] = default_action; + + /* Still used in occasional places in the backend. */ + if (n == 1 && resume_info[0].thread != -1) + cont_thread = resume_info[0].thread; + else + cont_thread = -1; + + (*the_target->resume) (resume_info); + + free (resume_info); + + *signal = mywait (status, 1); + prepare_resume_reply (own_buf, *status, *signal); + return; + +err: + /* No other way to report an error... */ + strcpy (own_buf, ""); + free (resume_info); + return; +} + +/* Handle all of the extended 'v' packets. */ +void +handle_v_requests (char *own_buf, char *status, unsigned char *signal) +{ + if (strncmp (own_buf, "vCont;", 6) == 0) + { + handle_v_cont (own_buf, status, signal); + return; + } + + if (strncmp (own_buf, "vCont?", 6) == 0) + { + strcpy (own_buf, "vCont;c;C;s;S"); + return; + } + + /* Otherwise we didn't know what packet it was. Say we didn't + understand it. */ + own_buf[0] = 0; + return; +} + +void +myresume (int step, int sig) +{ + struct thread_resume resume_info[2]; + int n = 0; + + if (step || sig || cont_thread > 0) + { + resume_info[0].thread + = ((struct inferior_list_entry *) current_inferior)->id; + resume_info[0].step = step; + resume_info[0].sig = sig; + resume_info[0].leave_stopped = 0; + n++; + } + resume_info[n].thread = -1; + resume_info[n].step = 0; + resume_info[n].sig = 0; + resume_info[n].leave_stopped = (cont_thread > 0); + + (*the_target->resume) (resume_info); +} + static int attached; static void @@ -383,6 +532,10 @@ main (int argc, char *argv[]) own_buf[0] = '\0'; break; } + case 'v': + /* Extended (long) request. */ + handle_v_requests (own_buf, &status, &signal); + break; default: /* It is a request we don't understand. Respond with an empty packet so that gdb knows that we don't support this diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 1c47a3ae..aa0a44a 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -24,6 +24,25 @@ #ifndef TARGET_H #define TARGET_H +/* This structure describes how to resume a particular thread (or + all threads) based on the client's request. If thread is -1, then + this entry applies to all threads. These are generally passed around + as an array, and terminated by a thread == -1 entry. */ + +struct thread_resume +{ + int thread; + + /* If non-zero, leave this thread stopped. */ + int leave_stopped; + + /* If non-zero, we want to single-step. */ + int step; + + /* If non-zero, send this signal when we resume. */ + int sig; +}; + struct target_ops { /* Start a new process. @@ -56,14 +75,9 @@ struct target_ops int (*thread_alive) (int pid); - /* Resume the inferior process. - - If STEP is non-zero, we want to single-step. + /* Resume the inferior process. */ - If SIGNAL is nonzero, send the process that signal as we resume it. - */ - - void (*resume) (int step, int signo); + void (*resume) (struct thread_resume *resume_info); /* Wait for the inferior process to change state. @@ -132,9 +146,6 @@ void set_target_ops (struct target_ops *); #define mythread_alive(pid) \ (*the_target->thread_alive) (pid) -#define myresume(step,signo) \ - (*the_target->resume) (step, signo) - #define fetch_inferior_registers(regno) \ (*the_target->fetch_registers) (regno) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9953e89..1b6620a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -129,9 +129,6 @@ struct extra static void add_name (struct extra *, const char *); static void add_mangled_type (struct extra *, struct type *); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE static void cfront_mangle_name (struct type *, int, int); -#endif /* OBSOLETE CFront */ static void print_bit_vector (B_TYPE *, int); static void print_arg_types (struct field *, int, int); static void dump_fn_fieldlists (struct type *, int); @@ -1478,194 +1475,6 @@ check_typedef (struct type *type) return type; } -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* New code added to support parsing of Cfront stabs strings */ -// OBSOLETE #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; } -// OBSOLETE #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; } - -// OBSOLETE static void -// OBSOLETE add_name (struct extra *pextras, char *n) -// OBSOLETE { -// OBSOLETE int nlen; - -// OBSOLETE if ((nlen = (n ? strlen (n) : 0)) == 0) -// OBSOLETE return; -// OBSOLETE sprintf (pextras->str + pextras->len, "%d%s", nlen, n); -// OBSOLETE pextras->len = strlen (pextras->str); -// OBSOLETE } - -// OBSOLETE static void -// OBSOLETE add_mangled_type (struct extra *pextras, struct type *t) -// OBSOLETE { -// OBSOLETE enum type_code tcode; -// OBSOLETE int tlen, tflags; -// OBSOLETE char *tname; - -// OBSOLETE tcode = TYPE_CODE (t); -// OBSOLETE tlen = TYPE_LENGTH (t); -// OBSOLETE tflags = TYPE_FLAGS (t); -// OBSOLETE tname = TYPE_NAME (t); -// OBSOLETE /* args of "..." seem to get mangled as "e" */ - -// OBSOLETE switch (tcode) -// OBSOLETE { -// OBSOLETE case TYPE_CODE_INT: -// OBSOLETE if (tflags == 1) -// OBSOLETE ADD_EXTRA ('U'); -// OBSOLETE switch (tlen) -// OBSOLETE { -// OBSOLETE case 1: -// OBSOLETE ADD_EXTRA ('c'); -// OBSOLETE break; -// OBSOLETE case 2: -// OBSOLETE ADD_EXTRA ('s'); -// OBSOLETE break; -// OBSOLETE case 4: -// OBSOLETE { -// OBSOLETE char *pname; -// OBSOLETE if ((pname = strrchr (tname, 'l'), pname) && !strcmp (pname, "long")) -// OBSOLETE { -// OBSOLETE ADD_EXTRA ('l'); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE ADD_EXTRA ('i'); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, "Bad int type code length x%x", -// OBSOLETE tlen); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_FLT: -// OBSOLETE switch (tlen) -// OBSOLETE { -// OBSOLETE case 4: -// OBSOLETE ADD_EXTRA ('f'); -// OBSOLETE break; -// OBSOLETE case 8: -// OBSOLETE ADD_EXTRA ('d'); -// OBSOLETE break; -// OBSOLETE case 16: -// OBSOLETE ADD_EXTRA ('r'); -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, "Bad float type code length x%x", -// OBSOLETE tlen); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_REF: -// OBSOLETE ADD_EXTRA ('R'); -// OBSOLETE /* followed by what it's a ref to */ -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_PTR: -// OBSOLETE ADD_EXTRA ('P'); -// OBSOLETE /* followed by what it's a ptr to */ -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_TYPEDEF: -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, -// OBSOLETE "Typedefs in overloaded functions not yet supported"); -// OBSOLETE } -// OBSOLETE /* followed by type bytes & name */ -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_FUNC: -// OBSOLETE ADD_EXTRA ('F'); -// OBSOLETE /* followed by func's arg '_' & ret types */ -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_VOID: -// OBSOLETE ADD_EXTRA ('v'); -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_METHOD: -// OBSOLETE ADD_EXTRA ('M'); -// OBSOLETE /* followed by name of class and func's arg '_' & ret types */ -// OBSOLETE add_name (pextras, tname); -// OBSOLETE ADD_EXTRA ('F'); /* then mangle function */ -// OBSOLETE break; -// OBSOLETE case TYPE_CODE_STRUCT: /* C struct */ -// OBSOLETE case TYPE_CODE_UNION: /* C union */ -// OBSOLETE case TYPE_CODE_ENUM: /* Enumeration type */ -// OBSOLETE /* followed by name of type */ -// OBSOLETE add_name (pextras, tname); -// OBSOLETE break; - -// OBSOLETE /* errors possible types/not supported */ -// OBSOLETE case TYPE_CODE_CHAR: -// OBSOLETE case TYPE_CODE_ARRAY: /* Array type */ -// OBSOLETE case TYPE_CODE_MEMBER: /* Member type */ -// OBSOLETE case TYPE_CODE_BOOL: -// OBSOLETE case TYPE_CODE_COMPLEX: /* Complex float */ -// OBSOLETE case TYPE_CODE_UNDEF: -// OBSOLETE case TYPE_CODE_SET: /* Pascal sets */ -// OBSOLETE case TYPE_CODE_RANGE: -// OBSOLETE case TYPE_CODE_STRING: -// OBSOLETE case TYPE_CODE_BITSTRING: -// OBSOLETE case TYPE_CODE_ERROR: -// OBSOLETE default: -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, "Unknown type code x%x", tcode); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE if (TYPE_TARGET_TYPE (t)) -// OBSOLETE add_mangled_type (pextras, TYPE_TARGET_TYPE (t)); -// OBSOLETE } - -// OBSOLETE void -// OBSOLETE cfront_mangle_name (struct type *type, int i, int j) -// OBSOLETE { -// OBSOLETE struct fn_field *f; -// OBSOLETE char *mangled_name = gdb_mangle_name (type, i, j); - -// OBSOLETE f = TYPE_FN_FIELDLIST1 (type, i); /* moved from below */ - -// OBSOLETE /* kludge to support cfront methods - gdb expects to find "F" for -// OBSOLETE ARM_mangled names, so when we mangle, we have to add it here */ -// OBSOLETE if (ARM_DEMANGLING) -// OBSOLETE { -// OBSOLETE int k; -// OBSOLETE char *arm_mangled_name; -// OBSOLETE struct fn_field *method = &f[j]; -// OBSOLETE char *field_name = TYPE_FN_FIELDLIST_NAME (type, i); -// OBSOLETE char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); -// OBSOLETE char *newname = type_name_no_tag (type); - -// OBSOLETE struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); -// OBSOLETE int nargs = TYPE_NFIELDS (ftype); /* number of args */ -// OBSOLETE struct extra extras, *pextras = &extras; -// OBSOLETE INIT_EXTRA - -// OBSOLETE if (TYPE_FN_FIELD_STATIC_P (f, j)) /* j for sublist within this list */ -// OBSOLETE ADD_EXTRA ('S') -// OBSOLETE ADD_EXTRA ('F') -// OBSOLETE /* add args here! */ -// OBSOLETE if (nargs <= 1) /* no args besides this */ -// OBSOLETE ADD_EXTRA ('v') -// OBSOLETE else -// OBSOLETE { -// OBSOLETE for (k = 1; k < nargs; k++) -// OBSOLETE { -// OBSOLETE struct type *t; -// OBSOLETE t = TYPE_FIELD_TYPE (ftype, k); -// OBSOLETE add_mangled_type (pextras, t); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE ADD_EXTRA ('\0') -// OBSOLETE printf ("add_mangled_type: %s\n", extras.str); /* FIXME */ -// OBSOLETE xasprintf (&arm_mangled_name, "%s%s", mangled_name, extras.str); -// OBSOLETE xfree (mangled_name); -// OBSOLETE mangled_name = arm_mangled_name; -// OBSOLETE } -// OBSOLETE } - -// OBSOLETE #undef ADD_EXTRA -// OBSOLETE /* End of new code added to support parsing of Cfront stabs strings */ -#endif /* OBSOLETE CFront */ - /* Parse a type expression in the string [P..P+LENGTH). If an error occurs, silently return builtin_type_void. */ diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index a75b169..a61d577 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1024,7 +1024,7 @@ inf_validate_procs (struct inf *inf) /* The current thread we're considering. */ struct proc *thread = inf->threads; - bzero (matched, sizeof (matched)); + memset (matched, 0, sizeof (matched)); while (thread) { diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 9989279..fc4df5d 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -468,7 +468,7 @@ fetch_register (int regno) if (regno < FP0_REGNUM) supply_register (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs); else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno)) - i387_supply_fsave ((const char *) &npx, regno); + i387_supply_fsave (current_regcache, regno, &npx); else internal_error (__FILE__, __LINE__, "Invalid register no. %d in fetch_register.", regno); @@ -483,7 +483,7 @@ go32_fetch_registers (int regno) { for (regno = 0; regno < FP0_REGNUM; regno++) fetch_register (regno); - i387_supply_fsave ((const char *) &npx, -1); + i387_supply_fsave (current_regcache, -1, &npx); } } diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index a2fab9a..ec05f01 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1,4 +1,4 @@ -/* Target-machine dependent code for Hitachi H8/300, for GDB. +/* Target-machine dependent code for Renesas H8/300, for GDB. Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -49,7 +49,7 @@ enum h8300h_reg_size = 4, h8300_max_reg_size = 4, }; -#define BINWORD (h8300hmode ? h8300h_reg_size : h8300_reg_size) +#define BINWORD (h8300hmode && !h8300_normal_mode ? h8300h_reg_size : h8300_reg_size) enum gdb_regnum { @@ -350,7 +350,7 @@ h8300_examine_prologue (CORE_ADDR ip, CORE_ADDR limit, } /* If the PC isn't valid, quit now. */ - if (ip == 0 || ip & (h8300hmode ? ~0xffffff : ~0xffff)) + if (ip == 0 || ip & (h8300hmode && !h8300_normal_mode ? ~0xffffff : ~0xffff)) return 0; next_ip = h8300_next_prologue_insn (ip, limit, &insn_word); @@ -478,7 +478,7 @@ h8300_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR func_addr, func_end; - if (!get_frame_saved_regs (fi)) + if (!deprecated_get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -492,7 +492,7 @@ h8300_frame_init_saved_regs (struct frame_info *fi) ? sal.end : get_frame_pc (fi); /* This will fill in fields in fi. */ h8300_examine_prologue (func_addr, limit, get_frame_base (fi), - get_frame_saved_regs (fi), fi); + deprecated_get_frame_saved_regs (fi), fi); } /* Else we're out of luck (can't debug completely stripped code). FIXME. */ @@ -521,7 +521,7 @@ h8300_frame_chain (struct frame_info *thisframe) E_PC_REGNUM); return get_frame_base (thisframe); } - return get_frame_saved_regs (thisframe)[E_SP_REGNUM]; + return deprecated_get_frame_saved_regs (thisframe)[E_SP_REGNUM]; } /* Return the saved PC from this frame. @@ -559,12 +559,6 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi) } } -/* Round N up or down to the nearest multiple of UNIT. - Evaluate N only once, UNIT several times. - UNIT must be a power of two. */ -#define round_up(n, unit) (((n) + (unit) - 1) & -(unit)) -#define round_down(n, unit) ((n) & -(unit)) - /* Function: push_dummy_call Setup the function arguments for calling a function in the inferior. In this discussion, a `word' is 16 bits on the H8/300s, and 32 bits @@ -641,12 +635,12 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, int argument; /* First, make sure the stack is properly aligned. */ - sp = round_down (sp, wordsize); + sp = align_down (sp, wordsize); /* Now make sure there's space on the stack for the arguments. We may over-allocate a little here, but that won't hurt anything. */ for (argument = 0; argument < nargs; argument++) - stack_alloc += round_up (TYPE_LENGTH (VALUE_TYPE (args[argument])), + stack_alloc += align_up (TYPE_LENGTH (VALUE_TYPE (args[argument])), wordsize); sp -= stack_alloc; @@ -665,7 +659,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, char *contents = (char *) VALUE_CONTENTS (args[argument]); /* Pad the argument appropriately. */ - int padded_len = round_up (len, wordsize); + int padded_len = align_up (len, wordsize); char *padded = alloca (padded_len); memset (padded, 0, padded_len); @@ -749,11 +743,11 @@ h8300_pop_frame (void) { /* Don't forget E_SP_REGNUM is a frame_saved_regs struct is the actual value we want, not the address of the value we want. */ - if (get_frame_saved_regs (frame)[regno] && regno != E_SP_REGNUM) + if (deprecated_get_frame_saved_regs (frame)[regno] && regno != E_SP_REGNUM) write_register (regno, read_memory_integer - (get_frame_saved_regs (frame)[regno], BINWORD)); - else if (get_frame_saved_regs (frame)[regno] && regno == E_SP_REGNUM) + (deprecated_get_frame_saved_regs (frame)[regno], BINWORD)); + else if (deprecated_get_frame_saved_regs (frame)[regno] && regno == E_SP_REGNUM) write_register (regno, get_frame_base (frame) + 2 * BINWORD); } @@ -950,7 +944,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, if (!name || !*name) return; - frame_read_signed_register (frame, regno, &rval); + rval = get_frame_register_signed (frame, regno); fprintf_filtered (file, "%-14s ", name); if (regno == E_PSEUDO_CCR_REGNUM || (regno == E_PSEUDO_EXR_REGNUM && h8300smode)) @@ -1226,8 +1220,18 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum); set_gdbarch_stab_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum); set_gdbarch_register_name (gdbarch, h8300_register_name); - set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + if(info.bfd_arch_info->mach != bfd_mach_h8300hn) + { + h8300_normal_mode = 0; + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + } + else + { + h8300_normal_mode = 1; + set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + } set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); set_gdbarch_print_insn (gdbarch, print_insn_h8300h); @@ -1244,8 +1248,18 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); set_gdbarch_register_name (gdbarch, h8300s_register_name); - set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + if(info.bfd_arch_info->mach != bfd_mach_h8300sn) + { + h8300_normal_mode = 0; + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + } + else + { + h8300_normal_mode = 1; + set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + } set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); set_gdbarch_print_insn (gdbarch, print_insn_h8300s); @@ -1262,8 +1276,18 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum); set_gdbarch_register_name (gdbarch, h8300sx_register_name); - set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + if(info.bfd_arch_info->mach != bfd_mach_h8300sxn) + { + h8300_normal_mode = 0; + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + } + else + { + h8300_normal_mode = 1; + set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + } set_gdbarch_extract_return_value (gdbarch, h8300h_extract_return_value); set_gdbarch_store_return_value (gdbarch, h8300h_store_return_value); set_gdbarch_print_insn (gdbarch, print_insn_h8300s); @@ -1275,7 +1299,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* * Basic register fields and methods. diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c deleted file mode 100644 index f30fbd0..0000000 --- a/gdb/h8500-tdep.c +++ /dev/null @@ -1,739 +0,0 @@ -// OBSOLETE /* Target-dependent code for Hitachi H8/500, for GDB. -// OBSOLETE -// OBSOLETE Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software -// OBSOLETE 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 Contributed by Steve Chamberlain -// OBSOLETE sac@cygnus.com -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "gdbtypes.h" -// OBSOLETE #include "gdbcmd.h" -// OBSOLETE #include "value.h" -// OBSOLETE #include "dis-asm.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #define UNSIGNED_SHORT(X) ((X) & 0xffff) -// OBSOLETE -// OBSOLETE static int code_size = 2; -// OBSOLETE -// OBSOLETE static int data_size = 2; -// OBSOLETE -// OBSOLETE /* Shape of an H8/500 frame : -// OBSOLETE -// OBSOLETE arg-n -// OBSOLETE .. -// OBSOLETE arg-2 -// OBSOLETE arg-1 -// OBSOLETE return address <2 or 4 bytes> -// OBSOLETE old fp <2 bytes> -// OBSOLETE auto-n -// OBSOLETE .. -// OBSOLETE auto-1 -// OBSOLETE saved registers -// OBSOLETE -// OBSOLETE */ -// OBSOLETE -// OBSOLETE /* an easy to debug H8 stack frame looks like: -// OBSOLETE 0x6df6 push r6 -// OBSOLETE 0x0d76 mov.w r7,r6 -// OBSOLETE 0x6dfn push reg -// OBSOLETE 0x7905 nnnn mov.w #n,r5 or 0x1b87 subs #2,sp -// OBSOLETE 0x1957 sub.w r5,sp -// OBSOLETE -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #define IS_PUSH(x) (((x) & 0xff00)==0x6d00) -// OBSOLETE #define IS_LINK_8(x) ((x) == 0x17) -// OBSOLETE #define IS_LINK_16(x) ((x) == 0x1f) -// OBSOLETE #define IS_MOVE_FP(x) ((x) == 0x0d76) -// OBSOLETE #define IS_MOV_SP_FP(x) ((x) == 0x0d76) -// OBSOLETE #define IS_SUB2_SP(x) ((x) == 0x1b87) -// OBSOLETE #define IS_MOVK_R5(x) ((x) == 0x7905) -// OBSOLETE #define IS_SUB_R5SP(x) ((x) == 0x1957) -// OBSOLETE -// OBSOLETE #define LINK_8 0x17 -// OBSOLETE #define LINK_16 0x1f -// OBSOLETE -// OBSOLETE int minimum_mode = 1; -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_skip_prologue (CORE_ADDR start_pc) -// OBSOLETE { -// OBSOLETE short int w; -// OBSOLETE -// OBSOLETE w = read_memory_integer (start_pc, 1); -// OBSOLETE if (w == LINK_8) -// OBSOLETE { -// OBSOLETE start_pc += 2; -// OBSOLETE w = read_memory_integer (start_pc, 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (w == LINK_16) -// OBSOLETE { -// OBSOLETE start_pc += 3; -// OBSOLETE w = read_memory_integer (start_pc, 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE return start_pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_addr_bits_remove (CORE_ADDR addr) -// OBSOLETE { -// OBSOLETE return ((addr) & 0xffffff); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Given a GDB frame, determine the address of the calling function's -// OBSOLETE frame. This will be used to create a new GDB frame struct, and -// OBSOLETE then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be -// OBSOLETE called for the new frame. -// OBSOLETE -// OBSOLETE For us, the frame address is its stack pointer value, so we look up -// OBSOLETE the function prologue to determine the caller's sp value, and return it. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_frame_chain (struct frame_info *thisframe) -// OBSOLETE { -// OBSOLETE if (!inside_entry_file (thisframe->pc)) -// OBSOLETE return (read_memory_integer (get_frame_base (thisframe), PTR_SIZE)); -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or -// OBSOLETE is not the address of a valid instruction, the address of the next -// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word -// OBSOLETE of the instruction. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1) -// OBSOLETE { -// OBSOLETE if (addr < lim + 8) -// OBSOLETE { -// OBSOLETE read_memory (addr, pword1, 1); -// OBSOLETE read_memory (addr, pword1 + 1, 1); -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Examine the prologue of a function. `ip' points to the first -// OBSOLETE instruction. `limit' is the limit of the prologue (e.g. the addr -// OBSOLETE of the first linenumber, or perhaps the program counter if we're -// OBSOLETE stepping through). `frame_sp' is the stack pointer value in use in -// OBSOLETE this frame. `fsr' is a pointer to a frame_saved_regs structure -// OBSOLETE into which we put info about the registers saved by this frame. -// OBSOLETE `fi' is a struct frame_info pointer; we fill in various fields in -// OBSOLETE it to reflect the offsets of the arg pointer and the locals -// OBSOLETE pointer. */ -// OBSOLETE -// OBSOLETE /* Return the saved PC from this frame. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE frame_saved_pc (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return read_memory_integer (get_frame_base (frame) + 2, PTR_SIZE); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_pop_frame (void) -// OBSOLETE { -// OBSOLETE unsigned regnum; -// OBSOLETE struct frame_saved_regs fsr; -// OBSOLETE struct frame_info *frame = get_current_frame (); -// OBSOLETE -// OBSOLETE deprecated_get_frame_saved_regs (frame, &fsr); -// OBSOLETE -// OBSOLETE for (regnum = 0; regnum < 8; regnum++) -// OBSOLETE { -// OBSOLETE if (fsr.regs[regnum]) -// OBSOLETE write_register (regnum, read_memory_short (fsr.regs[regnum])); -// OBSOLETE -// OBSOLETE flush_cached_frames (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE h8500_print_register_hook (int regno) -// OBSOLETE { -// OBSOLETE if (regno == CCR_REGNUM) -// OBSOLETE { -// OBSOLETE /* CCR register */ -// OBSOLETE -// OBSOLETE int C, Z, N, V; -// OBSOLETE unsigned char b[2]; -// OBSOLETE unsigned char l; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, b); -// OBSOLETE l = b[1]; -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("I-%d - ", (l & 0x80) != 0); -// OBSOLETE N = (l & 0x8) != 0; -// OBSOLETE Z = (l & 0x4) != 0; -// OBSOLETE V = (l & 0x2) != 0; -// OBSOLETE C = (l & 0x1) != 0; -// OBSOLETE printf_unfiltered ("N-%d ", N); -// OBSOLETE printf_unfiltered ("Z-%d ", Z); -// OBSOLETE printf_unfiltered ("V-%d ", V); -// OBSOLETE printf_unfiltered ("C-%d ", C); -// OBSOLETE if ((C | Z) == 0) -// OBSOLETE printf_unfiltered ("u> "); -// OBSOLETE if ((C | Z) == 1) -// OBSOLETE printf_unfiltered ("u<= "); -// OBSOLETE if ((C == 0)) -// OBSOLETE printf_unfiltered ("u>= "); -// OBSOLETE if (C == 1) -// OBSOLETE printf_unfiltered ("u< "); -// OBSOLETE if (Z == 0) -// OBSOLETE printf_unfiltered ("!= "); -// OBSOLETE if (Z == 1) -// OBSOLETE printf_unfiltered ("== "); -// OBSOLETE if ((N ^ V) == 0) -// OBSOLETE printf_unfiltered (">= "); -// OBSOLETE if ((N ^ V) == 1) -// OBSOLETE printf_unfiltered ("< "); -// OBSOLETE if ((Z | (N ^ V)) == 0) -// OBSOLETE printf_unfiltered ("> "); -// OBSOLETE if ((Z | (N ^ V)) == 1) -// OBSOLETE printf_unfiltered ("<= "); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE h8500_print_registers_info (struct gdbarch *gdbarch, -// OBSOLETE struct ui_file *file, -// OBSOLETE struct frame_info *frame, -// OBSOLETE int regnum, int print_all) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE const int numregs = NUM_REGS + NUM_PSEUDO_REGS; -// OBSOLETE char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); -// OBSOLETE char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); -// OBSOLETE -// OBSOLETE for (i = 0; i < numregs; i++) -// OBSOLETE { -// OBSOLETE /* Decide between printing all regs, non-float / vector regs, or -// OBSOLETE specific reg. */ -// OBSOLETE if (regnum == -1) -// OBSOLETE { -// OBSOLETE if (!print_all) -// OBSOLETE { -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE continue; -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (i != regnum) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If the register name is empty, it is undefined for this -// OBSOLETE processor, so don't display anything. */ -// OBSOLETE if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') -// OBSOLETE continue; -// OBSOLETE -// OBSOLETE fputs_filtered (REGISTER_NAME (i), file); -// OBSOLETE print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); -// OBSOLETE -// OBSOLETE /* Get the data in raw format. */ -// OBSOLETE if (! frame_register_read (frame, i, raw_buffer)) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "*value not available*\n"); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. -// OBSOLETE The function frame_register_read() should have returned the -// OBSOLETE pre-cooked register so no conversion is necessary. */ -// OBSOLETE /* Convert raw data to virtual format if necessary. */ -// OBSOLETE if (REGISTER_CONVERTIBLE (i)) -// OBSOLETE { -// OBSOLETE REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), -// OBSOLETE raw_buffer, virtual_buffer); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE memcpy (virtual_buffer, raw_buffer, -// OBSOLETE REGISTER_VIRTUAL_SIZE (i)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If virtual format is floating, print it that way, and in raw -// OBSOLETE hex. */ -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE { -// OBSOLETE int j; -// OBSOLETE -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\t(raw 0x"); -// OBSOLETE for (j = 0; j < REGISTER_RAW_SIZE (i); j++) -// OBSOLETE { -// OBSOLETE int idx; -// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) -// OBSOLETE idx = j; -// OBSOLETE else -// OBSOLETE idx = REGISTER_RAW_SIZE (i) - 1 - j; -// OBSOLETE fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); -// OBSOLETE } -// OBSOLETE fprintf_filtered (file, ")"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Print the register in hex. */ -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 'x', 1, 0, Val_pretty_default); -// OBSOLETE /* If not a vector register, print it also according to its -// OBSOLETE natural format. */ -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "\t"); -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Some h8500 specific info. */ -// OBSOLETE h8500_print_register_hook (i); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_do_registers_info (int regnum, int all) -// OBSOLETE { -// OBSOLETE h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, -// OBSOLETE regnum, all); -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE h8500_register_size (int regno) -// OBSOLETE { -// OBSOLETE switch (regno) -// OBSOLETE { -// OBSOLETE case SEG_C_REGNUM: -// OBSOLETE case SEG_D_REGNUM: -// OBSOLETE case SEG_E_REGNUM: -// OBSOLETE case SEG_T_REGNUM: -// OBSOLETE return 1; -// OBSOLETE case R0_REGNUM: -// OBSOLETE case R1_REGNUM: -// OBSOLETE case R2_REGNUM: -// OBSOLETE case R3_REGNUM: -// OBSOLETE case R4_REGNUM: -// OBSOLETE case R5_REGNUM: -// OBSOLETE case R6_REGNUM: -// OBSOLETE case R7_REGNUM: -// OBSOLETE case CCR_REGNUM: -// OBSOLETE return 2; -// OBSOLETE -// OBSOLETE case PR0_REGNUM: -// OBSOLETE case PR1_REGNUM: -// OBSOLETE case PR2_REGNUM: -// OBSOLETE case PR3_REGNUM: -// OBSOLETE case PR4_REGNUM: -// OBSOLETE case PR5_REGNUM: -// OBSOLETE case PR6_REGNUM: -// OBSOLETE case PR7_REGNUM: -// OBSOLETE case PC_REGNUM: -// OBSOLETE return 4; -// OBSOLETE default: -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct type * -// OBSOLETE h8500_register_virtual_type (int regno) -// OBSOLETE { -// OBSOLETE switch (regno) -// OBSOLETE { -// OBSOLETE case SEG_C_REGNUM: -// OBSOLETE case SEG_E_REGNUM: -// OBSOLETE case SEG_D_REGNUM: -// OBSOLETE case SEG_T_REGNUM: -// OBSOLETE return builtin_type_unsigned_char; -// OBSOLETE case R0_REGNUM: -// OBSOLETE case R1_REGNUM: -// OBSOLETE case R2_REGNUM: -// OBSOLETE case R3_REGNUM: -// OBSOLETE case R4_REGNUM: -// OBSOLETE case R5_REGNUM: -// OBSOLETE case R6_REGNUM: -// OBSOLETE case R7_REGNUM: -// OBSOLETE case CCR_REGNUM: -// OBSOLETE return builtin_type_unsigned_short; -// OBSOLETE case PR0_REGNUM: -// OBSOLETE case PR1_REGNUM: -// OBSOLETE case PR2_REGNUM: -// OBSOLETE case PR3_REGNUM: -// OBSOLETE case PR4_REGNUM: -// OBSOLETE case PR5_REGNUM: -// OBSOLETE case PR6_REGNUM: -// OBSOLETE case PR7_REGNUM: -// OBSOLETE case PC_REGNUM: -// OBSOLETE return builtin_type_unsigned_long; -// OBSOLETE default: -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE frame_find_saved_regs (struct frame_info *frame_info, -// OBSOLETE struct frame_saved_regs *frame_saved_regs) -// OBSOLETE { -// OBSOLETE register int regnum; -// OBSOLETE register int regmask; -// OBSOLETE register CORE_ADDR next_addr; -// OBSOLETE register CORE_ADDR pc; -// OBSOLETE unsigned char thebyte; -// OBSOLETE -// OBSOLETE memset (frame_saved_regs, '\0', sizeof *frame_saved_regs); -// OBSOLETE -// OBSOLETE if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4 -// OBSOLETE && (frame_info)->pc <= (frame_info)->frame) -// OBSOLETE { -// OBSOLETE next_addr = (frame_info)->frame; -// OBSOLETE pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE pc = get_pc_function_start ((frame_info)->pc); -// OBSOLETE /* Verify we have a link a6 instruction next; -// OBSOLETE if not we lose. If we win, find the address above the saved -// OBSOLETE regs using the amount of storage from the link instruction. -// OBSOLETE */ -// OBSOLETE -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE if (0x1f == thebyte) -// OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 2), pc += 2; -// OBSOLETE else if (0x17 == thebyte) -// OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 1), pc += 1; -// OBSOLETE else -// OBSOLETE goto lose; -// OBSOLETE #if 0 -// OBSOLETE /* FIXME steve */ -// OBSOLETE /* If have an add:g.waddal #-n, sp next, adjust next_addr. */ -// OBSOLETE if ((0x0c0177777 & read_memory_integer (pc, 2)) == 0157774) -// OBSOLETE next_addr += read_memory_integer (pc += 2, 4), pc += 4; -// OBSOLETE #endif -// OBSOLETE } -// OBSOLETE -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE if (thebyte == 0x12) -// OBSOLETE { -// OBSOLETE /* Got stm */ -// OBSOLETE pc++; -// OBSOLETE regmask = read_memory_integer (pc, 1); -// OBSOLETE pc++; -// OBSOLETE for (regnum = 0; regnum < 8; regnum++, regmask >>= 1) -// OBSOLETE { -// OBSOLETE if (regmask & 1) -// OBSOLETE { -// OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE } -// OBSOLETE /* Maybe got a load of pushes */ -// OBSOLETE while (thebyte == 0xbf) -// OBSOLETE { -// OBSOLETE pc++; -// OBSOLETE regnum = read_memory_integer (pc, 1) & 0x7; -// OBSOLETE pc++; -// OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; -// OBSOLETE thebyte = read_memory_integer (pc, 1); -// OBSOLETE } -// OBSOLETE -// OBSOLETE lose:; -// OBSOLETE -// OBSOLETE /* Remember the address of the frame pointer */ -// OBSOLETE (frame_saved_regs)->regs[FP_REGNUM] = (frame_info)->frame; -// OBSOLETE -// OBSOLETE /* This is where the old sp is hidden */ -// OBSOLETE (frame_saved_regs)->regs[SP_REGNUM] = (frame_info)->frame; -// OBSOLETE -// OBSOLETE /* And the PC - remember the pushed FP is always two bytes long */ -// OBSOLETE (frame_saved_regs)->regs[PC_REGNUM] = (frame_info)->frame + 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE saved_pc_after_call (void) -// OBSOLETE { -// OBSOLETE int x; -// OBSOLETE int a = read_register (SP_REGNUM); -// OBSOLETE -// OBSOLETE x = read_memory_integer (a, code_size); -// OBSOLETE if (code_size == 2) -// OBSOLETE { -// OBSOLETE /* Stick current code segement onto top */ -// OBSOLETE x &= 0xffff; -// OBSOLETE x |= read_register (SEG_C_REGNUM) << 16; -// OBSOLETE } -// OBSOLETE x &= 0xffffff; -// OBSOLETE return x; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_set_pointer_size (int newsize) -// OBSOLETE { -// OBSOLETE static int oldsize = 0; -// OBSOLETE -// OBSOLETE if (oldsize != newsize) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("pointer size set to %d bits\n", newsize); -// OBSOLETE oldsize = newsize; -// OBSOLETE if (newsize == 32) -// OBSOLETE { -// OBSOLETE minimum_mode = 0; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE minimum_mode = 1; -// OBSOLETE } -// OBSOLETE _initialize_gdbtypes (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE big_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 4; -// OBSOLETE data_size = 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE medium_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 4; -// OBSOLETE data_size = 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE compact_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (32); -// OBSOLETE code_size = 2; -// OBSOLETE data_size = 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE small_command (char *arg, int from_tty) -// OBSOLETE { -// OBSOLETE h8500_set_pointer_size (16); -// OBSOLETE code_size = 2; -// OBSOLETE data_size = 2; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static struct cmd_list_element *setmemorylist; -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_memory (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n"); -// OBSOLETE help_list (setmemorylist, "set memory ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* See if variable name is ppc or pr[0-7] */ -// OBSOLETE -// OBSOLETE int -// OBSOLETE h8500_is_trapped_internalvar (char *name) -// OBSOLETE { -// OBSOLETE if (name[0] != 'p') -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE if (strcmp (name + 1, "pc") == 0) -// OBSOLETE return 1; -// OBSOLETE -// OBSOLETE if (name[1] == 'r' -// OBSOLETE && name[2] >= '0' -// OBSOLETE && name[2] <= '7' -// OBSOLETE && name[3] == '\000') -// OBSOLETE return 1; -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct value * -// OBSOLETE h8500_value_of_trapped_internalvar (struct internalvar *var) -// OBSOLETE { -// OBSOLETE LONGEST regval; -// OBSOLETE unsigned char regbuf[4]; -// OBSOLETE int page_regnum, regnum; -// OBSOLETE -// OBSOLETE regnum = var->name[2] == 'c' ? PC_REGNUM : var->name[2] - '0'; -// OBSOLETE -// OBSOLETE switch (var->name[2]) -// OBSOLETE { -// OBSOLETE case 'c': -// OBSOLETE page_regnum = SEG_C_REGNUM; -// OBSOLETE break; -// OBSOLETE case '0': -// OBSOLETE case '1': -// OBSOLETE case '2': -// OBSOLETE case '3': -// OBSOLETE page_regnum = SEG_D_REGNUM; -// OBSOLETE break; -// OBSOLETE case '4': -// OBSOLETE case '5': -// OBSOLETE page_regnum = SEG_E_REGNUM; -// OBSOLETE break; -// OBSOLETE case '6': -// OBSOLETE case '7': -// OBSOLETE page_regnum = SEG_T_REGNUM; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL); -// OBSOLETE regval = regbuf[0] << 16; -// OBSOLETE -// OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL); -// OBSOLETE regval |= regbuf[0] << 8 | regbuf[1]; /* XXX host/target byte order */ -// OBSOLETE -// OBSOLETE xfree (var->value); /* Free up old value */ -// OBSOLETE -// OBSOLETE var->value = value_from_longest (builtin_type_unsigned_long, regval); -// OBSOLETE release_value (var->value); /* Unchain new value */ -// OBSOLETE -// OBSOLETE VALUE_LVAL (var->value) = lval_internalvar; -// OBSOLETE VALUE_INTERNALVAR (var->value) = var; -// OBSOLETE return var->value; -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_set_trapped_internalvar (struct internalvar *var, struct value *newval, -// OBSOLETE int bitpos, int bitsize, int offset) -// OBSOLETE { -// OBSOLETE char *page_regnum, *regnum; -// OBSOLETE char expression[100]; -// OBSOLETE unsigned new_regval; -// OBSOLETE struct type *type; -// OBSOLETE enum type_code newval_type_code; -// OBSOLETE -// OBSOLETE type = check_typedef (VALUE_TYPE (newval)); -// OBSOLETE newval_type_code = TYPE_CODE (type); -// OBSOLETE -// OBSOLETE if ((newval_type_code != TYPE_CODE_INT -// OBSOLETE && newval_type_code != TYPE_CODE_PTR) -// OBSOLETE || TYPE_LENGTH (type) != sizeof (new_regval)) -// OBSOLETE error ("Illegal type (%s) for assignment to $%s\n", -// OBSOLETE TYPE_NAME (VALUE_TYPE (newval)), var->name); -// OBSOLETE -// OBSOLETE new_regval = *(long *) VALUE_CONTENTS_RAW (newval); -// OBSOLETE -// OBSOLETE regnum = var->name + 1; -// OBSOLETE -// OBSOLETE switch (var->name[2]) -// OBSOLETE { -// OBSOLETE case 'c': -// OBSOLETE page_regnum = "cp"; -// OBSOLETE break; -// OBSOLETE case '0': -// OBSOLETE case '1': -// OBSOLETE case '2': -// OBSOLETE case '3': -// OBSOLETE page_regnum = "dp"; -// OBSOLETE break; -// OBSOLETE case '4': -// OBSOLETE case '5': -// OBSOLETE page_regnum = "ep"; -// OBSOLETE break; -// OBSOLETE case '6': -// OBSOLETE case '7': -// OBSOLETE page_regnum = "tp"; -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE sprintf (expression, "$%s=%d", page_regnum, new_regval >> 16); -// OBSOLETE parse_and_eval (expression); -// OBSOLETE -// OBSOLETE sprintf (expression, "$%s=%d", regnum, new_regval & 0xffff); -// OBSOLETE parse_and_eval (expression); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_sp (void) -// OBSOLETE { -// OBSOLETE return read_register (PR7_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_write_sp (CORE_ADDR v) -// OBSOLETE { -// OBSOLETE write_register (PR7_REGNUM, v); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_pc (ptid_t ptid) -// OBSOLETE { -// OBSOLETE return read_register (PC_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE h8500_write_pc (CORE_ADDR v, ptid_t ptid) -// OBSOLETE { -// OBSOLETE write_register (PC_REGNUM, v); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE h8500_read_fp (void) -// OBSOLETE { -// OBSOLETE return read_register (PR6_REGNUM); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_h8500_tdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = print_insn_h8500; -// OBSOLETE -// OBSOLETE add_prefix_cmd ("memory", no_class, set_memory, -// OBSOLETE "set the memory model", &setmemorylist, "set memory ", 0, -// OBSOLETE &setlist); -// OBSOLETE -// OBSOLETE add_cmd ("small", class_support, small_command, -// OBSOLETE "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("big", class_support, big_command, -// OBSOLETE "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("medium", class_support, medium_command, -// OBSOLETE "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE add_cmd ("compact", class_support, compact_command, -// OBSOLETE "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist); -// OBSOLETE -// OBSOLETE } diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 62271ff..f9757c9 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -171,9 +171,6 @@ _initialize_hppa_hpux_tdep (void) { gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_SOM, hppa_hpux_som_init_abi); - /* FIXME brobecker 2003-08-13: The machine number 25 corresponds to - the hppa2.0w bfd arch_info. A #define should probably be defined - in bfd, instead of using this hard-coded number. */ - gdbarch_register_osabi (bfd_arch_hppa, 25, GDB_OSABI_HPUX_ELF, + gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_HPUX_ELF, hppa_hpux_elf_init_abi); } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index cc1bb5e..7386e49 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1090,7 +1090,7 @@ hppa_frame_saved_pc (struct frame_info *frame) { CORE_ADDR *saved_regs; hppa_frame_init_saved_regs (get_next_frame (frame)); - saved_regs = get_frame_saved_regs (get_next_frame (frame)); + saved_regs = deprecated_get_frame_saved_regs (get_next_frame (frame)); if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { @@ -1130,7 +1130,7 @@ hppa_frame_saved_pc (struct frame_info *frame) { CORE_ADDR *saved_regs; hppa_frame_init_saved_regs (get_next_frame (frame)); - saved_regs = get_frame_saved_regs (get_next_frame (frame)); + saved_regs = deprecated_get_frame_saved_regs (get_next_frame (frame)); if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { @@ -1404,7 +1404,7 @@ hppa_frame_chain (struct frame_info *frame) in optimized code, GCC often doesn't actually save r3. We'll discover this if we look at the prologue. */ hppa_frame_init_saved_regs (tmp_frame); - saved_regs = get_frame_saved_regs (tmp_frame); + saved_regs = deprecated_get_frame_saved_regs (tmp_frame); saved_regs_frame = tmp_frame; /* If we have an address for r3, that's good. */ @@ -1455,7 +1455,7 @@ hppa_frame_chain (struct frame_info *frame) if (tmp_frame != saved_regs_frame) { hppa_frame_init_saved_regs (tmp_frame); - saved_regs = get_frame_saved_regs (tmp_frame); + saved_regs = deprecated_get_frame_saved_regs (tmp_frame); } /* Abominable hack. */ @@ -1493,7 +1493,7 @@ hppa_frame_chain (struct frame_info *frame) if (tmp_frame != saved_regs_frame) { hppa_frame_init_saved_regs (tmp_frame); - saved_regs = get_frame_saved_regs (tmp_frame); + saved_regs = deprecated_get_frame_saved_regs (tmp_frame); } /* Abominable hack. See above. */ @@ -1698,7 +1698,7 @@ hppa_pop_frame (void) fp = get_frame_base (frame); hppa_frame_init_saved_regs (frame); - fsr = get_frame_saved_regs (frame); + fsr = deprecated_get_frame_saved_regs (frame); #ifndef NO_PC_SPACE_QUEUE_RESTORE if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */ @@ -2067,6 +2067,9 @@ hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp, This function does the same stuff as value_being_returned in values.c, but gets the value from the stack rather than from the buffer where all the registers were saved when the function called completed. */ +/* FIXME: cagney/2003-09-27: This function is no longer needed. The + inferior function call code now directly handles the case described + above. */ struct value * hppa_value_returned_from_stack (struct type *valtype, CORE_ADDR addr) { @@ -2372,7 +2375,7 @@ hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, { stub_symbol = lookup_minimal_symbol_solib_trampoline - (SYMBOL_LINKAGE_NAME (funsymbol), NULL, objfile); + (SYMBOL_LINKAGE_NAME (funsymbol), objfile); if (!stub_symbol) stub_symbol = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (funsymbol), @@ -2979,13 +2982,13 @@ pa_print_fp_reg (int i) frame_register_read (deprecated_selected_frame, i, raw_buffer); /* Put it in the buffer. No conversions are ever necessary. */ - memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i)); + memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i)); fputs_filtered (REGISTER_NAME (i), gdb_stdout); print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout); fputs_filtered ("(single precision) ", gdb_stdout); - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0, + val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); printf_filtered ("\n"); @@ -2997,8 +3000,8 @@ pa_print_fp_reg (int i) frame_register_read (deprecated_selected_frame, i + 1, raw_buffer); /* Copy it into the appropriate part of the virtual buffer. */ - memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buffer, - REGISTER_RAW_SIZE (i)); + memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buffer, + DEPRECATED_REGISTER_RAW_SIZE (i)); /* Dump it as a double. */ fputs_filtered (REGISTER_NAME (i), gdb_stdout); @@ -3025,7 +3028,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) frame_register_read (deprecated_selected_frame, i, raw_buffer); /* Put it in the buffer. No conversions are ever necessary. */ - memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i)); + memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i)); if (precision == double_precision && (i % 2) == 0) { @@ -3036,7 +3039,8 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) frame_register_read (deprecated_selected_frame, i + 1, raw_buf); /* Copy it into the appropriate part of the virtual buffer. */ - memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buf, REGISTER_RAW_SIZE (i)); + memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buf, + DEPRECATED_REGISTER_RAW_SIZE (i)); val_print (builtin_type_double, virtual_buffer, 0, 0, stream, 0, 1, 0, Val_pretty_default); @@ -3044,7 +3048,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) } else { - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, stream, 0, + val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, stream, 0, 1, 0, Val_pretty_default); } @@ -3090,8 +3094,9 @@ hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name) sec = SYMBOL_BFD_SECTION (minsym); - if (sec->vma <= pc - && sec->vma + sec->_cooked_size < pc) + if (bfd_get_section_vma (sec->owner, sec) <= pc + && pc < (bfd_get_section_vma (sec->owner, sec) + + bfd_section_size (sec->owner, sec))) return 0; /* We might be in a stub. Peek at the instructions. Stubs are 3 @@ -4247,9 +4252,9 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, void hppa_frame_init_saved_regs (struct frame_info *frame) { - if (get_frame_saved_regs (frame) == NULL) + if (deprecated_get_frame_saved_regs (frame) == NULL) frame_saved_regs_zalloc (frame); - hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame)); + hppa_frame_find_saved_regs (frame, deprecated_get_frame_saved_regs (frame)); } /* Exception handling support for the HP-UX ANSI C++ compiler. @@ -5037,6 +5042,10 @@ hppa_extract_struct_value_address (char *regbuf) the address size is equal to the size of an int* _on the host_... One possible implementation that crossed my mind is to use extract_address. */ + /* FIXME: cagney/2003-09-27: This function can probably go. ELZ + writes: We cannot assume on the pa that r28 still contains the + address of the returned structure. Usually this will be + overwritten by the callee. */ return (*(int *)(regbuf + DEPRECATED_REGISTER_BYTE (28))); } @@ -5072,7 +5081,7 @@ hppa_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, R0_REGNUM + 26 - argi, &addr); + get_frame_register (frame, R0_REGNUM + 26 - argi, &addr); return addr; } diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c index cbb481e..416db66 100644 --- a/gdb/hppab-nat.c +++ b/gdb/hppab-nat.c @@ -64,7 +64,7 @@ fetch_register (int regno) offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) { errno = 0; *(int *) &buf[i] = ptrace (PT_RUREGS, PIDGET (inferior_ptid), @@ -130,7 +130,7 @@ store_inferior_registers (int regno) } } else - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) { errno = 0; ptrace (PT_WUREGS, PIDGET (inferior_ptid), diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index 5359949..ea4015a 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -34,14 +34,34 @@ #include "gdb_string.h" #include <signal.h> -extern CORE_ADDR text_end; - extern int hpux_has_forked (int pid, int *childpid); extern int hpux_has_vforked (int pid, int *childpid); extern int hpux_has_execd (int pid, char **execd_pathname); extern int hpux_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id); +static CORE_ADDR text_end; + +void +deprecated_hpux_text_end (struct target_ops *exec_ops) +{ + struct section_table *p; + + /* Set text_end to the highest address of the end of any readonly + code section. */ + /* FIXME: The comment above does not match the code. The code + checks for sections with are either code *or* readonly. */ + text_end = (CORE_ADDR) 0; + for (p = exec_ops->to_sections; p < exec_ops->to_sections_end; p++) + if (bfd_get_section_flags (p->bfd, p->the_bfd_section) + & (SEC_CODE | SEC_READONLY)) + { + if (text_end < p->endaddr) + text_end = p->endaddr; + } +} + + static void fetch_register (int); void @@ -78,7 +98,7 @@ store_inferior_registers (int regno) return; offset = 0; - len = REGISTER_RAW_SIZE (regno); + len = DEPRECATED_REGISTER_RAW_SIZE (regno); /* Requests for register zero actually want the save_state's ss_flags member. As RM says: "Oh, what a hack!" */ @@ -89,10 +109,11 @@ store_inferior_registers (int regno) len = sizeof (ss.ss_flags); /* Note that ss_flags is always an int, no matter what - REGISTER_RAW_SIZE(0) says. Assuming all HP-UX PA machines - are big-endian, put it at the least significant end of the - value, and zap the rest of the buffer. */ - offset = REGISTER_RAW_SIZE (0) - len; + DEPRECATED_REGISTER_RAW_SIZE(0) says. Assuming all HP-UX + PA machines are big-endian, put it at the least + significant end of the value, and zap the rest of the + buffer. */ + offset = DEPRECATED_REGISTER_RAW_SIZE (0) - len; } /* Floating-point registers come from the ss_fpblock area. */ @@ -195,7 +216,7 @@ fetch_register (int regno) int i; offset = 0; - len = REGISTER_RAW_SIZE (regno); + len = DEPRECATED_REGISTER_RAW_SIZE (regno); /* Requests for register zero actually want the save_state's ss_flags member. As RM says: "Oh, what a hack!" */ @@ -206,10 +227,10 @@ fetch_register (int regno) len = sizeof (ss.ss_flags); /* Note that ss_flags is always an int, no matter what - REGISTER_RAW_SIZE(0) says. Assuming all HP-UX PA machines - are big-endian, put it at the least significant end of the - value, and zap the rest of the buffer. */ - offset = REGISTER_RAW_SIZE (0) - len; + DEPRECATED_REGISTER_RAW_SIZE(0) says. Assuming all HP-UX PA + machines are big-endian, put it at the least significant end + of the value, and zap the rest of the buffer. */ + offset = DEPRECATED_REGISTER_RAW_SIZE (0) - len; memset (buf, 0, sizeof (buf)); } diff --git a/gdb/hppam3-nat.c b/gdb/hppam3-nat.c index a89fae9..cbee288 100644 --- a/gdb/hppam3-nat.c +++ b/gdb/hppam3-nat.c @@ -116,13 +116,13 @@ store_inferior_registers (int regno) if (regno > 0 && regno < NUM_REGS) { memcpy (&state[regno], &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); } else { for (index = 0; index < NUM_REGS; index++) memcpy (&state[index], &deprecated_registers[DEPRECATED_REGISTER_BYTE (index)], - REGISTER_RAW_SIZE (index)); + DEPRECATED_REGISTER_RAW_SIZE (index)); /* state[index] = deprecated_registers[DEPRECATED_REGISTER_BYTE (index)]; */ } diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index d66874b..242d3a3 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -131,7 +131,6 @@ find_tcb (ptid_t ptid) /* Most target vector functions from here on actually just pass through to inftarg.c, as they don't need to do anything specific for threads. */ -/* ARGSUSED */ static void hpux_thread_open (char *arg, int from_tty) { @@ -292,13 +291,13 @@ hpux_thread_fetch_registers (int regno) if (regno == FLAGS_REGNUM) /* Flags must be 0 to avoid bogus value for SS_INSYSCALL */ - memset (buf, '\000', REGISTER_RAW_SIZE (regno)); + memset (buf, '\000', DEPRECATED_REGISTER_RAW_SIZE (regno)); else if (regno == SP_REGNUM) store_unsigned_integer (buf, sizeof sp, sp); else if (regno == PC_REGNUM) - read_memory (sp - 20, buf, REGISTER_RAW_SIZE (regno)); + read_memory (sp - 20, buf, DEPRECATED_REGISTER_RAW_SIZE (regno)); else - read_memory (sp + regmap[regno], buf, REGISTER_RAW_SIZE (regno)); + read_memory (sp + regmap[regno], buf, DEPRECATED_REGISTER_RAW_SIZE (regno)); supply_register (regno, buf); } @@ -358,19 +357,19 @@ hpux_thread_store_registers (int regno) { write_memory ((CORE_ADDR) & tcb_ptr->static_ctx.sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); tcb_ptr->static_ctx.sp = (cma__t_hppa_regs *) (extract_unsigned_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)) + 160); + DEPRECATED_REGISTER_RAW_SIZE (regno)) + 160); } else if (regno == PC_REGNUM) write_memory (sp - 20, &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); else write_memory (sp + regmap[regno], &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); } } diff --git a/gdb/i386-interix-nat.c b/gdb/i386-interix-nat.c index 10e4d91..91b9be2 100644 --- a/gdb/i386-interix-nat.c +++ b/gdb/i386-interix-nat.c @@ -80,7 +80,7 @@ fill_gregset (gregset_t *gregsetp, int regno) void supply_fpregset (fpregset_t *fpregsetp) { - i387_supply_fsave ((const char *) fpregsetp, -1); + i387_supply_fsave (current_regcache, -1, fpregsetp); } /* Given a pointer to a floating point register set in (fpregset_t *) diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c index 6902404..ea9f8c4 100644 --- a/gdb/i386-interix-tdep.c +++ b/gdb/i386-interix-tdep.c @@ -332,7 +332,6 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_skip_trampoline_code (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_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 e7a85fa..bb16143 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for GNU/Linux x86. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -320,7 +320,7 @@ static void store_regs (int tid, int regno) {} void supply_fpregset (elf_fpregset_t *fpregsetp) { - i387_supply_fsave ((const char *) fpregsetp, -1); + i387_supply_fsave (current_regcache, -1, fpregsetp); dummy_sse_values (); } @@ -385,7 +385,7 @@ static void store_fpregs (int tid, int regno) {} void supply_fpxregset (elf_fpxregset_t *fpxregsetp) { - i387_supply_fxsave ((const char *) fpxregsetp, -1); + i387_supply_fxsave (current_regcache, -1, fpxregsetp); } /* Fill register REGNO (if it is a floating-point or SSE register) in @@ -756,80 +756,6 @@ ps_get_thread_area (const struct ps_prochandle *ph, } -/* Interpreting register set info found in core files. */ - -/* Provide registers to GDB from a core file. - - (We can't use the generic version of this function in - core-regset.c, because GNU/Linux has *three* different kinds of - register set notes. core-regset.c would have to call - supply_fpxregset, which most platforms don't have.) - - CORE_REG_SECT points to an array of bytes, which are the contents - of a `note' from a core file which BFD thinks might contain - register contents. CORE_REG_SIZE is its size. - - WHICH says which register set corelow suspects this is: - 0 --- the general-purpose register set, in elf_gregset_t format - 2 --- the floating-point register set, in elf_fpregset_t format - 3 --- the extended floating-point register set, in elf_fpxregset_t format - - REG_ADDR isn't used on GNU/Linux. */ - -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, - int which, CORE_ADDR reg_addr) -{ - elf_gregset_t gregset; - elf_fpregset_t fpregset; - - switch (which) - { - case 0: - if (core_reg_size != sizeof (gregset)) - warning ("Wrong size gregset in core file."); - else - { - memcpy (&gregset, core_reg_sect, sizeof (gregset)); - supply_gregset (&gregset); - } - break; - - case 2: - if (core_reg_size != sizeof (fpregset)) - warning ("Wrong size fpregset in core file."); - else - { - memcpy (&fpregset, core_reg_sect, sizeof (fpregset)); - supply_fpregset (&fpregset); - } - break; - -#ifdef HAVE_PTRACE_GETFPXREGS - { - elf_fpxregset_t fpxregset; - - case 3: - if (core_reg_size != sizeof (fpxregset)) - warning ("Wrong size fpxregset in core file."); - else - { - memcpy (&fpxregset, core_reg_sect, sizeof (fpxregset)); - supply_fpxregset (&fpxregset); - } - break; - } -#endif - - default: - /* We've covered all the kinds of registers we know about here, - so this must be something we wouldn't know what to do with - anyway. Just ignore it. */ - break; - } -} - - /* The instruction for a GNU/Linux system call is: int $0x80 or 0xcd 0x80. */ @@ -923,22 +849,3 @@ child_post_startup_inferior (ptid_t ptid) i386_cleanup_dregs (); linux_child_post_startup_inferior (ptid); } - - -/* Register that we are able to handle GNU/Linux ELF core file - formats. */ - -static struct core_fns linux_elf_core_fns = -{ - bfd_target_elf_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - -void -_initialize_i386_linux_nat (void) -{ - add_core_fns (&linux_elf_core_fns); -} diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 6d284f1..48caf4d 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -25,19 +25,15 @@ #include "value.h" #include "regcache.h" #include "inferior.h" +#include "osabi.h" #include "reggroups.h" +#include "solib-svr4.h" -/* For i386_linux_skip_solib_resolver. */ -#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" - -#include "solib-svr4.h" /* For struct link_map_offsets. */ - -#include "osabi.h" +#include "gdb_string.h" #include "i386-tdep.h" #include "i386-linux-tdep.h" +#include "glibc-tdep.h" /* Return the name of register REG. */ @@ -312,89 +308,10 @@ i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid) /* Calling functions in shared libraries. */ -/* Find the minimal symbol named NAME, and return both the minsym - struct and its objfile. This probably ought to be in minsym.c, but - everything there is trying to deal with things like C++ and - SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may - be considered too special-purpose for general consumption. */ - -static struct minimal_symbol * -find_minsym_and_objfile (char *name, struct objfile **objfilep) -{ - struct objfile *objfile; - - ALL_OBJFILES (objfile) - { - struct minimal_symbol *msym; - - ALL_OBJFILE_MSYMBOLS (objfile, msym) - { - if (SYMBOL_LINKAGE_NAME (msym) - && strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0) - { - *objfilep = objfile; - return msym; - } - } - } - - return 0; -} - -static CORE_ADDR -skip_gnu_resolver (CORE_ADDR pc) -{ - /* The GNU dynamic linker is part of the GNU C library, so many - GNU/Linux distributions use it. (All ELF versions, as far as I - know.) An unresolved PLT entry points to "_dl_runtime_resolve", - which calls "fixup" to patch the PLT, and then passes control to - the function. - - We look for the symbol `_dl_runtime_resolve', and find `fixup' in - the same objfile. If we are at the entry point of `fixup', then - we set a breakpoint at the return address (at the top of the - stack), and continue. - - It's kind of gross to do all these checks every time we're - called, since they don't change once the executable has gotten - started. But this is only a temporary hack --- upcoming versions - of GNU/Linux will provide a portable, efficient interface for - debugging programs that use shared libraries. */ - - struct objfile *objfile; - struct minimal_symbol *resolver - = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile); - - if (resolver) - { - struct minimal_symbol *fixup - = lookup_minimal_symbol ("fixup", NULL, objfile); - - if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) - return frame_pc_unwind (get_current_frame ()); - } - - return 0; -} - -/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c. - This function: - 1) decides whether a PLT has sent us into the linker to resolve - a function reference, and - 2) if so, tells us where to set a temporary breakpoint that will - trigger when the dynamic linker is done. */ - CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc) { - CORE_ADDR result; - - /* Plug in functions for other kinds of resolvers here. */ - result = skip_gnu_resolver (pc); - if (result) - return result; - - return 0; + return glibc_skip_solib_resolver (pc); } /* Fetch (and possibly build) an appropriate link_map_offsets @@ -439,8 +356,52 @@ i386_linux_svr4_fetch_link_map_offsets (void) } +/* The register sets used in GNU/Linux ELF core-dumps are identical to + the register sets in `struct user' that are used for a.out + core-dumps. These are also used by ptrace(2). The corresponding + types are `elf_gregset_t' for the general-purpose registers (with + `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' + for the floating-point registers. + + Those types used to be available under the names `gregset_t' and + `fpregset_t' too, and GDB used those names in the past. But those + names are now used for the register sets used in the `mcontext_t' + type, which have a different size and layout. */ + +/* Mapping between the general-purpose registers in `struct user' + format and GDB's register cache layout. */ + +/* From <sys/reg.h>. */ +static int i386_linux_gregset_reg_offset[] = +{ + 6 * 4, /* %eax */ + 1 * 4, /* %ecx */ + 2 * 4, /* %edx */ + 0 * 4, /* %ebx */ + 15 * 4, /* %esp */ + 5 * 4, /* %ebp */ + 3 * 4, /* %esi */ + 4 * 4, /* %edi */ + 12 * 4, /* %eip */ + 14 * 4, /* %eflags */ + 13 * 4, /* %cs */ + 16 * 4, /* %ss */ + 7 * 4, /* %ds */ + 8 * 4, /* %es */ + 9 * 4, /* %fs */ + 10 * 4, /* %gs */ + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, + 11 * 4 /* "orig_eax" */ +}; + +/* Mapping between the general-purpose registers in `struct + sigcontext' format and GDB's register cache layout. */ + /* From <asm/sigcontext.h>. */ -static int i386_linux_sc_reg_offset[I386_NUM_GREGS] = +static int i386_linux_sc_reg_offset[] = { 11 * 4, /* %eax */ 10 * 4, /* %ecx */ @@ -468,23 +429,23 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* GNU/Linux uses ELF. */ i386_elf_init_abi (info, gdbarch); - /* We support the SSE registers on GNU/Linux. */ - tdep->num_xmm_regs = I386_NUM_XREGS - 1; - /* set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); */ - /* Since we have the extra "orig_eax" register on GNU/Linux, we have to adjust a few things. */ set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); - set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1); + set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS); set_gdbarch_register_name (gdbarch, i386_linux_register_name); set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p); + tdep->gregset_reg_offset = i386_linux_gregset_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset); + tdep->sizeof_gregset = 17 * 4; + tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */ tdep->sigcontext_addr = i386_linux_sigcontext_addr; tdep->sc_reg_offset = i386_linux_sc_reg_offset; - tdep->sc_num_regs = I386_NUM_GREGS; + tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); /* When the i386 Linux kernel calls a signal handler, the return address points to a bit of code on the stack. This function is diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c index 2a912a1..a80c7a4 100644 --- a/gdb/i386-nto-tdep.c +++ b/gdb/i386-nto-tdep.c @@ -87,9 +87,9 @@ static void i386nto_supply_fpregset (char *fpregs) { if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR) - i387_supply_fxsave (fpregs, -1); + i387_supply_fxsave (current_regcache, -1, fpregs); else - i387_supply_fsave (fpregs, -1); + i387_supply_fsave (current_regcache, -1, fpregs); } static void diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index dd19e24..69db1fa 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -37,6 +37,7 @@ #include "osabi.h" #include "regcache.h" #include "reggroups.h" +#include "regset.h" #include "symfile.h" #include "symtab.h" #include "target.h" @@ -67,8 +68,7 @@ static char *i386_register_names[] = "mxcsr" }; -static const int i386_num_register_names = - (sizeof (i386_register_names) / sizeof (*i386_register_names)); +static const int i386_num_register_names = ARRAY_SIZE (i386_register_names); /* MMX registers. */ @@ -78,48 +78,77 @@ static char *i386_mmx_names[] = "mm4", "mm5", "mm6", "mm7" }; -static const int i386_num_mmx_regs = - (sizeof (i386_mmx_names) / sizeof (i386_mmx_names[0])); - -#define MM0_REGNUM NUM_REGS +static const int i386_num_mmx_regs = ARRAY_SIZE (i386_mmx_names); static int -i386_mmx_regnum_p (int regnum) +i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum) { - return (regnum >= MM0_REGNUM - && regnum < MM0_REGNUM + i386_num_mmx_regs); + int mm0_regnum = gdbarch_tdep (gdbarch)->mm0_regnum; + + if (mm0_regnum < 0) + return 0; + + return (regnum >= mm0_regnum && regnum < mm0_regnum + i386_num_mmx_regs); } -/* FP register? */ +/* SSE register? */ -int -i386_fp_regnum_p (int regnum) +static int +i386_sse_regnum_p (struct gdbarch *gdbarch, int regnum) { - return (regnum < NUM_REGS - && (FP0_REGNUM && FP0_REGNUM <= regnum && regnum < FPC_REGNUM)); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + +#define I387_ST0_REGNUM tdep->st0_regnum +#define I387_NUM_XMM_REGS tdep->num_xmm_regs + + if (I387_NUM_XMM_REGS == 0) + return 0; + + return (I387_XMM0_REGNUM <= regnum && regnum < I387_MXCSR_REGNUM); + +#undef I387_ST0_REGNUM +#undef I387_NUM_XMM_REGS } -int -i386_fpc_regnum_p (int regnum) +static int +i386_mxcsr_regnum_p (struct gdbarch *gdbarch, int regnum) { - return (regnum < NUM_REGS - && (FPC_REGNUM <= regnum && regnum < XMM0_REGNUM)); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + +#define I387_ST0_REGNUM tdep->st0_regnum +#define I387_NUM_XMM_REGS tdep->num_xmm_regs + + if (I387_NUM_XMM_REGS == 0) + return 0; + + return (regnum == I387_MXCSR_REGNUM); + +#undef I387_ST0_REGNUM +#undef I387_NUM_XMM_REGS } -/* SSE register? */ +#define I387_ST0_REGNUM (gdbarch_tdep (current_gdbarch)->st0_regnum) +#define I387_MM0_REGNUM (gdbarch_tdep (current_gdbarch)->mm0_regnum) +#define I387_NUM_XMM_REGS (gdbarch_tdep (current_gdbarch)->num_xmm_regs) + +/* FP register? */ int -i386_sse_regnum_p (int regnum) +i386_fp_regnum_p (int regnum) { - return (regnum < NUM_REGS - && (XMM0_REGNUM <= regnum && regnum < MXCSR_REGNUM)); + if (I387_ST0_REGNUM < 0) + return 0; + + return (I387_ST0_REGNUM <= regnum && regnum < I387_FCTRL_REGNUM); } int -i386_mxcsr_regnum_p (int regnum) +i386_fpc_regnum_p (int regnum) { - return (regnum < NUM_REGS - && regnum == MXCSR_REGNUM); + if (I387_ST0_REGNUM < 0) + return 0; + + return (I387_FCTRL_REGNUM <= regnum && regnum < I387_XMM0_REGNUM); } /* Return the name of register REG. */ @@ -127,8 +156,8 @@ i386_mxcsr_regnum_p (int regnum) const char * i386_register_name (int reg) { - if (i386_mmx_regnum_p (reg)) - return i386_mmx_names[reg - MM0_REGNUM]; + if (i386_mmx_regnum_p (current_gdbarch, reg)) + return i386_mmx_names[reg - I387_MM0_REGNUM]; if (reg >= 0 && reg < i386_num_register_names) return i386_register_names[reg]; @@ -151,17 +180,17 @@ i386_stab_reg_to_regnum (int reg) else if (reg >= 12 && reg <= 19) { /* Floating-point registers. */ - return reg - 12 + FP0_REGNUM; + return reg - 12 + I387_ST0_REGNUM; } else if (reg >= 21 && reg <= 28) { /* SSE registers. */ - return reg - 21 + XMM0_REGNUM; + return reg - 21 + I387_XMM0_REGNUM; } else if (reg >= 29 && reg <= 36) { /* MMX registers. */ - return reg - 29 + MM0_REGNUM; + return reg - 29 + I387_MM0_REGNUM; } /* This will hopefully provoke a warning. */ @@ -184,7 +213,7 @@ i386_dwarf_reg_to_regnum (int reg) else if (reg >= 11 && reg <= 18) { /* Floating-point registers. */ - return reg - 11 + FP0_REGNUM; + return reg - 11 + I387_ST0_REGNUM; } else if (reg >= 21) { @@ -195,6 +224,10 @@ i386_dwarf_reg_to_regnum (int reg) /* This will hopefully provoke a warning. */ return NUM_REGS + NUM_PSEUDO_REGS; } + +#undef I387_ST0_REGNUM +#undef I387_MM0_REGNUM +#undef I387_NUM_XMM_REGS /* This is the variable that is set with "set disassembly-flavor", and @@ -466,12 +499,14 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc, xorl %ebx, %ebx xorl %ecx, %ecx xorl %edx, %edx + xorl %eax, %eax and the equivalent subl %ebx, %ebx subl %ecx, %ecx subl %edx, %edx + subl %eax, %eax Make sure we only skip these instructions if we later see the `movl %esp, %ebp' that actually sets up the frame. */ @@ -483,6 +518,7 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc, case 0xdb: /* %ebx */ case 0xc9: /* %ecx */ case 0xd2: /* %edx */ + case 0xc0: /* %eax */ skip += 2; break; default: @@ -1123,6 +1159,7 @@ static void i386_extract_return_value (struct type *type, struct regcache *regcache, void *dst) { + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); bfd_byte *valbuf = dst; int len = TYPE_LENGTH (type); char buf[I386_MAX_REGISTER_SIZE]; @@ -1136,7 +1173,7 @@ i386_extract_return_value (struct type *type, struct regcache *regcache, if (TYPE_CODE (type) == TYPE_CODE_FLT) { - if (FP0_REGNUM < 0) + if (tdep->st0_regnum < 0) { warning ("Cannot find floating-point return value."); memset (valbuf, 0, len); @@ -1180,8 +1217,13 @@ static void i386_store_return_value (struct type *type, struct regcache *regcache, const void *valbuf) { + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); int len = TYPE_LENGTH (type); + /* Define I387_ST0_REGNUM such that we use the proper definitions + for the architecture. */ +#define I387_ST0_REGNUM I386_ST0_REGNUM + if (TYPE_CODE (type) == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { @@ -1192,9 +1234,9 @@ i386_store_return_value (struct type *type, struct regcache *regcache, if (TYPE_CODE (type) == TYPE_CODE_FLT) { ULONGEST fstat; - char buf[FPU_REG_RAW_SIZE]; + char buf[I386_MAX_REGISTER_SIZE]; - if (FP0_REGNUM < 0) + if (tdep->st0_regnum < 0) { warning ("Cannot set floating-point return value."); return; @@ -1215,14 +1257,14 @@ i386_store_return_value (struct type *type, struct regcache *regcache, actual value doesn't really matter, but 7 is what a normal function return would end up with if the program started out with a freshly initialized FPU. */ - regcache_raw_read_unsigned (regcache, FSTAT_REGNUM, &fstat); + regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM, &fstat); fstat |= (7 << 11); - regcache_raw_write_unsigned (regcache, FSTAT_REGNUM, fstat); + regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM, fstat); /* Mark %st(1) through %st(7) as empty. Since we set the top of the floating-point register stack to 7, the appropriate value for the tag word is 0x3fff. */ - regcache_raw_write_unsigned (regcache, FTAG_REGNUM, 0x3fff); + regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM, 0x3fff); } else { @@ -1241,6 +1283,8 @@ i386_store_return_value (struct type *type, struct regcache *regcache, internal_error (__FILE__, __LINE__, "Cannot store return value of %d bytes long.", len); } + +#undef I387_ST0_REGNUM } /* Extract from REGCACHE, which contains the (raw) register state, the @@ -1302,10 +1346,10 @@ i386_register_type (struct gdbarch *gdbarch, int regnum) if (i386_fp_regnum_p (regnum)) return builtin_type_i387_ext; - if (i386_sse_regnum_p (regnum)) + if (i386_sse_regnum_p (gdbarch, regnum)) return builtin_type_vec128i; - if (i386_mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (gdbarch, regnum)) return builtin_type_vec64i; return builtin_type_int; @@ -1317,24 +1361,30 @@ i386_register_type (struct gdbarch *gdbarch, int regnum) static int i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum) { - int mmxi; + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + int mmxreg, fpreg; ULONGEST fstat; int tos; - int fpi; - mmxi = regnum - MM0_REGNUM; - regcache_raw_read_unsigned (regcache, FSTAT_REGNUM, &fstat); + /* Define I387_ST0_REGNUM such that we use the proper definitions + for REGCACHE's architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + mmxreg = regnum - tdep->mm0_regnum; + regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM, &fstat); tos = (fstat >> 11) & 0x7; - fpi = (mmxi + tos) % 8; + fpreg = (mmxreg + tos) % 8; - return (FP0_REGNUM + fpi); + return (I387_ST0_REGNUM + fpreg); + +#undef I387_ST0_REGNUM } static void i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, void *buf) { - if (i386_mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (gdbarch, regnum)) { char mmx_buf[MAX_REGISTER_SIZE]; int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1351,7 +1401,7 @@ static void i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const void *buf) { - if (i386_mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (gdbarch, regnum)) { char mmx_buf[MAX_REGISTER_SIZE]; int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1368,14 +1418,6 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } -/* These registers don't have pervasive standard uses. Move them to - i386-tdep.h if necessary. */ - -#define I386_EBX_REGNUM 3 /* %ebx */ -#define I386_ECX_REGNUM 1 /* %ecx */ -#define I386_ESI_REGNUM 6 /* %esi */ -#define I386_EDI_REGNUM 7 /* %edi */ - /* Return the register number of the register allocated by GCC after REGNUM, or -1 if there is no such register. */ @@ -1502,7 +1544,84 @@ i386_value_to_register (struct frame_info *frame, int regnum, } } +/* Supply register REGNUM from the general-purpose register set REGSET + to register cache REGCACHE. If REGNUM is -1, do this for all + registers in REGSET. */ + +static void +i386_supply_gregset (const struct regset *regset, struct regcache *regcache, + int regnum, const void *gregs, size_t len) +{ + const struct gdbarch_tdep *tdep = regset->descr; + const char *regs = gregs; + int i; + + gdb_assert (len == tdep->sizeof_gregset); + + for (i = 0; i < tdep->gregset_num_regs; i++) + { + if ((regnum == i || regnum == -1) + && tdep->gregset_reg_offset[i] != -1) + regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]); + } +} + +/* Supply register REGNUM from the floating-point register set REGSET + to register cache REGCACHE. If REGNUM is -1, do this for all + registers in REGSET. */ + +static void +i386_supply_fpregset (const struct regset *regset, struct regcache *regcache, + int regnum, const void *fpregs, size_t len) +{ + const struct gdbarch_tdep *tdep = regset->descr; + + if (len == I387_SIZEOF_FXSAVE) + { + i387_supply_fxsave (regcache, regnum, fpregs); + return; + } + + gdb_assert (len == tdep->sizeof_fpregset); + i387_supply_fsave (regcache, regnum, fpregs); +} + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +const struct regset * +i386_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, size_t sect_size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) + { + if (tdep->gregset == NULL) + { + tdep->gregset = XMALLOC (struct regset); + tdep->gregset->descr = tdep; + tdep->gregset->supply_regset = i386_supply_gregset; + } + return tdep->gregset; + } + + if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset) + || (strcmp (sect_name, ".reg-xfp") == 0 + && sect_size == I387_SIZEOF_FXSAVE)) + { + if (tdep->fpregset == NULL) + { + tdep->fpregset = XMALLOC (struct regset); + tdep->fpregset->descr = tdep; + tdep->fpregset->supply_regset = i386_supply_fpregset; + } + return tdep->fpregset; + } + + return NULL; +} + #ifdef STATIC_TRANSFORM_NAME /* SunPRO encodes the static variables. This is not related to C++ @@ -1710,11 +1829,11 @@ int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) { - int sse_regnum_p = (i386_sse_regnum_p (regnum) - || i386_mxcsr_regnum_p (regnum)); + int sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum) + || i386_mxcsr_regnum_p (gdbarch, regnum)); int fp_regnum_p = (i386_fp_regnum_p (regnum) || i386_fpc_regnum_p (regnum)); - int mmx_regnum_p = (i386_mmx_regnum_p (regnum)); + int mmx_regnum_p = (i386_mmx_regnum_p (gdbarch, regnum)); if (group == i386_mmx_reggroup) return mmx_regnum_p; @@ -1757,22 +1876,38 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); - /* The i386 default settings now include the SSE registers. - I386_NUM_XREGS includes mxcsr, and we don't want to count - this as one of the xmm regs -- which is why we subtract one. - - Note: kevinb/2003-07-14: Whatever Mark's concerns are about the - FPU registers in the FIXME below apply to the SSE registers as well. - The only problem that I see is that these registers will show up - in "info all-registers" even on CPUs where they don't exist. IMO, - however, if it's a choice between printing them always (even when - they don't exist) or never showing them to the user (even when they - do exist), I prefer the former over the latter. Ideally, of course, - we'd somehow autodetect that we have them (or not) and display them - when we have them and suppress them when we don't. - - FIXME: kettenis/20020614: They do include the FPU registers for - now, which probably is not quite right. */ + /* General-purpose registers. */ + tdep->gregset = NULL; + tdep->gregset_reg_offset = NULL; + tdep->gregset_num_regs = I386_NUM_GREGS; + tdep->sizeof_gregset = 0; + + /* Floating-point registers. */ + tdep->fpregset = NULL; + tdep->sizeof_fpregset = I387_SIZEOF_FSAVE; + + /* The default settings include the FPU registers, the MMX registers + and the SSE registers. This can be overidden for a specific ABI + by adjusting the members `st0_regnum', `mm0_regnum' and + `num_xmm_regs' of `struct gdbarch_tdep', otherwise the registers + will show up in the output of "info all-registers". Ideally we + should try to autodetect whether they are available, such that we + can prevent "info all-registers" from displaying registers that + aren't available. + + NOTE: kevinb/2003-07-13: ... if it's a choice between printing + [the SSE registers] always (even when they don't exist) or never + showing them to the user (even when they do exist), I prefer the + former over the latter. */ + + tdep->st0_regnum = I386_ST0_REGNUM; + + /* The MMX registers are implemented as pseudo-registers. Put off + caclulating the register number for %mm0 until we know the number + of raw registers. */ + tdep->mm0_regnum = 0; + + /* I386_NUM_XREGS includes %mxcsr, so substract one. */ tdep->num_xmm_regs = I386_NUM_XREGS - 1; tdep->jb_pc_offset = -1; @@ -1876,6 +2011,18 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_sniffer (gdbarch, i386_sigtramp_frame_sniffer); frame_unwind_append_sniffer (gdbarch, i386_frame_sniffer); + /* If we have a register mapping, enable the generic core file + support, unless it has already been enabled. */ + if (tdep->gregset_reg_offset + && !gdbarch_regset_from_core_section_p (gdbarch)) + set_gdbarch_regset_from_core_section (gdbarch, + i386_regset_from_core_section); + + /* Unless support for MMX has been disabled, make %mm0 the first + pseudo-register. */ + if (tdep->mm0_regnum == 0) + tdep->mm0_regnum = gdbarch_num_regs (gdbarch); + return gdbarch; } diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 7412b8e..2c48979 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -1,4 +1,5 @@ -/* Target-dependent code for GDB, the GNU debugger. +/* Target-dependent code for the i386. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. @@ -22,9 +23,10 @@ #ifndef I386_TDEP_H #define I386_TDEP_H -struct reggroup; -struct gdbarch; struct frame_info; +struct gdbarch; +struct reggroup; +struct regset; /* GDB's i386 target supports both the 32-bit Intel Architecture (IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses @@ -55,6 +57,25 @@ enum struct_return /* i386 architecture specific information. */ struct gdbarch_tdep { + /* General-purpose registers. */ + struct regset *gregset; + int *gregset_reg_offset; + int gregset_num_regs; + size_t sizeof_gregset; + + /* Floating-point registers. */ + struct regset *fpregset; + size_t sizeof_fpregset; + + /* Register number for %st(0). The register numbers for the other + registers follow from this one. Set this to -1 to indicate the + absence of an FPU. */ + int st0_regnum; + + /* Register number for %mm0. Set this to -1 to indicate the absence + of MMX support. */ + int mm0_regnum; + /* Number of SSE registers. */ int num_xmm_regs; @@ -83,8 +104,6 @@ struct gdbarch_tdep /* Floating-point registers. */ -#define FPU_REG_RAW_SIZE 10 - /* All FPU control regusters (except for FIOFF and FOOFF) are 16-bit (at most) in the FPU, but are zero-extended to 32 bits in GDB's register cache. */ @@ -131,26 +150,22 @@ extern int i386_fpc_regnum_p (int regnum); #define MXCSR_REGNUM \ (XMM0_REGNUM + gdbarch_tdep (current_gdbarch)->num_xmm_regs) -/* Return non-zero if REGNUM matches the SSE register and the SSE - register set is active. */ -extern int i386_sse_regnum_p (int regnum); -extern int i386_mxcsr_regnum_p (int regnum); - -/* FIXME: kettenis/2001-11-24: Obsolete macro's. */ -#define FCS_REGNUM FISEG_REGNUM -#define FCOFF_REGNUM FIOFF_REGNUM -#define FDS_REGNUM FOSEG_REGNUM -#define FDOFF_REGNUM FOOFF_REGNUM - /* Register numbers of various important registers. */ -#define I386_EAX_REGNUM 0 /* %eax */ -#define I386_EDX_REGNUM 2 /* %edx */ -#define I386_ESP_REGNUM 4 /* %esp */ -#define I386_EBP_REGNUM 5 /* %ebp */ -#define I386_EIP_REGNUM 8 /* %eip */ -#define I386_EFLAGS_REGNUM 9 /* %eflags */ -#define I386_ST0_REGNUM 16 /* %st(0) */ +enum i386_regnum +{ + I386_EAX_REGNUM, /* %eax */ + I386_ECX_REGNUM, /* %ecx */ + I386_EDX_REGNUM, /* %edx */ + I386_EBX_REGNUM, /* %ebx */ + I386_ESP_REGNUM, /* %esp */ + I386_EBP_REGNUM, /* %ebp */ + I386_ESI_REGNUM, /* %esi */ + I386_EDI_REGNUM, /* %edi */ + I386_EIP_REGNUM, /* %eip */ + I386_EFLAGS_REGNUM, /* %eflags */ + I386_ST0_REGNUM = 16, /* %st(0) */ +}; #define I386_NUM_GREGS 16 #define I386_NUM_FREGS 16 @@ -173,6 +188,12 @@ extern char const *i386_register_name (int reg); extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group); +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ +extern const struct regset * + i386_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, size_t sect_size); + /* Initialize a basic ELF architecture variant. */ extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *); @@ -194,4 +215,3 @@ extern int i386obsd_sc_reg_offset[]; extern int i386bsd_sc_reg_offset[]; #endif /* i386-tdep.h */ - diff --git a/gdb/i386b-nat.c b/gdb/i386b-nat.c index 3c8a17c..7c2a7d8 100644 --- a/gdb/i386b-nat.c +++ b/gdb/i386b-nat.c @@ -23,7 +23,7 @@ #include <machine/reg.h> -/* this table must line up with REGISTER_NAMES in tm-i386.h */ +/* This table must line up with REGISTER_NAME in "i386-tdep.c". */ /* symbols like 'tEAX' come from <machine/reg.h> */ static int tregmap[] = { diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c index d81dc66..9383a1d 100644 --- a/gdb/i386bsd-nat.c +++ b/gdb/i386bsd-nat.c @@ -157,7 +157,7 @@ fill_gregset (gregset_t *gregsetp, int regno) void supply_fpregset (fpregset_t *fpregsetp) { - i387_supply_fsave ((const char *) fpregsetp, -1); + i387_supply_fsave (current_regcache, -1, fpregsetp); } /* Fill register REGNO (if it is a floating-point register) in @@ -200,7 +200,7 @@ fetch_inferior_registers (int regno) (PTRACE_ARG3_TYPE) xmmregs, 0) == 0) { have_ptrace_xmmregs = 1; - i387_supply_fxsave (xmmregs, -1); + i387_supply_fxsave (current_regcache, -1, xmmregs); } else { @@ -208,14 +208,14 @@ fetch_inferior_registers (int regno) (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name ("Couldn't get floating point status"); - i387_supply_fsave ((const char *) &fpregs, -1); + i387_supply_fsave (current_regcache, -1, &fpregs); } #else if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name ("Couldn't get floating point status"); - i387_supply_fsave ((const char *) &fpregs, -1); + i387_supply_fsave (current_regcache, -1, &fpregs); #endif } } diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c index 94d6860..80739cf 100644 --- a/gdb/i386bsd-tdep.c +++ b/gdb/i386bsd-tdep.c @@ -1,4 +1,5 @@ /* Target-dependent code for i386 BSD's. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -86,7 +87,7 @@ i386bsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) /* Traditional BSD (4.3 BSD, still used for BSDI and 386BSD). */ /* From <machine/signal.h>. */ -int i386bsd_sc_reg_offset[I386_NUM_GREGS] = +int i386bsd_sc_reg_offset[] = { -1, /* %eax */ -1, /* %ecx */ @@ -127,104 +128,7 @@ i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sigtramp_end = 0xfdbfe000; tdep->sigcontext_addr = i386bsd_sigcontext_addr; tdep->sc_reg_offset = i386bsd_sc_reg_offset; - tdep->sc_num_regs = I386_NUM_GREGS; -} - -/* FreeBSD 3.0-RELEASE or later. */ - -CORE_ADDR i386fbsd_sigtramp_start = 0xbfbfdf20; -CORE_ADDR i386fbsd_sigtramp_end = 0xbfbfdff0; - -/* From <machine/signal.h>. */ -int i386fbsd_sc_reg_offset[I386_NUM_GREGS] = -{ - 8 + 14 * 4, /* %eax */ - 8 + 13 * 4, /* %ecx */ - 8 + 12 * 4, /* %edx */ - 8 + 11 * 4, /* %ebx */ - 8 + 0 * 4, /* %esp */ - 8 + 1 * 4, /* %ebp */ - 8 + 10 * 4, /* %esi */ - 8 + 9 * 4, /* %edi */ - 8 + 3 * 4, /* %eip */ - 8 + 4 * 4, /* %eflags */ - 8 + 7 * 4, /* %cs */ - 8 + 8 * 4, /* %ss */ - 8 + 6 * 4, /* %ds */ - 8 + 5 * 4, /* %es */ - 8 + 15 * 4, /* %fs */ - 8 + 16 * 4 /* %gs */ -}; - -static void -i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - /* Obviously FreeBSD is BSD-based. */ - i386bsd_init_abi (info, gdbarch); - - /* FreeBSD uses -freg-struct-return by default. */ - tdep->struct_return = reg_struct_return; - - /* FreeBSD uses a different memory layout. */ - tdep->sigtramp_start = i386fbsd_sigtramp_start; - tdep->sigtramp_end = i386fbsd_sigtramp_end; - - /* FreeBSD has a more complete `struct sigcontext'. */ - tdep->sc_reg_offset = i386fbsd_sc_reg_offset; - tdep->sc_num_regs = I386_NUM_GREGS; -} - -static void -i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -{ - /* It's almost identical to FreeBSD a.out. */ - i386fbsdaout_init_abi (info, gdbarch); - - /* Except that it uses ELF. */ - i386_elf_init_abi (info, gdbarch); - - /* FreeBSD ELF uses SVR4-style shared libraries. */ - set_gdbarch_in_solib_call_trampoline (gdbarch, - generic_in_solib_call_trampoline); -} - -/* FreeBSD 4.0-RELEASE or later. */ - -/* From <machine/signal.h>. */ -int i386fbsd4_sc_reg_offset[I386_NUM_GREGS] = -{ - 20 + 11 * 4, /* %eax */ - 20 + 10 * 4, /* %ecx */ - 20 + 9 * 4, /* %edx */ - 20 + 8 * 4, /* %ebx */ - 20 + 17 * 4, /* %esp */ - 20 + 6 * 4, /* %ebp */ - 20 + 5 * 4, /* %esi */ - 20 + 4 * 4, /* %edi */ - 20 + 14 * 4, /* %eip */ - 20 + 16 * 4, /* %eflags */ - 20 + 15 * 4, /* %cs */ - 20 + 18 * 4, /* %ss */ - 20 + 3 * 4, /* %ds */ - 20 + 2 * 4, /* %es */ - 20 + 1 * 4, /* %fs */ - 20 + 0 * 4 /* %gs */ -}; - -static void -i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - /* Inherit stuff from older releases. We assume that FreeBSD - 4.0-RELEASE always uses ELF. */ - i386fbsd_init_abi (info, gdbarch); - - /* FreeBSD 4.0 introduced a new `struct sigcontext'. */ - tdep->sc_reg_offset = i386fbsd4_sc_reg_offset; - tdep->sc_num_regs = I386_NUM_GREGS; + tdep->sc_num_regs = ARRAY_SIZE (i386bsd_sc_reg_offset); } @@ -249,9 +153,4 @@ _initialize_i386bsd_tdep (void) { gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour, i386bsd_aout_osabi_sniffer); - - gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD_AOUT, - i386fbsdaout_init_abi); - gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD_ELF, - i386fbsd4_init_abi); } diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c index 3a6c797..7533f09 100644 --- a/gdb/i386gnu-nat.c +++ b/gdb/i386gnu-nat.c @@ -89,7 +89,7 @@ fetch_fpregs (struct proc *thread) } /* Supply the floating-point registers. */ - i387_supply_fsave (state.hw_state, -1); + i387_supply_fsave (current_regcache, -1, state.hw_state); } #ifdef HAVE_SYS_PROCFS_H @@ -106,7 +106,7 @@ supply_gregset (gdb_gregset_t *gregs) void supply_fpregset (gdb_fpregset_t *fpregs) { - i387_supply_fsave ((const char *) fpregs, -1); + i387_supply_fsave (current_regcache, -1, fpregs); } #endif @@ -242,7 +242,7 @@ gnu_store_registers (int regno) if ((thread->fetched_regs & (1 << check_regno)) && memcpy (REG_ADDR (&old_state, check_regno), REG_ADDR (state, check_regno), - REGISTER_RAW_SIZE (check_regno))) + DEPRECATED_REGISTER_RAW_SIZE (check_regno))) /* Register CHECK_REGNO has changed! Ack! */ { warning ("Register %s changed after the thread was aborted", @@ -257,7 +257,7 @@ gnu_store_registers (int regno) #define fill(state, regno) \ memcpy (REG_ADDR(state, regno), &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], \ - REGISTER_RAW_SIZE (regno)) + DEPRECATED_REGISTER_RAW_SIZE (regno)) if (regno == -1) { diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 9e8d973..dae0a1d 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -89,7 +89,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, i386nbsd_supply_reg (regs, -1); /* Floating point registers. */ - i387_supply_fsave (fsave, -1); + i387_supply_fsave (current_regcache, -1, fsave); } static void @@ -109,7 +109,7 @@ fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size != 108) warning ("Wrong size FP register set in core file."); else - i387_supply_fsave (core_reg_sect, -1); + i387_supply_fsave (current_regcache, -1, core_reg_sect); break; case 3: /* "Extended" floating point registers. This is gdb-speak @@ -117,7 +117,7 @@ fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size != 512) warning ("Wrong size XMM register set in core file."); else - i387_supply_fxsave (core_reg_sect, -1); + i387_supply_fxsave (current_regcache, -1, core_reg_sect); break; default: diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c index 8cfaa24..a7e9441 100644 --- a/gdb/i386obsd-tdep.c +++ b/gdb/i386obsd-tdep.c @@ -66,7 +66,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, i386obsd_supply_reg (regs, -1); /* Floating point registers. */ - i387_supply_fsave (fsave, -1); + i387_supply_fsave (current_regcache, -1, fsave); } static struct core_fns i386obsd_core_fns = diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c index c680dac..188f01b 100644 --- a/gdb/i386v4-nat.c +++ b/gdb/i386v4-nat.c @@ -139,7 +139,7 @@ supply_fpregset (fpregset_t *fpregsetp) if (FP0_REGNUM == 0) return; - i387_supply_fsave ((const char *) fpregsetp, -1); + i387_supply_fsave (current_regcache, -1, fpregsetp); } /* Fill register REGNO (if it is a floating-point register) in diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 6feb392..ff369f9 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -205,6 +205,7 @@ void i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) { + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); char buf[4]; ULONGEST fctrl; ULONGEST fstat; @@ -217,20 +218,26 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, int fpreg; int top; - fctrl = get_frame_register_unsigned (frame, FCTRL_REGNUM); - fstat = get_frame_register_unsigned (frame, FSTAT_REGNUM); - ftag = get_frame_register_unsigned (frame, FTAG_REGNUM); - fiseg = get_frame_register_unsigned (frame, FISEG_REGNUM); - fioff = get_frame_register_unsigned (frame, FIOFF_REGNUM); - foseg = get_frame_register_unsigned (frame, FOSEG_REGNUM); - fooff = get_frame_register_unsigned (frame, FOOFF_REGNUM); - fop = get_frame_register_unsigned (frame, FOP_REGNUM); + gdb_assert (gdbarch == get_frame_arch (frame)); + + /* Define I387_ST0_REGNUM such that we use the proper definitions + for FRAME's architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + fctrl = get_frame_register_unsigned (frame, I387_FCTRL_REGNUM); + fstat = get_frame_register_unsigned (frame, I387_FSTAT_REGNUM); + ftag = get_frame_register_unsigned (frame, I387_FTAG_REGNUM); + fiseg = get_frame_register_unsigned (frame, I387_FISEG_REGNUM); + fioff = get_frame_register_unsigned (frame, I387_FIOFF_REGNUM); + foseg = get_frame_register_unsigned (frame, I387_FOSEG_REGNUM); + fooff = get_frame_register_unsigned (frame, I387_FOOFF_REGNUM); + fop = get_frame_register_unsigned (frame, I387_FOP_REGNUM); top = ((fstat >> 11) & 7); for (fpreg = 7; fpreg >= 0; fpreg--) { - unsigned char raw[FPU_REG_RAW_SIZE]; + unsigned char raw[I386_MAX_REGISTER_SIZE]; int tag = (ftag >> (fpreg * 2)) & 3; int i; @@ -252,7 +259,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, break; } - get_frame_register (frame, (fpreg + 8 - top) % 8 + FP0_REGNUM, raw); + get_frame_register (frame, (fpreg + 8 - top) % 8 + I387_ST0_REGNUM, raw); fputs_filtered ("0x", file); for (i = 9; i >= 0; i--) @@ -278,6 +285,8 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, fprintf_filtered (file, "%s\n", local_hex_string_custom (fooff, "08")); fprintf_filtered (file, "Opcode: %s\n", local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04")); + +#undef I387_ST0_REGNUM } @@ -331,70 +340,87 @@ i387_value_to_register (struct frame_info *frame, int regnum, put_frame_register (frame, regnum, to); } + /* Handle FSAVE and FXSAVE formats. */ +/* FIXME: kettenis/20030927: The functions below should accept a + `regcache' argument, but I don't want to change the function + signature just yet. There's some band-aid in the functions below + in the form of the `regcache' local variables. This will ease the + transition later on. */ + /* At fsave_offset[REGNUM] you'll find the offset to the location in the data structure used by the "fsave" instruction where GDB register REGNUM is stored. */ static int fsave_offset[] = { - 28 + 0 * FPU_REG_RAW_SIZE, /* FP0_REGNUM through ... */ - 28 + 1 * FPU_REG_RAW_SIZE, - 28 + 2 * FPU_REG_RAW_SIZE, - 28 + 3 * FPU_REG_RAW_SIZE, - 28 + 4 * FPU_REG_RAW_SIZE, - 28 + 5 * FPU_REG_RAW_SIZE, - 28 + 6 * FPU_REG_RAW_SIZE, - 28 + 7 * FPU_REG_RAW_SIZE, /* ... FP7_REGNUM. */ - 0, /* FCTRL_REGNUM (16 bits). */ - 4, /* FSTAT_REGNUM (16 bits). */ - 8, /* FTAG_REGNUM (16 bits). */ - 16, /* FISEG_REGNUM (16 bits). */ - 12, /* FIOFF_REGNUM. */ - 24, /* FOSEG_REGNUM. */ - 20, /* FOOFF_REGNUM. */ - 18 /* FOP_REGNUM (bottom 11 bits). */ + 28 + 0 * 10, /* %st(0) ... */ + 28 + 1 * 10, + 28 + 2 * 10, + 28 + 3 * 10, + 28 + 4 * 10, + 28 + 5 * 10, + 28 + 6 * 10, + 28 + 7 * 10, /* ... %st(7). */ + 0, /* `fctrl' (16 bits). */ + 4, /* `fstat' (16 bits). */ + 8, /* `ftag' (16 bits). */ + 16, /* `fiseg' (16 bits). */ + 12, /* `fioff'. */ + 24, /* `foseg' (16 bits). */ + 20, /* `fooff'. */ + 18 /* `fop' (bottom 11 bits). */ }; -#define FSAVE_ADDR(fsave, regnum) (fsave + fsave_offset[regnum - FP0_REGNUM]) +#define FSAVE_ADDR(fsave, regnum) \ + (fsave + fsave_offset[regnum - I387_ST0_REGNUM]) -/* Fill register REGNUM in GDB's register cache with the appropriate - value from *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ +/* Fill register REGNUM in REGCACHE with the appropriate value from + *FSAVE. This function masks off any of the reserved bits in + *FSAVE. */ void -i387_supply_fsave (const char *fsave, int regnum) +i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave) { + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + const char *regs = fsave; int i; - for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) + gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); + + /* Define I387_ST0_REGNUM such that we use the proper definitions + for REGCACHE's architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + for (i = I387_ST0_REGNUM; i < I387_XMM0_REGNUM; i++) if (regnum == -1 || regnum == i) { if (fsave == NULL) { - supply_register (i, NULL); - return; + regcache_raw_supply (regcache, i, NULL); + continue; } /* Most of the FPU control registers occupy only 16 bits in the fsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + if (i >= I387_FCTRL_REGNUM + && i != I387_FIOFF_REGNUM && i != I387_FOOFF_REGNUM) { unsigned char val[4]; - memcpy (val, FSAVE_ADDR (fsave, i), 2); + memcpy (val, FSAVE_ADDR (regs, i), 2); val[2] = val[3] = 0; - if (i == FOP_REGNUM) + if (i == I387_FOP_REGNUM) val[1] &= ((1 << 3) - 1); - supply_register (i, val); + regcache_raw_supply (regcache, i, val); } else - supply_register (i, FSAVE_ADDR (fsave, i)); + regcache_raw_supply (regcache, i, FSAVE_ADDR (regs, i)); } +#undef I387_ST0_REGNUM } /* Fill register REGNUM (if it is a floating-point register) in *FSAVE @@ -403,34 +429,44 @@ i387_supply_fsave (const char *fsave, int regnum) bits in *FSAVE. */ void -i387_fill_fsave (char *fsave, int regnum) +i387_fill_fsave (void *fsave, int regnum) { + struct regcache *regcache = current_regcache; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + char *regs = fsave; int i; - for (i = FP0_REGNUM; i < XMM0_REGNUM; i++) + gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); + + /* Define I387_ST0_REGNUM such that we use the proper definitions + for REGCACHE's architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + for (i = I387_ST0_REGNUM; i < I387_XMM0_REGNUM; i++) if (regnum == -1 || regnum == i) { /* Most of the FPU control registers occupy only 16 bits in the fsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + if (i >= I387_FCTRL_REGNUM + && i != I387_FIOFF_REGNUM && i != I387_FOOFF_REGNUM) { unsigned char buf[4]; - regcache_collect (i, buf); + regcache_raw_collect (regcache, i, buf); - if (i == FOP_REGNUM) + if (i == I387_FOP_REGNUM) { /* The opcode occupies only 11 bits. Make sure we don't touch the other bits. */ buf[1] &= ((1 << 3) - 1); - buf[1] |= ((FSAVE_ADDR (fsave, i))[1] & ~((1 << 3) - 1)); + buf[1] |= ((FSAVE_ADDR (regs, i))[1] & ~((1 << 3) - 1)); } - memcpy (FSAVE_ADDR (fsave, i), buf, 2); + memcpy (FSAVE_ADDR (regs, i), buf, 2); } else - regcache_collect (i, FSAVE_ADDR (fsave, i)); + regcache_raw_collect (regcache, i, FSAVE_ADDR (regs, i)); } +#undef I387_ST0_REGNUM } @@ -440,23 +476,23 @@ i387_fill_fsave (char *fsave, int regnum) static int fxsave_offset[] = { - 32, /* FP0_REGNUM through ... */ + 32, /* %st(0) through ... */ 48, 64, 80, 96, 112, 128, - 144, /* ... FP7_REGNUM (80 bits each). */ - 0, /* FCTRL_REGNUM (16 bits). */ - 2, /* FSTAT_REGNUM (16 bits). */ - 4, /* FTAG_REGNUM (16 bits). */ - 12, /* FISEG_REGNUM (16 bits). */ - 8, /* FIOFF_REGNUM. */ - 20, /* FOSEG_REGNUM (16 bits). */ - 16, /* FOOFF_REGNUM. */ - 6, /* FOP_REGNUM (bottom 11 bits). */ - 160 + 0 * 16, /* XMM0_REGNUM through ... */ + 144, /* ... %st(7) (80 bits each). */ + 0, /* `fctrl' (16 bits). */ + 2, /* `fstat' (16 bits). */ + 4, /* `ftag' (16 bits). */ + 12, /* `fiseg' (16 bits). */ + 8, /* `fioff'. */ + 20, /* `foseg' (16 bits). */ + 16, /* `fooff'. */ + 6, /* `fop' (bottom 11 bits). */ + 160 + 0 * 16, /* %xmm0 through ... */ 160 + 1 * 16, 160 + 2 * 16, 160 + 3 * 16, @@ -471,56 +507,63 @@ static int fxsave_offset[] = 160 + 12 * 16, 160 + 13 * 16, 160 + 14 * 16, - 160 + 15 * 16, /* ... XMM15_REGNUM (128 bits each). */ - 24 /* MXCSR_REGNUM. */ + 160 + 15 * 16, /* ... %xmm15 (128 bits each). */ }; -/* FIXME: kettenis/20030430: We made an unfortunate choice in putting - %mxcsr after the SSE registers %xmm0-%xmm7 instead of before, since - it makes supporting the registers %xmm8-%xmm15 on x86-64 a bit - involved. Hack around it by explicitly overriding the offset for - %mxcsr here. */ - #define FXSAVE_ADDR(fxsave, regnum) \ - ((regnum == MXCSR_REGNUM) ? (fxsave + 24) : \ - (fxsave + fxsave_offset[regnum - FP0_REGNUM])) + (fxsave + fxsave_offset[regnum - I387_ST0_REGNUM]) + +/* We made an unfortunate choice in putting %mxcsr after the SSE + registers %xmm0-%xmm7 instead of before, since it makes supporting + the registers %xmm8-%xmm15 on AMD64 a bit involved. Therefore we + don't include the offset for %mxcsr here above. */ + +#define FXSAVE_MXCSR_ADDR(fxsave) (fxsave + 24) static int i387_tag (const unsigned char *raw); -/* Fill register REGNUM in GDB's register cache with the appropriate +/* Fill register REGNUM in REGCACHE with the appropriate floating-point or SSE register value from *FXSAVE. This function masks off any of the reserved bits in *FXSAVE. */ void -i387_supply_fxsave (const char *fxsave, int regnum) +i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave) { - int i, last_regnum = MXCSR_REGNUM; + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + const char *regs = fxsave; + int i; + + gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); + gdb_assert (tdep->num_xmm_regs > 0); - if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) - last_regnum = FOP_REGNUM; + /* Define I387_ST0_REGNUM and I387_NUM_XMM_REGS such that we use the + proper definitions for REGCACHE's architecture. */ - for (i = FP0_REGNUM; i <= last_regnum; i++) +#define I387_ST0_REGNUM tdep->st0_regnum +#define I387_NUM_XMM_REGS tdep->num_xmm_regs + + for (i = I387_ST0_REGNUM; i < I387_MXCSR_REGNUM; i++) if (regnum == -1 || regnum == i) { - if (fxsave == NULL) + if (regs == NULL) { - supply_register (i, NULL); + regcache_raw_supply (regcache, i, NULL); continue; } /* Most of the FPU control registers occupy only 16 bits in the fxsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM && i < XMM0_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + if (i >= I387_FCTRL_REGNUM && i < I387_XMM0_REGNUM + && i != I387_FIOFF_REGNUM && i != I387_FOOFF_REGNUM) { unsigned char val[4]; - memcpy (val, FXSAVE_ADDR (fxsave, i), 2); + memcpy (val, FXSAVE_ADDR (regs, i), 2); val[2] = val[3] = 0; - if (i == FOP_REGNUM) + if (i == I387_FOP_REGNUM) val[1] &= ((1 << 3) - 1); - else if (i== FTAG_REGNUM) + else if (i== I387_FTAG_REGNUM) { /* The fxsave area contains a simplified version of the tag word. We have to look at the actual 80-bit @@ -530,7 +573,8 @@ i387_supply_fxsave (const char *fxsave, int regnum) int fpreg; int top; - top = (((FXSAVE_ADDR (fxsave, FSTAT_REGNUM))[1] >> 3) & 0x7); + top = ((FXSAVE_ADDR (regs, I387_FSTAT_REGNUM))[1] >> 3); + top &= 0x7; for (fpreg = 7; fpreg >= 0; fpreg--) { @@ -538,8 +582,8 @@ i387_supply_fxsave (const char *fxsave, int regnum) if (val[0] & (1 << fpreg)) { - int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM; - tag = i387_tag (FXSAVE_ADDR (fxsave, regnum)); + int regnum = (fpreg + 8 - top) % 8 + I387_ST0_REGNUM; + tag = i387_tag (FXSAVE_ADDR (regs, regnum)); } else tag = 3; /* Empty */ @@ -549,11 +593,23 @@ i387_supply_fxsave (const char *fxsave, int regnum) val[0] = ftag & 0xff; val[1] = (ftag >> 8) & 0xff; } - supply_register (i, val); + regcache_raw_supply (regcache, i, val); } else - supply_register (i, FXSAVE_ADDR (fxsave, i)); + regcache_raw_supply (regcache, i, FXSAVE_ADDR (regs, i)); } + + if (regnum == I387_MXCSR_REGNUM || regnum == -1) + { + if (regs == NULL) + regcache_raw_supply (regcache, I387_MXCSR_REGNUM, NULL); + else + regcache_raw_supply (regcache, I387_MXCSR_REGNUM, + FXSAVE_MXCSR_ADDR (regs)); + } + +#undef I387_ST0_REGNUM +#undef I387_NUM_XMM_REGS } /* Fill register REGNUM (if it is a floating-point or SSE register) in @@ -562,33 +618,42 @@ i387_supply_fxsave (const char *fxsave, int regnum) reserved bits in *FXSAVE. */ void -i387_fill_fxsave (char *fxsave, int regnum) +i387_fill_fxsave (void *fxsave, int regnum) { - int i, last_regnum = MXCSR_REGNUM; + struct regcache *regcache = current_regcache; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + char *regs = fxsave; + int i; + + gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); + gdb_assert (tdep->num_xmm_regs > 0); - if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) - last_regnum = FOP_REGNUM; + /* Define I387_ST0_REGNUM and I387_NUM_XMM_REGS such that we use the + proper definitions for REGCACHE's architecture. */ - for (i = FP0_REGNUM; i <= last_regnum; i++) +#define I387_ST0_REGNUM tdep->st0_regnum +#define I387_NUM_XMM_REGS tdep->num_xmm_regs + + for (i = I387_ST0_REGNUM; i < I387_MXCSR_REGNUM; i++) if (regnum == -1 || regnum == i) { /* Most of the FPU control registers occupy only 16 bits in the fxsave area. Give those a special treatment. */ - if (i >= FPC_REGNUM && i < XMM0_REGNUM - && i != FIOFF_REGNUM && i != FOOFF_REGNUM) + if (i >= I387_FCTRL_REGNUM && i < I387_XMM0_REGNUM + && i != I387_FIOFF_REGNUM && i != I387_FOOFF_REGNUM) { unsigned char buf[4]; - regcache_collect (i, buf); + regcache_raw_collect (regcache, i, buf); - if (i == FOP_REGNUM) + if (i == I387_FOP_REGNUM) { /* The opcode occupies only 11 bits. Make sure we don't touch the other bits. */ buf[1] &= ((1 << 3) - 1); - buf[1] |= ((FXSAVE_ADDR (fxsave, i))[1] & ~((1 << 3) - 1)); + buf[1] |= ((FXSAVE_ADDR (regs, i))[1] & ~((1 << 3) - 1)); } - else if (i == FTAG_REGNUM) + else if (i == I387_FTAG_REGNUM) { /* Converting back is much easier. */ @@ -607,11 +672,18 @@ i387_fill_fxsave (char *fxsave, int regnum) buf[0] |= (1 << fpreg); } } - memcpy (FXSAVE_ADDR (fxsave, i), buf, 2); + memcpy (FXSAVE_ADDR (regs, i), buf, 2); } else - regcache_collect (i, FXSAVE_ADDR (fxsave, i)); + regcache_raw_collect (regcache, i, FXSAVE_ADDR (regs, i)); } + + if (regnum == I387_MXCSR_REGNUM || regnum == -1) + regcache_raw_collect (regcache, I387_MXCSR_REGNUM, + FXSAVE_MXCSR_ADDR (regs)); + +#undef I387_ST0_REGNUM +#undef I387_NUM_XMM_REGS } /* Recreate the FTW (tag word) valid bits from the 80-bit FP data in diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h index 654b4a5..377e17a 100644 --- a/gdb/i387-tdep.h +++ b/gdb/i387-tdep.h @@ -23,9 +23,31 @@ #define I387_TDEP_H struct gdbarch; -struct ui_file; struct frame_info; +struct regcache; struct type; +struct ui_file; + +/* Because the number of general-purpose registers is different for + AMD64, the floating-point registers and SSE registers get shifted. + The following definitions are intended to help writing code that + needs the register numbers of floating-point registers and SSE + registers. In order to use these, one should provide a definition + for I387_ST0_REGNUM, and possibly I387_NUM_XMM_REGS, preferably by + using a local "#define" in the body of the function that uses this. + Please "#undef" them before the end of the function. */ + +#define I387_FCTRL_REGNUM (I387_ST0_REGNUM + 8) +#define I387_FSTAT_REGNUM (I387_FCTRL_REGNUM + 1) +#define I387_FTAG_REGNUM (I387_FCTRL_REGNUM + 2) +#define I387_FISEG_REGNUM (I387_FCTRL_REGNUM + 3) +#define I387_FIOFF_REGNUM (I387_FCTRL_REGNUM + 4) +#define I387_FOSEG_REGNUM (I387_FCTRL_REGNUM + 5) +#define I387_FOOFF_REGNUM (I387_FCTRL_REGNUM + 6) +#define I387_FOP_REGNUM (I387_FCTRL_REGNUM + 7) +#define I387_XMM0_REGNUM (I387_ST0_REGNUM + 16) +#define I387_MXCSR_REGNUM (I387_XMM0_REGNUM + I387_NUM_XMM_REGS) + /* Print out the i387 floating point state. */ @@ -52,30 +74,32 @@ extern void i387_value_to_register (struct frame_info *frame, int regnum, #define I387_SIZEOF_FSAVE 108 #define I387_SIZEOF_FXSAVE 512 -/* Fill register REGNUM in GDB's register cache with the appropriate - value from *FSAVE. This function masks off any of the reserved - bits in *FSAVE. */ +/* Fill register REGNUM in REGCACHE with the appropriate value from + *FSAVE. This function masks off any of the reserved bits in + *FSAVE. */ -extern void i387_supply_fsave (const char *fsave, int regnum); +extern void i387_supply_fsave (struct regcache *regcache, int regnum, + const void *fsave); /* Fill register REGNUM (if it is a floating-point register) in *FSAVE with the value in GDB's register cache. If REGNUM is -1, do this for all registers. This function doesn't touch any of the reserved bits in *FSAVE. */ -extern void i387_fill_fsave (char *fsave, int regnum); +extern void i387_fill_fsave (void *fsave, int regnum); -/* Fill register REGNUM in GDB's register cache with the appropriate +/* Fill register REGNUM in REGCACHE with the appropriate floating-point or SSE register value from *FXSAVE. This function masks off any of the reserved bits in *FXSAVE. */ -extern void i387_supply_fxsave (const char *fxsave, int regnum); +extern void i387_supply_fxsave (struct regcache *regcache, int regnum, + const void *fxsave); /* Fill register REGNUM (if it is a floating-point or SSE register) in *FXSAVE with the value in GDB's register cache. If REGNUM is -1, do this for all registers. This function doesn't touch any of the reserved bits in *FXSAVE. */ -extern void i387_fill_fxsave (char *fxsave, int regnum); +extern void i387_fill_fxsave (void *fxsave, int regnum); #endif /* i387-tdep.h */ diff --git a/gdb/ia64-aix-nat.c b/gdb/ia64-aix-nat.c index ee3dc16..61f34e1 100644 --- a/gdb/ia64-aix-nat.c +++ b/gdb/ia64-aix-nat.c @@ -87,7 +87,7 @@ fill_gregset (prgregset_t *gregsetp, int regno) #define COPY_REG(_fld_,_regi_) \ if ((regno == -1) || regno == _regi_) \ memcpy (&(gregsetp->_fld_), &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \ - REGISTER_RAW_SIZE (_regi_)) + DEPRECATED_REGISTER_RAW_SIZE (_regi_)) for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++) { @@ -110,10 +110,10 @@ fill_gregset (prgregset_t *gregsetp, int regno) { memcpy (&(gregsetp->__bspstore), &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)], - REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSPSTORE_REGNUM)], &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)], - REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); } #if 0 @@ -156,7 +156,7 @@ fill_fpregset (prfpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]); - memcpy (to, from, REGISTER_RAW_SIZE (regi)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } } diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index ebaad7c..a2ca8fa 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -403,7 +403,7 @@ fill_gregset (gregset_t *gregsetp, int regno) #define COPY_REG(_idx_,_regi_) \ if ((regno == -1) || regno == _regi_) \ memcpy (regp + _idx_, &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \ - REGISTER_RAW_SIZE (_regi_)) + DEPRECATED_REGISTER_RAW_SIZE (_regi_)) for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++) { @@ -469,7 +469,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]); - memcpy (to, from, REGISTER_RAW_SIZE (regi)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } } diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c index 97f8814..25902c5 100644 --- a/gdb/ia64-linux-tdep.c +++ b/gdb/ia64-linux-tdep.c @@ -21,6 +21,7 @@ #include "defs.h" #include "arch-utils.h" +#include "gdbcore.h" /* The sigtramp code is in a non-readable (executable-only) region of memory called the ``gate page''. The addresses in question @@ -47,40 +48,47 @@ ia64_linux_in_sigtramp (CORE_ADDR pc, char *func_name) CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR sp, int regno) { + char buf[8]; + CORE_ADDR sigcontext_addr = 0; + + /* The address of the sigcontext area is found at offset 16 in the sigframe. */ + read_memory (sp + 16, buf, 8); + sigcontext_addr = extract_unsigned_integer (buf, 8); + if (IA64_GR0_REGNUM <= regno && regno <= IA64_GR31_REGNUM) - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 200 + 8 * (regno - IA64_GR0_REGNUM); + return sigcontext_addr + 200 + 8 * (regno - IA64_GR0_REGNUM); else if (IA64_BR0_REGNUM <= regno && regno <= IA64_BR7_REGNUM) - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 136 + 8 * (regno - IA64_BR0_REGNUM); + return sigcontext_addr + 136 + 8 * (regno - IA64_BR0_REGNUM); else if (IA64_FR0_REGNUM <= regno && regno <= IA64_FR127_REGNUM) - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 464 + 16 * (regno - IA64_FR0_REGNUM); + return sigcontext_addr + 464 + 16 * (regno - IA64_FR0_REGNUM); else switch (regno) { case IA64_IP_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 40; + return sigcontext_addr + 40; case IA64_CFM_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 48; + return sigcontext_addr + 48; case IA64_PSR_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 56; /* user mask only */ + return sigcontext_addr + 56; /* user mask only */ /* sc_ar_rsc is provided, from which we could compute bspstore, but I don't think it's worth it. Anyway, if we want it, it's at offset 64 */ case IA64_BSP_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 72; + return sigcontext_addr + 72; case IA64_RNAT_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 80; + return sigcontext_addr + 80; case IA64_CCV_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 88; + return sigcontext_addr + 88; case IA64_UNAT_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 96; + return sigcontext_addr + 96; case IA64_FPSR_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 104; + return sigcontext_addr + 104; case IA64_PFS_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 112; + return sigcontext_addr + 112; case IA64_LC_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 120; + return sigcontext_addr + 120; case IA64_PR_REGNUM : - return sp + IA64_LINUX_SIGCONTEXT_OFFSET + 128; + return sigcontext_addr + 128; default : return 0; } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 79c645d..4d0f8a8 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -108,7 +108,7 @@ static int fp_regnum = IA64_VFP_REGNUM; static int lr_regnum = IA64_VRAP_REGNUM; /* NOTE: we treat the register stack registers r32-r127 as pseudo-registers because - they are in memory and must be calculated via the bsp register. */ + they may not be accessible via the ptrace register get/set interfaces. */ enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS, VBOF_REGNUM = IA64_NAT127_REGNUM + 1, V32_REGNUM, V127_REGNUM = V32_REGNUM + 95, VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16, VP63_REGNUM = VP0_REGNUM + 63, LAST_PSEUDO_REGNUM }; @@ -232,6 +232,7 @@ struct ia64_frame_cache CORE_ADDR saved_sp; /* stack pointer for frame */ CORE_ADDR bsp; /* points at r32 for the current frame */ CORE_ADDR cfm; /* cfm value for current frame */ + CORE_ADDR prev_cfm; /* cfm value for previous frame */ int frameless; int sof; /* Size of frame (decoded from cfm value) */ int sol; /* Size of locals (decoded from cfm value) */ @@ -255,9 +256,6 @@ struct ia64_frame_cache struct gdbarch_tdep { - int os_ident; /* From the ELF header, one of the ELFOSABI_ - constants: ELFOSABI_LINUX, ELFOSABI_AIX, - etc. */ CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); /* OS specific function which, given a frame address and register number, returns the offset to the @@ -316,10 +314,16 @@ ia64_dwarf_reg_to_regnum (int reg) return reg; } +static int +floatformat_valid (const struct floatformat *fmt, const char *from) +{ + return 1; +} + const struct floatformat floatformat_ia64_ext = { floatformat_little, 82, 0, 1, 17, 65535, 0x1ffff, 18, 64, - floatformat_intbit_yes + floatformat_intbit_yes, "floatformat_ia64_ext", floatformat_valid }; @@ -343,7 +347,7 @@ read_sigcontext_register (struct frame_info *frame, int regnum) regaddr = SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regnum); if (regaddr) - return read_memory_integer (regaddr, REGISTER_RAW_SIZE (regnum)); + return read_memory_integer (regaddr, register_size (current_gdbarch, regnum)); else internal_error (__FILE__, __LINE__, "read_sigcontext_register: Register %d not in struct sigcontext", regnum); @@ -716,10 +720,10 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, { ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), reg); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg); } else - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), 0); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0); } else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) { @@ -727,7 +731,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, ULONGEST unat; regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat); unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0; - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), unatN_val); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), unatN_val); } else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM) { @@ -762,7 +766,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, natN_val = (nat_collection >> nat_bit) & 1; } - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), natN_val); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), natN_val); } else if (regnum == VBOF_REGNUM) { @@ -777,7 +781,7 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, /* The bsp points at the end of the register frame so we subtract the size of frame from it to get beginning of frame. */ vbsp = rse_address_add (bsp, -(cfm & 0x7f)); - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), vbsp); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), vbsp); } else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) { @@ -799,10 +803,10 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, + ((regnum - VP16_REGNUM) + rrb_pr) % 48; } prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0; - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum), prN_val); + store_unsigned_integer (buf, register_size (current_gdbarch, regnum), prN_val); } else - memset (buf, 0, REGISTER_RAW_SIZE (regnum)); + memset (buf, 0, register_size (current_gdbarch, regnum)); } static void @@ -829,7 +833,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { ULONGEST unatN_val, unat, unatN_mask; regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat); - unatN_val = extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum)); + unatN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)); unatN_mask = (1LL << (regnum - IA64_NAT0_REGNUM)); if (unatN_val == 0) unat &= ~unatN_mask; @@ -853,7 +857,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, if ((cfm & 0x7f) > regnum - V32_REGNUM) gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - natN_val = extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum)); + natN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)); if (gr_addr != 0 && (natN_val == 0 || natN_val == 1)) { @@ -882,7 +886,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, nat_collection |= natN_mask; else nat_collection &= ~natN_mask; - store_unsigned_integer (nat_buf, REGISTER_RAW_SIZE (regnum), nat_collection); + store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection); write_memory (nat_addr, nat_buf, 8); } } @@ -907,7 +911,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48; } - prN_val = extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum)); + prN_val = extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)); prN_mask = (1LL << (regnum - VP0_REGNUM)); if (prN_val == 0) pr &= ~prN_mask; @@ -1030,6 +1034,7 @@ ia64_alloc_frame_cache (void) cache->base = 0; cache->pc = 0; cache->cfm = 0; + cache->prev_cfm = 0; cache->sof = 0; cache->sol = 0; cache->sor = 0; @@ -1450,9 +1455,20 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *next_frame, /* For the previous argument registers we require the previous bof. If we can't find the previous cfm, then we can do nothing. */ + cfm = 0; if (cache->saved_regs[IA64_CFM_REGNUM] != 0) { cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM], 8); + } + else if (cfm_reg != 0) + { + frame_unwind_register (next_frame, cfm_reg, buf); + cfm = extract_unsigned_integer (buf, 8); + } + cache->prev_cfm = cfm; + + if (cfm != 0) + { sor = ((cfm >> 14) & 0xf) * 8; sof = (cfm & 0x7f); sol = (cfm >> 7) & 0x7f; @@ -1564,7 +1580,11 @@ ia64_frame_this_id (struct frame_info *next_frame, void **this_cache, if (cache->base == 0) return; - (*this_id) = frame_id_build (cache->base, cache->pc); + (*this_id) = frame_id_build_special (cache->base, cache->pc, cache->bsp); + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "regular frame id: code %lx, stack %lx, special %lx, next_frame %p\n", + this_id->code_addr, this_id->stack_addr, cache->bsp, next_frame); } static void @@ -1593,12 +1613,12 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (!valuep) valuep = dummy_valp; - memset (valuep, 0, REGISTER_RAW_SIZE (regnum)); + memset (valuep, 0, register_size (current_gdbarch, regnum)); if (regnum == SP_REGNUM) { /* Handle SP values for all frames but the topmost. */ - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (regnum), + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), cache->base); } else if (regnum == IA64_BSP_REGNUM) @@ -1613,7 +1633,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, /* We want to calculate the previous bsp as the end of the previous register stack frame. This corresponds to what the hardware bsp register will be if we pop the frame back which is why we might have been called. We know the beginning of the current - frame is cache->bsp - cache->sof. This value in the previous frame points to + frame is cache->bsp - cache->sof. This value in the previous frame points to the start of the output registers. We can calculate the end of that frame by adding the size of output (sof (size of frame) - sol (size of locals)). */ ia64_frame_prev_register (next_frame, this_cache, IA64_CFM_REGNUM, @@ -1623,23 +1643,25 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, bsp = rse_address_add (cache->bsp, -(cache->sof)); prev_bsp = rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f)); - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (regnum), + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), prev_bsp); } else if (regnum == IA64_CFM_REGNUM) { - CORE_ADDR addr = 0; - - if (cache->frameless) + CORE_ADDR addr = cache->saved_regs[IA64_CFM_REGNUM]; + + if (addr != 0) { - CORE_ADDR cfm = 0; - frame_unwind_register (next_frame, IA64_PFS_REGNUM, valuep); + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); } - else + else if (cache->prev_cfm) + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), cache->prev_cfm); + else if (cache->frameless) { - addr = cache->saved_regs[IA64_CFM_REGNUM]; - if (addr != 0) - read_memory (addr, valuep, REGISTER_RAW_SIZE (regnum)); + CORE_ADDR cfm = 0; + frame_unwind_register (next_frame, IA64_PFS_REGNUM, valuep); } } else if (regnum == IA64_VFP_REGNUM) @@ -1649,7 +1671,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, above. If the function lacks one of these frame pointers, we can still provide a value since we know the size of the frame. */ CORE_ADDR vfp = cache->base; - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp); + store_unsigned_integer (valuep, register_size (current_gdbarch, IA64_VFP_REGNUM), vfp); } else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) { @@ -1673,7 +1695,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, } prN_val = extract_bit_field ((unsigned char *) pr_valuep, regnum - VP0_REGNUM, 1); - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (regnum), prN_val); + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), prN_val); } else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) { @@ -1687,7 +1709,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, &unat_optim, &unat_lval, &unat_addr, &unat_realnum, unat_valuep); unatN_val = extract_bit_field ((unsigned char *) unat_valuep, regnum - IA64_NAT0_REGNUM, 1); - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (regnum), + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), unatN_val); } else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM) @@ -1722,58 +1744,73 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, natval = (nat_collection >> nat_bit) & 1; } - store_unsigned_integer (valuep, REGISTER_RAW_SIZE (regnum), natval); + store_unsigned_integer (valuep, register_size (current_gdbarch, regnum), natval); } else if (regnum == IA64_IP_REGNUM) { CORE_ADDR pc = 0; + CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; - if (cache->frameless) + if (addr != 0) { - frame_unwind_register (next_frame, IA64_BR0_REGNUM, buf); + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); pc = extract_unsigned_integer (buf, 8); } - else + else if (cache->frameless) { - CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; - if (addr != 0) - { - read_memory (addr, buf, REGISTER_RAW_SIZE (IA64_IP_REGNUM)); - pc = extract_unsigned_integer (buf, 8); - } + frame_unwind_register (next_frame, IA64_BR0_REGNUM, buf); + pc = extract_unsigned_integer (buf, 8); } pc &= ~0xf; store_unsigned_integer (valuep, 8, pc); } else if (regnum == IA64_PSR_REGNUM) { + /* We don't know how to get the complete previous PSR, but we need it for + the slot information when we unwind the pc (pc is formed of IP register + plus slot information from PSR). To get the previous slot information, + we mask it off the return address. */ ULONGEST slot_num = 0; CORE_ADDR pc= 0; CORE_ADDR psr = 0; + CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf); psr = extract_unsigned_integer (buf, 8); - if (cache->frameless) + if (addr != 0) { - CORE_ADDR pc; - frame_unwind_register (next_frame, IA64_BR0_REGNUM, buf); + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); pc = extract_unsigned_integer (buf, 8); } - else + else if (cache->frameless) { - CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; - if (addr != 0) - { - read_memory (addr, buf, REGISTER_RAW_SIZE (IA64_IP_REGNUM)); - pc = extract_unsigned_integer (buf, 8); - } + CORE_ADDR pc; + frame_unwind_register (next_frame, IA64_BR0_REGNUM, buf); + pc = extract_unsigned_integer (buf, 8); } psr &= ~(3LL << 41); slot_num = pc & 0x3LL; psr |= (CORE_ADDR)slot_num << 41; store_unsigned_integer (valuep, 8, psr); } + else if (regnum == IA64_BR0_REGNUM) + { + CORE_ADDR br0 = 0; + CORE_ADDR addr = cache->saved_regs[IA64_BR0_REGNUM]; + if (addr != 0) + { + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, buf, register_size (current_gdbarch, IA64_BR0_REGNUM)); + br0 = extract_unsigned_integer (buf, 8); + } + store_unsigned_integer (valuep, 8, br0); + } else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM) || (regnum >= V32_REGNUM && regnum <= V127_REGNUM)) { @@ -1785,7 +1822,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, REGISTER_RAW_SIZE (regnum)); + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); } else if (cache->frameless) { @@ -1809,7 +1846,7 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, REGISTER_RAW_SIZE (regnum)); + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); } } else @@ -1833,12 +1870,18 @@ ia64_frame_prev_register (struct frame_info *next_frame, void **this_cache, { *lvalp = lval_memory; *addrp = addr; - read_memory (addr, valuep, REGISTER_RAW_SIZE (regnum)); + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); } /* Otherwise, punt and get the current value of the register. */ else frame_unwind_register (next_frame, regnum, valuep); } + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "regular prev register <%d> <%s> is %lx\n", regnum, + (((unsigned) regnum <= IA64_NAT127_REGNUM) + ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); } static const struct frame_unwind ia64_frame_unwind = @@ -1869,10 +1912,8 @@ ia64_sigtramp_frame_init_saved_regs (struct ia64_frame_cache *cache) SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_CFM_REGNUM); cache->saved_regs[IA64_PSR_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_PSR_REGNUM); -#if 0 cache->saved_regs[IA64_BSP_REGNUM] = - SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_BSP_REGNUM); -#endif + SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_BSP_REGNUM); cache->saved_regs[IA64_RNAT_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_RNAT_REGNUM); cache->saved_regs[IA64_CCV_REGNUM] = @@ -1886,9 +1927,8 @@ ia64_sigtramp_frame_init_saved_regs (struct ia64_frame_cache *cache) cache->saved_regs[IA64_LC_REGNUM] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, IA64_LC_REGNUM); for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++) - if (regno != sp_regnum) - cache->saved_regs[regno] = - SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); + cache->saved_regs[regno] = + SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++) cache->saved_regs[regno] = SIGCONTEXT_REGISTER_ADDRESS (cache->base, regno); @@ -1912,7 +1952,16 @@ ia64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) cache = ia64_alloc_frame_cache (); frame_unwind_register (next_frame, sp_regnum, buf); - cache->base = extract_unsigned_integer (buf, 8) + cache->mem_stack_frame_size; + /* Note that frame size is hard-coded below. We cannot calculate it + via prologue examination. */ + cache->base = extract_unsigned_integer (buf, 8) + 16; + + frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); + cache->bsp = extract_unsigned_integer (buf, 8); + + frame_unwind_register (next_frame, IA64_CFM_REGNUM, buf); + cache->cfm = extract_unsigned_integer (buf, 8); + cache->sof = cache->cfm & 0x7f; ia64_sigtramp_frame_init_saved_regs (cache); @@ -1927,7 +1976,11 @@ ia64_sigtramp_frame_this_id (struct frame_info *next_frame, struct ia64_frame_cache *cache = ia64_sigtramp_frame_cache (next_frame, this_cache); - (*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame)); + (*this_id) = frame_id_build_special (cache->base, frame_pc_unwind (next_frame), cache->bsp); + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "sigtramp frame id: code %lx, stack %lx, special %lx, next_frame %p\n", + this_id->code_addr, this_id->stack_addr, cache->bsp, next_frame); } static void @@ -1937,11 +1990,75 @@ ia64_sigtramp_frame_prev_register (struct frame_info *next_frame, enum lval_type *lvalp, CORE_ADDR *addrp, int *realnump, void *valuep) { - /* Make sure we've initialized the cache. */ - ia64_sigtramp_frame_cache (next_frame, this_cache); + char dummy_valp[MAX_REGISTER_SIZE]; + char buf[MAX_REGISTER_SIZE]; - ia64_frame_prev_register (next_frame, this_cache, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + struct ia64_frame_cache *cache = + ia64_sigtramp_frame_cache (next_frame, this_cache); + + gdb_assert (regnum >= 0); + + if (!target_has_registers) + error ("No registers."); + + *optimizedp = 0; + *addrp = 0; + *lvalp = not_lval; + *realnump = -1; + + /* Rather than check each time if valuep is non-null, supply a dummy buffer + when valuep is not supplied. */ + if (!valuep) + valuep = dummy_valp; + + memset (valuep, 0, register_size (current_gdbarch, regnum)); + + if (regnum == IA64_IP_REGNUM) + { + CORE_ADDR pc = 0; + CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; + + if (addr != 0) + { + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, buf, register_size (current_gdbarch, IA64_IP_REGNUM)); + pc = extract_unsigned_integer (buf, 8); + } + pc &= ~0xf; + store_unsigned_integer (valuep, 8, pc); + } + else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM) || + (regnum >= V32_REGNUM && regnum <= V127_REGNUM)) + { + CORE_ADDR addr = 0; + if (regnum >= V32_REGNUM) + regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM); + addr = cache->saved_regs[regnum]; + if (addr != 0) + { + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + } + } + else + { + /* All other registers not listed above. */ + CORE_ADDR addr = cache->saved_regs[regnum]; + if (addr != 0) + { + *lvalp = lval_memory; + *addrp = addr; + read_memory (addr, valuep, register_size (current_gdbarch, regnum)); + } + } + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "sigtramp prev register <%s> is %lx\n", + (((unsigned) regnum <= IA64_NAT127_REGNUM) + ? ia64_register_names[regnum] : "r??"), extract_unsigned_integer (valuep, 8)); } static const struct frame_unwind ia64_sigtramp_frame_unwind = @@ -2293,7 +2410,8 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr) so the user can see the function address rather than just the function descriptor. */ static CORE_ADDR -ia64_convert_from_func_ptr_addr (CORE_ADDR addr) +ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, + struct target_ops *targ) { struct obj_section *s; @@ -2473,12 +2591,20 @@ static struct frame_id ia64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { char buf[8]; - CORE_ADDR sp; + CORE_ADDR sp, bsp; frame_unwind_register (next_frame, sp_regnum, buf); sp = extract_unsigned_integer (buf, 8); - return frame_id_build (sp, frame_pc_unwind (next_frame)); + frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf); + bsp = extract_unsigned_integer (buf, 8); + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, + "dummy frame id: code %lx, stack %lx, special %lx\n", + frame_pc_unwind (next_frame), sp, bsp); + + return frame_id_build_special (sp, frame_pc_unwind (next_frame), bsp); } static CORE_ADDR @@ -2579,47 +2705,21 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; - int os_ident; - if (info.abfd != NULL - && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) - { - os_ident = elf_elfheader (info.abfd)->e_ident[EI_OSABI]; - - /* If os_ident is 0, it is not necessarily the case that we're - on a SYSV system. (ELFOSABI_NONE is defined to be 0.) - GNU/Linux uses a note section to record OS/ABI info, but - leaves e_ident[EI_OSABI] zero. So we have to check for note - sections too. */ - if (os_ident == 0) - { - bfd_map_over_sections (info.abfd, - process_note_abi_tag_sections, - &os_ident); - } - } - else - os_ident = -1; - - for (arches = gdbarch_list_lookup_by_info (arches, &info); - arches != NULL; - arches = gdbarch_list_lookup_by_info (arches->next, &info)) - { - tdep = gdbarch_tdep (arches->gdbarch); - if (tdep &&tdep->os_ident == os_ident) - return arches->gdbarch; - } + /* If there is already a candidate, use it. */ + arches = gdbarch_list_lookup_by_info (arches, &info); + if (arches != NULL) + return arches->gdbarch; tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); - tdep->os_ident = os_ident; /* Set the method of obtaining the sigcontext addresses at which registers are saved. The method of checking to see if native_find_global_pointer is nonzero to indicate that we're on AIX is kind of hokey, but I can't think of a better way to do it. */ - if (os_ident == ELFOSABI_LINUX) + if (info.osabi == GDB_OSABI_LINUX) tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; else if (native_find_global_pointer != 0) tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address; @@ -2633,7 +2733,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) generic_elf_find_global_pointer. This arrangement should (in theory) allow us to cross debug GNU/Linux binaries from an AIX machine. */ - if (os_ident == ELFOSABI_LINUX) + if (info.osabi == GDB_OSABI_LINUX) tdep->find_global_pointer = generic_elf_find_global_pointer; else if (native_find_global_pointer != 0) tdep->find_global_pointer = native_find_global_pointer; diff --git a/gdb/infcall.c b/gdb/infcall.c index 926eaf3..7695c6a 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -182,7 +182,9 @@ find_function_addr (struct value *function, struct type **retval_type) if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) { - funaddr = CONVERT_FROM_FUNC_PTR_ADDR (funaddr); + funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + funaddr, + ¤t_target); value_type = TYPE_TARGET_TYPE (ftype); } else @@ -562,7 +564,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) dummy_addr = DEPRECATED_CALL_DUMMY_ADDRESS (); /* Make certain that the address points at real code, and not a function descriptor. */ - dummy_addr = CONVERT_FROM_FUNC_PTR_ADDR (dummy_addr); + dummy_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + dummy_addr, + ¤t_target); /* A call dummy always consists of just a single breakpoint, so it's address is the same as the address of the dummy. */ bp_addr = dummy_addr; @@ -583,7 +587,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) dummy_addr = entry_point_address (); /* Make certain that the address points at real code, and not a function descriptor. */ - dummy_addr = CONVERT_FROM_FUNC_PTR_ADDR (dummy_addr); + dummy_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + dummy_addr, + ¤t_target); /* A call dummy always consists of just a single breakpoint, so it's address is the same as the address of the dummy. */ bp_addr = dummy_addr; @@ -903,7 +909,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); else { /* The assumption here is that push_dummy_call() returned the - stack part of the frame ID. Unfortunatly, many older + stack part of the frame ID. Unfortunately, many older architectures were, via a convoluted mess, relying on the poorly defined and greatly overloaded DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM to supply @@ -1076,30 +1082,34 @@ the function call).", name); address of the returned structure. Usually this will be overwritten by the callee. I don't know about other architectures, so I defined this macro */ -#ifdef VALUE_RETURNED_FROM_STACK + /* FIXME: cagney/2003-09-27: This is no longer needed. The problem + is now handled directly be by the code below. */ +#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK if (struct_return) { do_cleanups (retbuf_cleanup); - return VALUE_RETURNED_FROM_STACK (value_type, struct_addr); + return DEPRECATED_VALUE_RETURNED_FROM_STACK (value_type, struct_addr); } #endif - /* NOTE: cagney/2002-09-10: Only when the stack has been correctly - aligned (using frame_align()) do we can trust STRUCT_ADDR and - fetch the return value direct from the stack. This lack of trust - comes about because legacy targets have a nasty habit of - silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. For - such targets, just hope that value_being_returned() can find the - adjusted value. */ - if (struct_return && gdbarch_frame_align_p (current_gdbarch)) + if (struct_return) { + /* NOTE: cagney/2003-09-27: This assumes that PUSH_DUMMY_CALL + has correctly stored STRUCT_ADDR in the target. In the past + that hasn't been the case, the old MIPS PUSH_ARGUMENTS + (PUSH_DUMMY_CALL precursor) would silently move the location + of the struct return value making STRUCT_ADDR bogus. If + you're seeing problems with values being returned using the + "struct return convention", check that PUSH_DUMMY_CALL isn't + playing tricks. */ struct value *retval = value_at (value_type, struct_addr, NULL); do_cleanups (retbuf_cleanup); return retval; } else { - struct value *retval = value_being_returned (value_type, retbuf, - struct_return); + /* The non-register case was handled above. */ + struct value *retval = register_value_being_returned (value_type, + retbuf); do_cleanups (retbuf_cleanup); return retval; } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index eee0b73..a7e0e15 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -44,6 +44,7 @@ #include "reggroups.h" #include "block.h" #include <ctype.h> +#include "gdb_assert.h" /* Functions exported for general use, in inferior.h: */ @@ -261,7 +262,6 @@ notice_args_read (char *args, int from_tty, struct cmd_list_element *c) /* Compute command-line string given argument vector. This does the same shell processing as fork_inferior. */ -/* ARGSUSED */ char * construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv) { @@ -370,7 +370,6 @@ strip_bg_char (char **args) return 0; } -/* ARGSUSED */ void tty_command (char *file, int from_tty) { @@ -543,7 +542,6 @@ continue_command (char *proc_count_exp, int from_tty) /* Step until outside of current statement. */ -/* ARGSUSED */ static void step_command (char *count_string, int from_tty) { @@ -552,7 +550,6 @@ step_command (char *count_string, int from_tty) /* Likewise, but skip over subroutine calls as if single instructions. */ -/* ARGSUSED */ static void next_command (char *count_string, int from_tty) { @@ -561,14 +558,12 @@ next_command (char *count_string, int from_tty) /* Likewise, but step only one instruction. */ -/* ARGSUSED */ void stepi_command (char *count_string, int from_tty) { step_1 (0, 1, count_string); } -/* ARGSUSED */ void nexti_command (char *count_string, int from_tty) { @@ -958,7 +953,6 @@ signal_command (char *signum_exp, int from_tty) we set. This may involve changes to wait_for_inferior and the proceed status code. */ -/* ARGSUSED */ static void until_next_command (int from_tty) { @@ -1077,7 +1071,7 @@ print_return_value (int structure_return, struct type *value_type) if (!structure_return) { - value = value_being_returned (value_type, stop_registers, structure_return); + value = register_value_being_returned (value_type, stop_registers); stb = ui_out_stream_new (uiout); ui_out_text (uiout, "Value returned is "); ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); @@ -1086,19 +1080,62 @@ print_return_value (int structure_return, struct type *value_type) ui_out_field_stream (uiout, "return-value", stb); ui_out_text (uiout, "\n"); } - else + /* FIXME: 2003-09-27: When returning from a nested inferior function + call, it's possible (with no help from the architecture vector) + to locate and return/print a "struct return" value. This is just + a more complicated case of what is already being done in in the + inferior function call code. In fact, when inferior function + calls are made async, this will likely be made the norm. */ +#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK +#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 1 +#else +#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 0 +#endif + else if (gdbarch_return_value_p (current_gdbarch) + || DEPRECATED_VALUE_RETURNED_FROM_STACK_P) + /* We cannot determine the contents of the structure because it is + on the stack, and we don't know where, since we did not + initiate the call, as opposed to the call_function_by_hand + case. */ { - /* We cannot determine the contents of the structure because - it is on the stack, and we don't know where, since we did not - initiate the call, as opposed to the call_function_by_hand case */ -#ifdef VALUE_RETURNED_FROM_STACK - value = 0; + gdb_assert (gdbarch_return_value (current_gdbarch, value_type, NULL, NULL, NULL) + == RETURN_VALUE_STRUCT_CONVENTION); ui_out_text (uiout, "Value returned has type: "); ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type)); ui_out_text (uiout, "."); ui_out_text (uiout, " Cannot determine contents\n"); -#else - value = value_being_returned (value_type, stop_registers, structure_return); + return; + } + else + { + if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + { + CORE_ADDR addr = EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); + if (!addr) + error ("Function return value unknown."); + value = value_at (value_type, addr, NULL); + } + else if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + { + char *buf = deprecated_grub_regcache_for_registers (stop_registers); + CORE_ADDR addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf); + if (!addr) + error ("Function return value unknown."); + value = value_at (value_type, addr, NULL); + } + else + { + /* It is "struct return" yet the value is being extracted, + presumably from registers, using EXTRACT_RETURN_VALUE. + This doesn't make sense. Unfortunately, the legacy + interfaces allowed this behavior. Sigh! */ + value = allocate_value (value_type); + CHECK_TYPEDEF (value_type); + /* If the function returns void, don't bother fetching the + return value. */ + EXTRACT_RETURN_VALUE (value_type, stop_registers, + VALUE_CONTENTS_RAW (value)); + } stb = ui_out_stream_new (uiout); ui_out_text (uiout, "Value returned is "); ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); @@ -1106,7 +1143,6 @@ print_return_value (int structure_return, struct type *value_type) value_print (value, stb->stream, 0, Val_no_prettyprint); ui_out_field_stream (uiout, "return-value", stb); ui_out_text (uiout, "\n"); -#endif } } @@ -1284,7 +1320,6 @@ finish_command (char *arg, int from_tty) } } -/* ARGSUSED */ static void program_info (char *args, int from_tty) { @@ -1446,7 +1481,6 @@ unset_environment_command (char *var, int from_tty) static const char path_var_name[] = "PATH"; -/* ARGSUSED */ static void path_info (char *args, int from_tty) { @@ -1476,9 +1510,6 @@ path_command (char *dirname, int from_tty) } -#ifdef REGISTER_NAMES -char *gdb_register_names[] = REGISTER_NAMES; -#endif /* Print out the machine register regnum. If regnum is -1, print all registers (print_all == 1) or all non-float and non-vector registers (print_all == 0). @@ -1557,7 +1588,7 @@ default_print_registers_info (struct gdbarch *gdbarch, else { memcpy (virtual_buffer, raw_buffer, - REGISTER_VIRTUAL_SIZE (i)); + DEPRECATED_REGISTER_VIRTUAL_SIZE (i)); } /* If virtual format is floating, print it that way, and in raw @@ -1570,13 +1601,13 @@ default_print_registers_info (struct gdbarch *gdbarch, file, 0, 1, 0, Val_pretty_default); fprintf_filtered (file, "\t(raw 0x"); - for (j = 0; j < REGISTER_RAW_SIZE (i); j++) + for (j = 0; j < DEPRECATED_REGISTER_RAW_SIZE (i); j++) { int idx; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) idx = j; else - idx = REGISTER_RAW_SIZE (i) - 1 - j; + idx = DEPRECATED_REGISTER_RAW_SIZE (i) - 1 - j; fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); } fprintf_filtered (file, ")"); @@ -1907,7 +1938,6 @@ interrupt_target_command (char *args, int from_tty) } } -/* ARGSUSED */ static void print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) @@ -1944,7 +1974,6 @@ float_info (char *args, int from_tty) print_float_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args); } -/* ARGSUSED */ static void unset_command (char *args, int from_tty) { diff --git a/gdb/inferior.h b/gdb/inferior.h index 60191f2..b36dcd4 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -472,29 +472,6 @@ extern int deprecated_pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); -/* It's often not enough for our clients to know whether the PC is merely - somewhere within the call dummy. They may need to know whether the - call dummy has actually completed. (For example, wait_for_inferior - wants to know when it should truly stop because the call dummy has - completed. If we're single-stepping because of slow watchpoints, - then we may find ourselves stopped at the entry of the call dummy, - and want to continue stepping until we reach the end.) - - Note that this macro is intended for targets (like HP-UX) which - require more than a single breakpoint in their call dummies, and - therefore cannot use the DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET - mechanism. - - If a target does define DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET, - then this default implementation of CALL_DUMMY_HAS_COMPLETED is - sufficient. Else, a target may wish to supply an implementation - that works in the presense of multiple breakpoints in its call - dummy. */ -#if !defined(CALL_DUMMY_HAS_COMPLETED) -#define CALL_DUMMY_HAS_COMPLETED(pc, sp, frame_address) \ - DEPRECATED_PC_IN_CALL_DUMMY((pc), (sp), (frame_address)) -#endif - /* If STARTUP_WITH_SHELL is set, GDB's "run" will attempts to start up the debugee under a shell. This is in order for argument-expansion to occur. E.g., diff --git a/gdb/inflow.c b/gdb/inflow.c index b860af7..55f6ab5 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -412,14 +412,12 @@ terminal_ours_1 (int output_only) } } -/* ARGSUSED */ void term_info (char *arg, int from_tty) { target_terminal_info (arg, from_tty); } -/* ARGSUSED */ void child_terminal_info (char *args, int from_tty) { @@ -572,7 +570,6 @@ new_tty (void) /* Kill the inferior process. Make us have no inferior. */ -/* ARGSUSED */ static void kill_command (char *arg, int from_tty) { @@ -604,7 +601,6 @@ kill_command (char *arg, int from_tty) /* Call set_sigint_trap when you need to pass a signal on to an attached process when handling SIGINT */ -/* ARGSUSED */ static void pass_signal (int signo) { diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 1286b75..ef86f90 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -366,7 +366,7 @@ fetch_register (int regno) if (CANNOT_FETCH_REGISTER (regno)) { - memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ + memset (buf, '\0', DEPRECATED_REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ supply_register (regno, buf); return; } @@ -378,7 +378,7 @@ fetch_register (int regno) offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; *(PTRACE_XFER_TYPE *) & buf[i] = ptrace (PT_READ_U, tid, @@ -445,7 +445,7 @@ store_register (int regno) regcache_collect (regno, buf); /* Store the local buffer into the inferior a chunk at the time. */ - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, diff --git a/gdb/infrun.c b/gdb/infrun.c index f4ab632..6bc22a6 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -153,10 +153,6 @@ static int may_follow_exec = MAY_FOLLOW_EXEC; #define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) 0 #endif -#ifndef SKIP_SOLIB_RESOLVER -#define SKIP_SOLIB_RESOLVER(pc) 0 -#endif - /* This function returns TRUE if pc is the address of an instruction that lies within the dynamic linker (such as the event hook, or the dld itself). @@ -495,7 +491,6 @@ static int singlestep_breakpoints_inserted_p = 0; /* Things to clean up if we QUIT out of resume (). */ -/* ARGSUSED */ static void resume_cleanups (void *ignore) { @@ -520,7 +515,7 @@ set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c) the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command - callbacks. Unfortunatly, for ``show'' commands cloned from + callbacks. Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ @@ -2637,6 +2632,22 @@ process_event_stop_test: /* In the case where we just stepped out of a function into the middle of a line of the caller, continue stepping, but step_frame_id must be modified to current frame */ +#if 0 + /* NOTE: cagney/2003-10-16: I think this frame ID inner test is too + generous. It will trigger on things like a step into a frameless + stackless leaf function. I think the logic should instead look + at the unwound frame ID has that should give a more robust + indication of what happened. */ + if (step-ID == current-ID) + still stepping in same function; + else if (step-ID == unwind (current-ID)) + stepped into a function; + else + stepped out of a function; + /* Of course this assumes that the frame ID unwind code is robust + and we're willing to introduce frame unwind logic into this + function. Fortunately, those days are nearly upon us. */ +#endif { struct frame_id current_frame = get_frame_id (get_current_frame ()); if (!(frame_id_inner (current_frame, step_frame_id))) @@ -2792,7 +2803,7 @@ step_over_function (struct execution_control_state *ecs) - 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 + Unfortunately, not five lines further down, is a call to get_frame_id() and that is guarenteed to trigger the prologue analyzer. @@ -3623,7 +3634,7 @@ void write_inferior_status_register (struct inferior_status *inf_status, int regno, LONGEST val) { - int size = REGISTER_RAW_SIZE (regno); + int size = DEPRECATED_REGISTER_RAW_SIZE (regno); void *buf = alloca (size); store_signed_integer (buf, size, val); regcache_raw_write (inf_status->registers, regno, buf); diff --git a/gdb/inftarg.c b/gdb/inftarg.c index 7786579..6829400 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -306,7 +306,6 @@ child_files_info (struct target_ops *ignore) attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid)); } -/* ARGSUSED */ static void child_open (char *arg, int from_tty) { @@ -552,7 +551,45 @@ child_core_file_to_sym_file (char *core) */ return NULL; } - + +/* Perform a partial transfer to/from the specified object. For + memory transfers, fall back to the old memory xfer functions. */ + +static LONGEST +child_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, ULONGEST offset, LONGEST len) +{ + switch (object) + { + case TARGET_OBJECT_MEMORY: + if (readbuf) + return child_xfer_memory (offset, readbuf, len, 0/*write*/, + NULL, ops); + if (writebuf) + return child_xfer_memory (offset, readbuf, len, 1/*write*/, + NULL, ops); + return -1; + +#if 0 + case TARGET_OBJECT_UNWIND_TABLE: +#ifndef NATIVE_XFER_UNWIND_TABLE +#define NATIVE_XFER_UNWIND_TABLE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) +#endif + return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf, + offset, len); +#endif + +#if 0 + case TARGET_OBJECT_AUXV: + return native_xfer_auxv (PIDGET (inferior_ptid), readbuf, writebuf, + offset, len); +#endif + + default: + return -1; + } +} #if !defined(CHILD_PID_TO_STR) char * @@ -579,6 +616,7 @@ init_child_ops (void) child_ops.to_store_registers = store_inferior_registers; child_ops.to_prepare_to_store = child_prepare_to_store; child_ops.to_xfer_memory = child_xfer_memory; + child_ops.to_xfer_partial = child_xfer_partial; child_ops.to_files_info = child_files_info; child_ops.to_insert_breakpoint = memory_insert_breakpoint; child_ops.to_remove_breakpoint = memory_remove_breakpoint; diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index f7c2034..224d376 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -84,27 +84,27 @@ fill_gregset (gregset_t *gregsetp, int regno) if ((regno == -1) || (regno == regi)) *(regp + regi) = extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)], - REGISTER_RAW_SIZE (regi)); + DEPRECATED_REGISTER_RAW_SIZE (regi)); if ((regno == -1) || (regno == PC_REGNUM)) *(regp + CTX_EPC) = extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)], - REGISTER_RAW_SIZE (PC_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM)); if ((regno == -1) || (regno == CAUSE_REGNUM)) *(regp + CTX_CAUSE) = extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (CAUSE_REGNUM)], - REGISTER_RAW_SIZE (CAUSE_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (CAUSE_REGNUM)); if ((regno == -1) || (regno == HI_REGNUM)) *(regp + CTX_MDHI) = extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (HI_REGNUM)], - REGISTER_RAW_SIZE (HI_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (HI_REGNUM)); if ((regno == -1) || (regno == LO_REGNUM)) *(regp + CTX_MDLO) = extract_signed_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (LO_REGNUM)], - REGISTER_RAW_SIZE (LO_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (LO_REGNUM)); } /* @@ -147,7 +147,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); - memcpy (to, from, REGISTER_RAW_SIZE (regi)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } @@ -219,7 +219,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, *dstp++ = *srcp++; *dstp++ = *srcp++; *dstp++ = *srcp++; - if (REGISTER_RAW_SIZE (regno) == 4) + if (DEPRECATED_REGISTER_RAW_SIZE (regno) == 4) { /* copying 4 bytes from eight bytes? I don't see how this can be right... */ diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index f6eb50c..0def55f 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -682,16 +682,16 @@ Expression: static int parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; + char *p; + int len; int parsed_float; YYSTYPE *putithere; { - register ULONGEST n = 0; + ULONGEST n = 0; ULONGEST limit, limit_div_base; - register int c; - register int base = input_radix; + int c; + int base = input_radix; struct type *type; @@ -872,7 +872,7 @@ yylex () tokstart = lexptr; /* See if it is a special token of length 3. */ for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (STREQN (tokstart, tokentab3[i].operator, 3)) + if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) { lexptr += 3; yylval.opcode = tokentab3[i].opcode; @@ -881,7 +881,7 @@ yylex () /* See if it is a special token of length 2. */ for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (STREQN (tokstart, tokentab2[i].operator, 2)) + if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) { lexptr += 2; yylval.opcode = tokentab2[i].opcode; @@ -967,7 +967,7 @@ yylex () { /* It's a number. */ int got_dot = 0, got_e = 0, toktype; - register char *p = tokstart; + char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) @@ -1167,9 +1167,9 @@ yylex () } break; case 3: - if (STREQN (tokstart, "int", 3)) + if (strncmp (tokstart, "int", 3) == 0) return INT; - if (STREQN (tokstart, "new", 3)) + if (strncmp (tokstart, "new", 3) == 0) return NEW; break; default: diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 207051e..80a6487 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -1040,6 +1040,15 @@ const struct op_print java_op_print_tab[] = {NULL, 0, 0, 0} }; +const struct exp_descriptor exp_descriptor_java = +{ + print_subexp_standard, + operator_length_standard, + op_name_standard, + dump_subexp_body_standard, + evaluate_subexp_java +}; + const struct language_defn java_language_defn = { "java", /* Language name */ @@ -1048,9 +1057,9 @@ const struct language_defn java_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_java, java_parse, java_error, - evaluate_subexp_java, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ java_emit_char, /* Function to print a single character */ @@ -1070,6 +1079,7 @@ const struct language_defn java_language_defn = 0, /* not c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -87,11 +87,13 @@ gdb_kod_display (char *arg) static void gdb_kod_query (char *arg, char *result, int *maxsiz) { - int bufsiz = 0; + LONGEST bufsiz = 0; - /* Check if current target has remote_query capabilities. - If not, it does not have kod either. */ - if (! current_target.to_query) + /* Check if current target has remote_query capabilities. If not, + it does not have kod either. */ + bufsiz = target_read_partial (¤t_target, TARGET_OBJECT_KOD, + NULL, NULL, 0, 0); + if (bufsiz < 0) { strcpy (result, "ERR: Kernel Object Display not supported by current target\n"); @@ -99,7 +101,6 @@ gdb_kod_query (char *arg, char *result, int *maxsiz) } /* Just get the maximum buffer size. */ - target_query ((int) 'K', 0, 0, &bufsiz); /* Check if *we* were called just for getting the buffer size. */ if (*maxsiz == 0) @@ -119,7 +120,8 @@ gdb_kod_query (char *arg, char *result, int *maxsiz) error ("kod: query argument too long"); /* Send actual request. */ - if (target_query ((int) 'K', arg, result, &bufsiz)) + if (target_read_partial (¤t_target, TARGET_OBJECT_KOD, + arg, result, 0, bufsiz) < 0) strcpy (result, "ERR: remote query failed"); } @@ -136,7 +138,7 @@ kod_set_os (char *arg, int from_tty, struct cmd_list_element *command) the set command passed as a parameter. The clone operation will include (BUG?) any ``set'' command callback, if present. Commands like ``info set'' call all the ``show'' command - callbacks. Unfortunatly, for ``show'' commands cloned from + callbacks. Unfortunately, for ``show'' commands cloned from ``set'', this includes callbacks belonging to ``set'' commands. Making this worse, this only occures if add_show_from_set() is called after add_cmd_sfunc() (BUG?). */ diff --git a/gdb/language.c b/gdb/language.c index bba7ebe..cc89482 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -205,7 +205,7 @@ set_language_command (char *ignore, int from_tty) /* Search the list of languages for a match. */ for (i = 0; i < languages_size; i++) { - if (STREQ (languages[i]->la_name, language)) + if (strcmp (languages[i]->la_name, language) == 0) { /* Found it! Go into manual mode, and use this language. */ if (languages[i]->la_language == language_auto) @@ -253,22 +253,22 @@ show_type_command (char *ignore, int from_tty) static void set_type_command (char *ignore, int from_tty) { - if (STREQ (type, "on")) + if (strcmp (type, "on") == 0) { type_check = type_check_on; type_mode = type_mode_manual; } - else if (STREQ (type, "warn")) + else if (strcmp (type, "warn") == 0) { type_check = type_check_warn; type_mode = type_mode_manual; } - else if (STREQ (type, "off")) + else if (strcmp (type, "off") == 0) { type_check = type_check_off; type_mode = type_mode_manual; } - else if (STREQ (type, "auto")) + else if (strcmp (type, "auto") == 0) { type_mode = type_mode_auto; set_type_range_case (); @@ -299,22 +299,22 @@ show_range_command (char *ignore, int from_tty) static void set_range_command (char *ignore, int from_tty) { - if (STREQ (range, "on")) + if (strcmp (range, "on") == 0) { range_check = range_check_on; range_mode = range_mode_manual; } - else if (STREQ (range, "warn")) + else if (strcmp (range, "warn") == 0) { range_check = range_check_warn; range_mode = range_mode_manual; } - else if (STREQ (range, "off")) + else if (strcmp (range, "off") == 0) { range_check = range_check_off; range_mode = range_mode_manual; } - else if (STREQ (range, "auto")) + else if (strcmp (range, "auto") == 0) { range_mode = range_mode_auto; set_type_range_case (); @@ -1177,6 +1177,15 @@ language_demangle (const struct language_defn *current_language, return NULL; } +/* Return the default string containing the list of characters + delimiting words. This is a reasonable default value that + most languages should be able to use. */ + +char * +default_word_break_characters (void) +{ + return " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-"; +} /* Define the language that is no language. */ @@ -1268,9 +1277,9 @@ const struct language_defn unknown_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, unk_lang_parser, unk_lang_error, - evaluate_subexp_standard, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, @@ -1290,6 +1299,7 @@ const struct language_defn unknown_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -1302,9 +1312,9 @@ const struct language_defn auto_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, unk_lang_parser, unk_lang_error, - evaluate_subexp_standard, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, @@ -1324,6 +1334,7 @@ const struct language_defn auto_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -1335,9 +1346,9 @@ const struct language_defn local_language_defn = range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, unk_lang_parser, unk_lang_error, - evaluate_subexp_standard, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, unk_lang_emit_char, @@ -1357,6 +1368,7 @@ const struct language_defn local_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/language.h b/gdb/language.h index b3c3122..b8c70c2 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -167,6 +167,11 @@ struct language_defn /* Default case sensitivity */ enum case_sensitivity la_case_sensitivity; + /* Definitions related to expression printing, prefixifying, and + dumping */ + + const struct exp_descriptor *la_exp_desc; + /* Parser function. */ int (*la_parser) (void); @@ -175,10 +180,6 @@ struct language_defn void (*la_error) (char *); - /* Evaluate an expression. */ - struct value *(*evaluate_exp) (struct type *, struct expression *, - int *, enum noside); - void (*la_printchar) (int ch, struct ui_file * stream); void (*la_printstr) (struct ui_file * stream, char *string, @@ -266,6 +267,9 @@ struct language_defn /* Type of elements of strings. */ struct type **string_char_type; + /* The list of characters forming word boundaries. */ + char *(*la_word_break_characters) (void); + /* Add fields above this point, so the magic number is always last. */ /* Magic number for compat checking */ @@ -501,4 +505,7 @@ extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc); extern char *language_demangle (const struct language_defn *current_language, const char *mangled, int options); +/* Splitting strings into words. */ +extern char *default_word_break_characters (void); + #endif /* defined (LANGUAGE_H) */ diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index fbf9a09..df91aa7 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -930,7 +930,7 @@ status_callback (struct lwp_info *lp, void *data) static int running_callback (struct lwp_info *lp, void *data) { - return (lp->stopped == 0); + return (lp->stopped == 0 || (lp->status != 0 && lp->resumed)); } /* Count the LWP's that have had events. */ @@ -1183,7 +1183,10 @@ stop_and_resume_callback (struct lwp_info *lp, void *data) /* Resume if the lwp still exists. */ for (ptr = lwp_list; ptr; ptr = ptr->next) if (lp == ptr) - resume_callback (lp, NULL); + { + resume_callback (lp, NULL); + resume_set_callback (lp, NULL); + } } return 0; } diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index 2f290c4..22dc93d 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -235,6 +235,26 @@ linux_corefile_thread_callback (struct lwp_info *ti, void *data) return 0; } +/* Function: linux_do_registers + * + * Records the register state for the corefile note section. + */ + +static char * +linux_do_registers (bfd *obfd, ptid_t ptid, + char *note_data, int *note_size) +{ + registers_changed (); + target_fetch_registers (-1); /* FIXME should not be necessary; + fill_gregset should do it automatically. */ + return linux_do_thread_registers (obfd, + ptid_build (ptid_get_pid (inferior_ptid), + ptid_get_pid (inferior_ptid), + 0), + note_data, note_size); + return note_data; +} + /* Function: linux_make_note_section * * Fills the "to_make_corefile_note" target vector. @@ -277,8 +297,8 @@ linux_make_note_section (bfd *obfd, int *note_size) { /* iterate_over_threads didn't come up with any threads; just use inferior_ptid. */ - note_data = linux_do_thread_registers (obfd, inferior_ptid, - note_data, note_size); + note_data = linux_do_registers (obfd, inferior_ptid, + note_data, note_size); } else { diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c index bbd88b6..b0e2402 100644 --- a/gdb/lynx-nat.c +++ b/gdb/lynx-nat.c @@ -293,12 +293,12 @@ fetch_inferior_registers (int regno) if (errno) perror_with_name ("ptrace(PTRACE_GETREGS)"); - memset (buf, 0, REGISTER_RAW_SIZE (G0_REGNUM)); + memset (buf, 0, DEPRECATED_REGISTER_RAW_SIZE (G0_REGNUM)); supply_register (G0_REGNUM, buf); supply_register (TBR_REGNUM, (char *) &ec.tbr); memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (G1_REGNUM)], &ec.g1, - 4 * REGISTER_RAW_SIZE (G1_REGNUM)); + 4 * DEPRECATED_REGISTER_RAW_SIZE (G1_REGNUM)); for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++) deprecated_register_valid[i] = 1; @@ -309,7 +309,7 @@ fetch_inferior_registers (int regno) supply_register (WIM_REGNUM, (char *) &ec.wim); memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (O0_REGNUM)], ec.o, - 8 * REGISTER_RAW_SIZE (O0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (O0_REGNUM)); for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++) deprecated_register_valid[i] = 1; } @@ -323,13 +323,13 @@ fetch_inferior_registers (int regno) target_read_memory (sp + FRAME_SAVED_I0, &deprecated_registers[DEPRECATED_REGISTER_BYTE (I0_REGNUM)], - 8 * REGISTER_RAW_SIZE (I0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (I0_REGNUM)); for (i = I0_REGNUM; i <= I7_REGNUM; i++) deprecated_register_valid[i] = 1; target_read_memory (sp + FRAME_SAVED_L0, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 8 * REGISTER_RAW_SIZE (L0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++) deprecated_register_valid[i] = 1; } @@ -347,7 +347,7 @@ fetch_inferior_registers (int regno) perror_with_name ("ptrace(PTRACE_GETFPREGS)"); memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs, - 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); + 32 * DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) deprecated_register_valid[i] = 1; @@ -385,7 +385,7 @@ store_inferior_registers (int regno) ec.tbr = read_register (TBR_REGNUM); memcpy (&ec.g1, &deprecated_registers[DEPRECATED_REGISTER_BYTE (G1_REGNUM)], - 4 * REGISTER_RAW_SIZE (G1_REGNUM)); + 4 * DEPRECATED_REGISTER_RAW_SIZE (G1_REGNUM)); ec.psr = read_register (PS_REGNUM); ec.y = read_register (Y_REGNUM); @@ -394,7 +394,7 @@ store_inferior_registers (int regno) ec.wim = read_register (WIM_REGNUM); memcpy (ec.o, &deprecated_registers[DEPRECATED_REGISTER_BYTE (O0_REGNUM)], - 8 * REGISTER_RAW_SIZE (O0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (O0_REGNUM)); errno = 0; retval = ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid), @@ -416,11 +416,11 @@ store_inferior_registers (int regno) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp + FRAME_SAVED_I0, &deprecated_registers[DEPRECATED_REGISTER_BYTE (I0_REGNUM)], - 8 * REGISTER_RAW_SIZE (I0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (I0_REGNUM)); target_write_memory (sp + FRAME_SAVED_L0, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 8 * REGISTER_RAW_SIZE (L0_REGNUM)); + 8 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); } else if (regno >= L0_REGNUM && regno <= I7_REGNUM) { @@ -434,7 +434,7 @@ store_inferior_registers (int regno) + FRAME_SAVED_I0; target_write_memory (sp + regoffset, &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); } } @@ -451,7 +451,7 @@ store_inferior_registers (int regno) perror_with_name ("ptrace(PTRACE_GETFPREGS)"); memcpy (fc.f.fregs, &deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], - 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); + 32 * DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); fc.fsr = read_register (FPS_REGNUM); @@ -521,7 +521,7 @@ fetch_inferior_registers (int regno) ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD; #endif - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) { unsigned int reg; @@ -570,7 +570,7 @@ store_inferior_registers (int regno) ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER; #endif - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) { unsigned int reg; diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index b8dd178..df4a809 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -617,7 +617,7 @@ variable: NAME else { struct minimal_symbol *msymbol; - register char *arg = copy_name ($1); + char *arg = copy_name ($1); msymbol = lookup_minimal_symbol_linkage_or_natural (arg); @@ -672,12 +672,12 @@ static int parse_number (olen) int olen; { - register char *p = lexptr; - register LONGEST n = 0; - register LONGEST prevn = 0; - register int c,i,ischar=0; - register int base = input_radix; - register int len = olen; + char *p = lexptr; + LONGEST n = 0; + LONGEST prevn = 0; + int c,i,ischar=0; + int base = input_radix; + int len = olen; int unsigned_p = number_sign == 1 ? 1 : 0; if(p[len-1] == 'H') @@ -820,11 +820,11 @@ static struct keyword keytab[] = static int yylex () { - register int c; - register int namelen; - register int i; - register char *tokstart; - register char quote; + int c; + int namelen; + int i; + char *tokstart; + char quote; retry: @@ -936,7 +936,7 @@ yylex () { /* It's a number. */ int got_dot = 0, got_e = 0; - register char *p = tokstart; + char *p = tokstart; int toktype; for (++p ;; ++p) diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index a54d188..7fe2e34e 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -415,9 +415,9 @@ const struct language_defn m2_language_defn = range_check_on, type_check_on, case_sensitive_on, + &exp_descriptor_standard, m2_parse, /* parser */ m2_error, /* parser error function */ - evaluate_subexp_standard, m2_printchar, /* Print character constant */ m2_printstr, /* function to print string constant */ m2_emit_char, /* Function to print a single character */ @@ -437,6 +437,7 @@ const struct language_defn m2_language_defn = 0, /* arrays are first-class (not c-style) */ 0, /* String lower bound */ &builtin_type_m2_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c deleted file mode 100644 index 9e3f93b..0000000 --- a/gdb/m3-nat.c +++ /dev/null @@ -1,4566 +0,0 @@ -// 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_DOMAIN, -// 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/m32r-tdep.c b/gdb/m32r-tdep.c index 12a91c2..b2bc71f 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -37,6 +37,7 @@ #include "arch-utils.h" #include "regcache.h" #include "trad-frame.h" +#include "dis-asm.h" #include "gdb_assert.h" @@ -830,11 +831,6 @@ m32r_frame_this_id (struct frame_info *next_frame, /* 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 (deprecated_inside_entry_file (func)) - return; - /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); if (msym_stack && info->base == SYMBOL_VALUE_ADDRESS (msym_stack)) diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 0f3ed0e..e821722 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -894,11 +894,6 @@ m68hc11_frame_this_id (struct frame_info *next_frame, /* 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 (deprecated_inside_entry_file (func)) - 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". */ @@ -1032,9 +1027,9 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file, if (regno == HARD_PC_REGNUM || regno == HARD_SP_REGNUM || regno == SOFT_FP_REGNUM || regno == M68HC12_HARD_PC_REGNUM) - frame_read_unsigned_register (frame, regno, &rval); + rval = get_frame_register_unsigned (frame, regno); else - frame_read_signed_register (frame, regno, &rval); + rval = get_frame_register_signed (frame, regno); if (regno == HARD_A_REGNUM || regno == HARD_B_REGNUM || regno == HARD_CCR_REGNUM || regno == HARD_PAGE_REGNUM) @@ -1049,7 +1044,7 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file, { ULONGEST page; - frame_read_unsigned_register (frame, HARD_PAGE_REGNUM, &page); + page = get_frame_register_unsigned (frame, HARD_PAGE_REGNUM); fprintf_filtered (file, "0x%02x:%04x ", (unsigned) page, (unsigned) rval); } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 72c3b86..e5b41a9 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "dwarf2-frame.h" #include "frame.h" #include "frame-base.h" #include "frame-unwind.h" @@ -1153,6 +1154,10 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Frame unwinder. */ set_gdbarch_unwind_dummy_id (gdbarch, m68k_unwind_dummy_id); set_gdbarch_unwind_pc (gdbarch, m68k_unwind_pc); + + /* Hook in the DWARF CFI frame unwinder. */ + frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + frame_base_set_default (gdbarch, &m68k_frame_base); /* Hook in ABI-specific overrides, if they have been registered. */ diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index e51d20f..1407040 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -54,7 +54,7 @@ #include "target.h" -/* This table must line up with REGISTER_NAMES in tm-m68k.h */ +/* This table must line up with REGISTER_NAME in "m68k-tdep.c". */ static const int regmap[] = { PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7, diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 4f0761d..56ee2a4 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -426,11 +426,10 @@ macro_include (struct macro_source_file *source, struct macro_source_file **link; /* Find the right position in SOURCE's `includes' list for the new - file. Scan until we find the first file we shouldn't follow --- - which is therefore the file we should directly precede --- or - reach the end of the list. */ + file. Skip inclusions at earlier lines, until we find one at the + same line or later --- or until the end of the list. */ for (link = &source->includes; - *link && line < (*link)->included_at_line; + *link && (*link)->included_at_line < line; link = &(*link)->next_included) ; diff --git a/gdb/maint.c b/gdb/maint.c index b55cb67..f7bb194 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -92,7 +92,6 @@ maintenance_command (char *args, int from_tty) } #ifndef _WIN32 -/* ARGSUSED */ static void maintenance_dump_me (char *args, int from_tty) { @@ -191,7 +190,6 @@ maintenance_space_display (char *args, int from_tty) allow_unknown 0. Therefore, its own definition is called only for "maintenance info" with no args. */ -/* ARGSUSED */ static void maintenance_info_command (char *arg, int from_tty) { @@ -353,7 +351,6 @@ print_objfile_section_info (bfd *abfd, } } -/* ARGSUSED */ static void maintenance_info_sections (char *arg, int from_tty) { @@ -399,7 +396,6 @@ maintenance_info_sections (char *arg, int from_tty) } } -/* ARGSUSED */ void maintenance_print_statistics (char *args, int from_tty) { @@ -426,7 +422,6 @@ maintenance_print_architecture (char *args, int from_tty) allow_unknown 0. Therefore, its own definition is called only for "maintenance print" with no args. */ -/* ARGSUSED */ static void maintenance_print_command (char *arg, int from_tty) { diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 342d5a3..0977984 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -265,7 +265,7 @@ analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) deprecated_update_frame_base_hack (dummy, frame); get_frame_extra_info (dummy)->status = 0; get_frame_extra_info (dummy)->framesize = 0; - memset (get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); + memset (deprecated_get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mcore_analyze_prologue (dummy, 0, 0); return dummy; } @@ -590,7 +590,7 @@ mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, int skip_prologue) { if (register_offsets[rn] >= 0) { - get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - register_offsets[rn]; + deprecated_get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - register_offsets[rn]; mcore_insn_debug (("Saved register %s stored at 0x%08x, value=0x%08x\n", mcore_register_names[rn], fi->saved_regs[rn], read_memory_integer (fi->saved_regs[rn], 4))); @@ -639,11 +639,11 @@ mcore_frame_chain (struct frame_info * fi) int fp = get_frame_extra_info (dummy)->fp_regnum; /* Our caller has a frame pointer. */ - if (get_frame_saved_regs (fi)[fp] != 0) + if (deprecated_get_frame_saved_regs (fi)[fp] != 0) { /* The "FP" was saved on the stack. Don't forget to adjust the "FP" with the framesize to get a real FP. */ - callers_addr = read_memory_integer (get_frame_saved_regs (fi)[fp], + callers_addr = read_memory_integer (deprecated_get_frame_saved_regs (fi)[fp], DEPRECATED_REGISTER_SIZE) + get_frame_extra_info (dummy)->framesize; } @@ -726,8 +726,8 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum) get_frame_base (fi))) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), regnum); - else if (get_frame_saved_regs (fi)[regnum] != 0) - return read_memory_integer (get_frame_saved_regs (fi)[regnum], + else if (deprecated_get_frame_saved_regs (fi)[regnum] != 0) + return read_memory_integer (deprecated_get_frame_saved_regs (fi)[regnum], DEPRECATED_REGISTER_SIZE); } @@ -770,11 +770,11 @@ mcore_pop_frame (void) /* Restore any saved registers. */ for (rn = 0; rn < NUM_REGS; rn++) { - if (get_frame_saved_regs (fi)[rn] != 0) + if (deprecated_get_frame_saved_regs (fi)[rn] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (get_frame_saved_regs (fi)[rn], + value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[rn], DEPRECATED_REGISTER_SIZE); write_register (rn, value); } @@ -1057,7 +1057,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* Registers: */ diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 438c0f0..b5c7446 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1522,10 +1522,6 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (t->fBitfield) { int width = AUX_GET_WIDTH (bigend, ax); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* Inhibit core dumps with some cfront generated objects that -// OBSOLETE corrupt the TIR. */ -#endif /* OBSOLETE CFront */ /* Inhibit core dumps if TIR is corrupted. */ if (bs == (int *) NULL) { @@ -1636,7 +1632,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (name[0] == '.' || name[0] == '\0') TYPE_TAG_NAME (tp) = NULL; else if (TYPE_TAG_NAME (tp) == NULL - || !STREQ (TYPE_TAG_NAME (tp), name)) + || strcmp (TYPE_TAG_NAME (tp), name) != 0) TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name), ¤t_objfile->type_obstack); } @@ -3043,22 +3039,6 @@ parse_partial_symbols (struct objfile *objfile) psymtab_language, objfile); p += 1; } -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* The semantics of C++ state that "struct foo { ... }" -// OBSOLETE also defines a typedef for "foo". Unfortuantely, cfront -// OBSOLETE never makes the typedef when translating from C++ to C. -// OBSOLETE We make the typedef here so that "ptype foo" works as -// OBSOLETE expected for cfront translated code. */ -// OBSOLETE else if (psymtab_language == language_cplus) -// OBSOLETE { -// OBSOLETE /* Also a typedef with the same name. */ -// OBSOLETE add_psymbol_to_list (namestring, p - namestring, -// OBSOLETE VAR_DOMAIN, LOC_TYPEDEF, -// OBSOLETE &objfile->static_psymbols, -// OBSOLETE sh.value, 0, -// OBSOLETE psymtab_language, objfile); -// OBSOLETE } -#endif /* OBSOLETE CFront */ } goto check_enum; case 't': @@ -3205,11 +3185,6 @@ parse_partial_symbols (struct objfile *objfile) case '9': case '-': case '#': /* for symbol identification (used in live ranges) */ -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* added to support cfront stabs strings */ -// OBSOLETE case 'Z': /* for definition continuations */ -// OBSOLETE case 'P': /* for prototypes */ -#endif /* OBSOLETE CFront */ continue; case ':': diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 24974c5..4472fe3 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,6 +1,25 @@ +2003-11-06 Andrew Cagney <cagney@redhat.com> + + * mi-cmd-var.c (mi_cmd_var_set_format): Replace STREQN with + strncmp. + +2003-10-24 Andrew Cagney <cagney@redhat.com> + + * tui-out.c: Fix "fortunatly"[sic]. + +2003-10-02 Andrew Cagney <cagney@redhat.com> + + * mi-main.c: Rename REGISTER_RAW_SIZE to + DEPRECATED_REGISTER_RAW_SIZE. + +2003-09-30 Andrew Cagney <cagney@redhat.com> + + * mi-main.c: Rename REGISTER_VIRTUAL_SIZE to + DEPRECATED_REGISTER_VIRTUAL_SIZE. + 2003-09-17 Andrew Cagney <cagney@redhat.com> - * mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE. + * mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE. 2003-09-10 Elena Zannoni <ezannoni@redhat.com> diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 0da6106..114531c 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -189,15 +189,15 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) len = strlen (formspec); - if (STREQN (formspec, "natural", len)) + if (strncmp (formspec, "natural", len) == 0) format = FORMAT_NATURAL; - else if (STREQN (formspec, "binary", len)) + else if (strncmp (formspec, "binary", len) == 0) format = FORMAT_BINARY; - else if (STREQN (formspec, "decimal", len)) + else if (strncmp (formspec, "decimal", len) == 0) format = FORMAT_DECIMAL; - else if (STREQN (formspec, "hexadecimal", len)) + else if (strncmp (formspec, "hexadecimal", len) == 0) format = FORMAT_HEXADECIMAL; - else if (STREQN (formspec, "octal", len)) + else if (strncmp (formspec, "octal", len) == 0) format = FORMAT_OCTAL; else error ("mi_cmd_var_set_format: Unknown display format: must be: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\""); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index a4d0ab2..19eba99 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -406,13 +406,13 @@ register_changed_p (int regnum) return -1; if (memcmp (&old_regs[DEPRECATED_REGISTER_BYTE (regnum)], raw_buffer, - REGISTER_RAW_SIZE (regnum)) == 0) + DEPRECATED_REGISTER_RAW_SIZE (regnum)) == 0) return 0; /* Found a changed register. Return 1. */ memcpy (&old_regs[DEPRECATED_REGISTER_BYTE (regnum)], raw_buffer, - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); return 1; } @@ -544,7 +544,7 @@ get_register (int regnum, int format) raw_buffer, virtual_buffer); } else - memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum)); + memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); if (format == 'r') { @@ -553,10 +553,10 @@ get_register (int regnum, int format) strcpy (buf, "0x"); ptr = buf + 2; - for (j = 0; j < REGISTER_RAW_SIZE (regnum); j++) + for (j = 0; j < DEPRECATED_REGISTER_RAW_SIZE (regnum); j++) { - register int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j - : REGISTER_RAW_SIZE (regnum) - 1 - j; + int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j + : DEPRECATED_REGISTER_RAW_SIZE (regnum) - 1 - j; sprintf (ptr, "%02x", (unsigned char) raw_buffer[idx]); ptr += 2; } @@ -642,7 +642,7 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc) old_chain = make_cleanup (xfree, buffer); store_signed_integer (buffer, DEPRECATED_REGISTER_SIZE, value); /* Write it down */ - deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (regnum), buffer, REGISTER_RAW_SIZE (regnum)); + deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (regnum), buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum)); /* Free the buffer. */ do_cleanups (old_chain); } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 85b0104..c6930e9 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -253,8 +253,9 @@ lookup_minimal_symbol_aux (const char *name, int linkage, case mst_file_data: case mst_file_bss: #ifdef SOFUN_ADDRESS_MAYBE_MISSING - if (sfile == NULL || STREQ (msymbol->filename, sfile)) - found_file_symbol = msymbol; + if (sfile == NULL + || strcmp (msymbol->filename, sfile) == 0) + found_file_symbol = msymbol; #else /* We have neither the ability nor the need to deal with the SFILE parameter. If we find @@ -308,16 +309,13 @@ lookup_minimal_symbol_aux (const char *name, int linkage, /* Look through all the current minimal symbol tables and find the first minimal symbol that matches NAME and has text type. If OBJF - is non-NULL, limit the search to that objfile. If SFILE is non-NULL, - the only file-scope symbols considered will be from that source file - (global symbols are still preferred). Returns a pointer to the minimal - symbol that matches, or NULL if no match is found. + is non-NULL, limit the search to that objfile. Returns a pointer + to the minimal symbol that matches, or NULL if no match is found. This function only searches the mangled (linkage) names. */ struct minimal_symbol * -lookup_minimal_symbol_text (const char *name, const char *sfile, - struct objfile *objf) +lookup_minimal_symbol_text (const char *name, struct objfile *objf) { struct objfile *objfile; struct minimal_symbol *msymbol; @@ -326,15 +324,6 @@ lookup_minimal_symbol_text (const char *name, const char *sfile, unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING - if (sfile != NULL) - { - char *p = strrchr (sfile, '/'); - if (p != NULL) - sfile = p + 1; - } -#endif - for (objfile = object_files; objfile != NULL && found_symbol == NULL; objfile = objfile->next) @@ -352,17 +341,7 @@ lookup_minimal_symbol_text (const char *name, const char *sfile, switch (MSYMBOL_TYPE (msymbol)) { case mst_file_text: -#ifdef SOFUN_ADDRESS_MAYBE_MISSING - if (sfile == NULL || STREQ (msymbol->filename, sfile)) - found_file_symbol = msymbol; -#else - /* We have neither the ability nor the need to - deal with the SFILE parameter. If we find - more than one symbol, just return the latest - one (the user can't expect useful behavior in - that case). */ found_file_symbol = msymbol; -#endif break; default: found_symbol = msymbol; @@ -384,17 +363,15 @@ lookup_minimal_symbol_text (const char *name, const char *sfile, } /* Look through all the current minimal symbol tables and find the - first minimal symbol that matches NAME and is a solib trampoline. If OBJF - is non-NULL, limit the search to that objfile. If SFILE is non-NULL, - the only file-scope symbols considered will be from that source file - (global symbols are still preferred). Returns a pointer to the minimal - symbol that matches, or NULL if no match is found. + first minimal symbol that matches NAME and is a solib trampoline. + If OBJF is non-NULL, limit the search to that objfile. Returns a + pointer to the minimal symbol that matches, or NULL if no match is + found. This function only searches the mangled (linkage) names. */ struct minimal_symbol * lookup_minimal_symbol_solib_trampoline (const char *name, - const char *sfile, struct objfile *objf) { struct objfile *objfile; @@ -403,15 +380,6 @@ lookup_minimal_symbol_solib_trampoline (const char *name, unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING - if (sfile != NULL) - { - char *p = strrchr (sfile, '/'); - if (p != NULL) - sfile = p + 1; - } -#endif - for (objfile = object_files; objfile != NULL && found_symbol == NULL; objfile = objfile->next) @@ -667,7 +635,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address, const char *tempstring = name; if (tempstring[0] == get_symbol_leading_char (objfile->obfd)) ++tempstring; - if (STREQN (tempstring, "__gnu_compiled", 14)) + if (strncmp (tempstring, "__gnu_compiled", 14) == 0) return (NULL); } } @@ -818,10 +786,10 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount, copyfrom = copyto = msymbol; while (copyfrom < msymbol + mcount - 1) { - if (SYMBOL_VALUE_ADDRESS (copyfrom) == - SYMBOL_VALUE_ADDRESS ((copyfrom + 1)) && - (STREQ (SYMBOL_LINKAGE_NAME (copyfrom), - SYMBOL_LINKAGE_NAME ((copyfrom + 1))))) + if (SYMBOL_VALUE_ADDRESS (copyfrom) + == SYMBOL_VALUE_ADDRESS ((copyfrom + 1)) + && strcmp (SYMBOL_LINKAGE_NAME (copyfrom), + SYMBOL_LINKAGE_NAME ((copyfrom + 1))) == 0) { if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown) { @@ -1056,8 +1024,8 @@ find_solib_trampoline_target (CORE_ADDR pc) ALL_MSYMBOLS (objfile, msymbol) { if (MSYMBOL_TYPE (msymbol) == mst_text - && STREQ (SYMBOL_LINKAGE_NAME (msymbol), - SYMBOL_LINKAGE_NAME (tsymbol))) + && strcmp (SYMBOL_LINKAGE_NAME (msymbol), + SYMBOL_LINKAGE_NAME (tsymbol)) == 0) return SYMBOL_VALUE_ADDRESS (msymbol); } } diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 8f31cf2..20ada7b 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -92,7 +92,7 @@ static void supply_32bit_reg (int regnum, const void *addr) { char buf[MAX_REGISTER_SIZE]; - store_signed_integer (buf, REGISTER_RAW_SIZE (regnum), + store_signed_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum), extract_signed_integer (addr, 4)); supply_register (regnum, buf); } @@ -218,13 +218,13 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + regno - FP0_REGNUM); - memcpy (to, from, REGISTER_RAW_SIZE (regno - FP0_REGNUM)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno - FP0_REGNUM)); } else if (regno == FCRCS_REGNUM) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + 32); - memcpy (to, from, REGISTER_RAW_SIZE (regno)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno)); } else if (regno == -1) { @@ -493,13 +493,13 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + regno - FP0_REGNUM); - memcpy (to, from, REGISTER_RAW_SIZE (regno - FP0_REGNUM)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno - FP0_REGNUM)); } else if (regno == FCRCS_REGNUM) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + 32); - memcpy (to, from, REGISTER_RAW_SIZE (regno)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regno)); } else if (regno == -1) { diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c index 0ab3fb1..4c35986 100644 --- a/gdb/mips-nat.c +++ b/gdb/mips-nat.c @@ -83,7 +83,7 @@ fetch_inferior_registers (int regno) for (regno = 1; regno < NUM_REGS; regno++) { regaddr = register_ptrace_addr (regno); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int)) { *(int *) &buf[i] = ptrace (PT_READ_U, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, 0); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 1d120d7..c0d8b08 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -181,9 +181,9 @@ unmake_mips16_addr (CORE_ADDR addr) static LONGEST read_signed_register (int regnum) { - void *buf = alloca (REGISTER_RAW_SIZE (regnum)); + void *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum)); deprecated_read_register_gen (regnum, buf); - return (extract_signed_integer (buf, REGISTER_RAW_SIZE (regnum))); + return (extract_signed_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum))); } static LONGEST @@ -279,7 +279,7 @@ mips_xfer_register (struct regcache *regcache, int reg_num, int length, switch (endian) { case BFD_ENDIAN_BIG: - reg_offset = REGISTER_RAW_SIZE (reg_num) - length; + reg_offset = DEPRECATED_REGISTER_RAW_SIZE (reg_num) - length; break; case BFD_ENDIAN_LITTLE: reg_offset = 0; @@ -325,7 +325,7 @@ mips2_fp_compat (void) { /* MIPS1 and MIPS2 have only 32 bit FPRs, and the FR bit is not meaningful. */ - if (REGISTER_RAW_SIZE (FP0_REGNUM) == 4) + if (DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 4) return 0; #if 0 @@ -624,18 +624,6 @@ struct linked_proc_info } *linked_proc_desc_table = NULL; -void -mips_print_extra_frame_info (struct frame_info *fi) -{ - if (fi - && get_frame_extra_info (fi) - && get_frame_extra_info (fi)->proc_desc - && get_frame_extra_info (fi)->proc_desc->pdr.framereg < NUM_REGS) - printf_filtered (" frame pointer is at %s+%s\n", - REGISTER_NAME (get_frame_extra_info (fi)->proc_desc->pdr.framereg), - paddr_d (get_frame_extra_info (fi)->proc_desc->pdr.frameoffset)); -} - /* Number of bytes of storage in the actual machine representation for register N. NOTE: This indirectly defines the register size transfered by the GDB protocol. */ @@ -654,9 +642,9 @@ mips_register_raw_size (int regnum) NOTE: cagney/2003-06-15: This is so bogus. The register's raw size is changing according to the ABI (FP_REGISTER_DOUBLE). Also, GDB's protocol is defined by a - combination of REGISTER_RAW_SIZE and DEPRECATED_REGISTER_BYTE. */ + combination of DEPRECATED_REGISTER_RAW_SIZE and DEPRECATED_REGISTER_BYTE. */ if (mips64_transfers_32bit_regs_p) - return REGISTER_VIRTUAL_SIZE (regnum); + return DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32 && FP_REGISTER_DOUBLE) /* For MIPS_ABI_N32 (for example) we need 8 byte floating point @@ -679,7 +667,7 @@ mips_register_raw_size (int regnum) /* Register offset in a buffer for each register. FIXME: cagney/2003-06-15: This is so bogus. Instead REGISTER_TYPE - should strictly return the layout of the buffer. Unfortunatly + should strictly return the layout of the buffer. Unfortunately remote.c and the MIPS have come to rely on a custom layout that doesn't 1:1 map onto the register type. */ @@ -717,7 +705,7 @@ mips_register_convertible (int reg_nr) if (mips64_transfers_32bit_regs_p) return 0; else - return (REGISTER_RAW_SIZE (reg_nr) > REGISTER_VIRTUAL_SIZE (reg_nr)); + return (DEPRECATED_REGISTER_RAW_SIZE (reg_nr) > DEPRECATED_REGISTER_VIRTUAL_SIZE (reg_nr)); } static void @@ -726,7 +714,7 @@ mips_register_convert_to_virtual (int n, struct type *virtual_type, { if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) memcpy (virt_buf, - raw_buf + (REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), + raw_buf + (DEPRECATED_REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), TYPE_LENGTH (virtual_type)); else memcpy (virt_buf, @@ -738,9 +726,9 @@ static void mips_register_convert_to_raw (struct type *virtual_type, int n, const char *virt_buf, char *raw_buf) { - memset (raw_buf, 0, REGISTER_RAW_SIZE (n)); + memset (raw_buf, 0, DEPRECATED_REGISTER_RAW_SIZE (n)); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (raw_buf + (REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), + memcpy (raw_buf + (DEPRECATED_REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), virt_buf, TYPE_LENGTH (virtual_type)); else @@ -753,7 +741,7 @@ static int mips_convert_register_p (int regnum, struct type *type) { return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && REGISTER_RAW_SIZE (regnum) == 4 + && DEPRECATED_REGISTER_RAW_SIZE (regnum) == 4 && (regnum) >= FP0_REGNUM && (regnum) < FP0_REGNUM + 32 && TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8); @@ -763,8 +751,8 @@ static void mips_register_to_value (struct frame_info *frame, int regnum, struct type *type, void *to) { - frame_read_register (frame, regnum + 0, (char *) to + 4); - frame_read_register (frame, regnum + 1, (char *) to + 0); + get_frame_register (frame, regnum + 0, (char *) to + 4); + get_frame_register (frame, regnum + 1, (char *) to + 0); } static void @@ -1570,7 +1558,7 @@ mips_find_saved_regs (struct frame_info *fci) t_inst inst; CORE_ADDR *saved_regs; - if (get_frame_saved_regs (fci) != NULL) + if (deprecated_get_frame_saved_regs (fci) != NULL) return; saved_regs = frame_saved_regs_zalloc (fci); @@ -1741,7 +1729,7 @@ mips_find_saved_regs (struct frame_info *fci) stored first leading to the memory order $f[N] and then $f[N+1]. - Unfortunatly, when big-endian the most significant + Unfortunately, when big-endian the most significant part of the double is stored first, and the least significant is stored second. This leads to the registers being ordered in memory as firt $f[N+1] and @@ -2733,7 +2721,7 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) get_frame_base (fci)); set_reg_offset (temp_saved_regs, PC_REGNUM, temp_saved_regs[RA_REGNUM]); - memcpy (get_frame_saved_regs (fci), temp_saved_regs, + memcpy (deprecated_get_frame_saved_regs (fci), temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); } } @@ -2822,18 +2810,12 @@ mips_type_needs_double_align (struct type *type) return 0; } -/* Macros to round N up or down to the next A boundary; - A must be a power of two. */ - -#define ROUND_DOWN(n,a) ((n) & ~((a)-1)) -#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1)) - /* Adjust the address downward (direction of stack growth) so that it is correctly aligned for a new stack frame. */ static CORE_ADDR mips_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) { - return ROUND_DOWN (addr, 16); + return align_down (addr, 16); } static CORE_ADDR @@ -2862,21 +2844,21 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, aligned. For n32 and n64, stack frames need to be 128-bit aligned, so we round to this widest known alignment. */ - sp = ROUND_DOWN (sp, 16); - struct_addr = ROUND_DOWN (struct_addr, 16); + sp = align_down (sp, 16); + struct_addr = align_down (struct_addr, 16); /* Now make space on the stack for the args. We allocate more than necessary for EABI, because the first few arguments are passed in registers, but that's OK. */ for (argnum = 0; argnum < nargs; argnum++) - len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), + len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE); - sp -= ROUND_UP (len, 16); + sp -= align_up (len, 16); if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_eabi_push_dummy_call: sp=0x%s allocated %d\n", - paddr_nz (sp), ROUND_UP (len, 16)); + "mips_eabi_push_dummy_call: sp=0x%s allocated %ld\n", + paddr_nz (sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; @@ -3083,7 +3065,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, only needs to be adjusted when it has been used. */ if (stack_used_p) - stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE); } } if (mips_debug) @@ -3124,19 +3106,19 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, aligned. For n32 and n64, stack frames need to be 128-bit aligned, so we round to this widest known alignment. */ - sp = ROUND_DOWN (sp, 16); - struct_addr = ROUND_DOWN (struct_addr, 16); + sp = align_down (sp, 16); + struct_addr = align_down (struct_addr, 16); /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) - len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), + len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE); - sp -= ROUND_UP (len, 16); + sp -= align_up (len, 16); if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_n32n64_push_dummy_call: sp=0x%s allocated %d\n", - paddr_nz (sp), ROUND_UP (len, 16)); + "mips_n32n64_push_dummy_call: sp=0x%s allocated %ld\n", + paddr_nz (sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; @@ -3314,7 +3296,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, adjusted when it has been used. */ if (stack_used_p) - stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE); } } if (mips_debug) @@ -3355,19 +3337,19 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, aligned. For n32 and n64, stack frames need to be 128-bit aligned, so we round to this widest known alignment. */ - sp = ROUND_DOWN (sp, 16); - struct_addr = ROUND_DOWN (struct_addr, 16); + sp = align_down (sp, 16); + struct_addr = align_down (struct_addr, 16); /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) - len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), + len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE); - sp -= ROUND_UP (len, 16); + sp -= align_up (len, 16); if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o32_push_dummy_call: sp=0x%s allocated %d\n", - paddr_nz (sp), ROUND_UP (len, 16)); + "mips_o32_push_dummy_call: sp=0x%s allocated %ld\n", + paddr_nz (sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; @@ -3478,7 +3460,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, argreg += FP_REGISTER_DOUBLE ? 1 : 2; } /* Reserve space for the FP register. */ - stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (len, MIPS_STACK_ARGSIZE); } else { @@ -3622,7 +3604,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, refered to as their "home". Consequently, space is always allocated. */ - stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE); } } if (mips_debug) @@ -3663,19 +3645,19 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, aligned. For n32 and n64, stack frames need to be 128-bit aligned, so we round to this widest known alignment. */ - sp = ROUND_DOWN (sp, 16); - struct_addr = ROUND_DOWN (struct_addr, 16); + sp = align_down (sp, 16); + struct_addr = align_down (struct_addr, 16); /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) - len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), + len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE); - sp -= ROUND_UP (len, 16); + sp -= align_up (len, 16); if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o64_push_dummy_call: sp=0x%s allocated %d\n", - paddr_nz (sp), ROUND_UP (len, 16)); + "mips_o64_push_dummy_call: sp=0x%s allocated %ld\n", + paddr_nz (sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = A0_REGNUM; @@ -3786,7 +3768,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, argreg += FP_REGISTER_DOUBLE ? 1 : 2; } /* Reserve space for the FP register. */ - stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (len, MIPS_STACK_ARGSIZE); } else { @@ -3930,7 +3912,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, refered to as their "home". Consequently, space is always allocated. */ - stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE); + stack_offset += align_up (partial_len, MIPS_STACK_ARGSIZE); } } if (mips_debug) @@ -3963,18 +3945,18 @@ mips_pop_frame (void) mips_find_saved_regs (frame); for (regnum = 0; regnum < NUM_REGS; regnum++) if (regnum != SP_REGNUM && regnum != PC_REGNUM - && get_frame_saved_regs (frame)[regnum]) + && deprecated_get_frame_saved_regs (frame)[regnum]) { /* Floating point registers must not be sign extended, in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8. */ if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32) write_register (regnum, - read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], + read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], MIPS_SAVED_REGSIZE)); else write_register (regnum, - read_memory_integer (get_frame_saved_regs (frame)[regnum], + read_memory_integer (deprecated_get_frame_saved_regs (frame)[regnum], MIPS_SAVED_REGSIZE)); } @@ -4071,7 +4053,7 @@ static void mips_read_fp_register_single (struct frame_info *frame, int regno, char *rare_buffer) { - int raw_size = REGISTER_RAW_SIZE (regno); + int raw_size = DEPRECATED_REGISTER_RAW_SIZE (regno); char *raw_buffer = alloca (raw_size); if (!frame_register_read (frame, regno, raw_buffer)) @@ -4103,7 +4085,7 @@ static void mips_read_fp_register_double (struct frame_info *frame, int regno, char *rare_buffer) { - int raw_size = REGISTER_RAW_SIZE (regno); + int raw_size = DEPRECATED_REGISTER_RAW_SIZE (regno); if (raw_size == 8 && !mips2_fp_compat ()) { @@ -4142,13 +4124,13 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, double doub, flt1, flt2; /* doubles extracted from raw hex data */ int inv1, inv2, namelen; - raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM)); + raw_buffer = (char *) alloca (2 * DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM)); fprintf_filtered (file, "%s:", REGISTER_NAME (regnum)); fprintf_filtered (file, "%*s", 4 - (int) strlen (REGISTER_NAME (regnum)), ""); - if (REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ()) + if (DEPRECATED_REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ()) { /* 4-byte registers: Print hex and floating. Also print even numbered registers as doubles. */ @@ -4235,7 +4217,7 @@ mips_print_register (struct ui_file *file, struct frame_info *frame, fprintf_filtered (file, ": "); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); + offset = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); else offset = 0; @@ -4303,16 +4285,16 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, if (!frame_register_read (frame, regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); /* pad small registers */ - for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++) + for (byte = 0; byte < (MIPS_REGSIZE - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); byte++) printf_filtered (" "); /* Now print the register value in hex, endian order. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); - byte < REGISTER_RAW_SIZE (regnum); + for (byte = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); + byte < DEPRECATED_REGISTER_RAW_SIZE (regnum); byte++) fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]); else - for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1; + for (byte = DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum) - 1; byte >= 0; byte--) fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[byte]); @@ -4647,7 +4629,7 @@ return_value_location (struct type *valtype, lo->buf_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0; hi->buf_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 0 : 4; lo->reg_offset = ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && REGISTER_RAW_SIZE (FP0_REGNUM) == 8) + && DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 8) ? 4 : 0); hi->reg_offset = lo->reg_offset; lo->reg = FP0_REGNUM + 0; @@ -4660,7 +4642,7 @@ return_value_location (struct type *valtype, /* The floating point value fits in a single floating-point register. */ lo->reg_offset = ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && REGISTER_RAW_SIZE (FP0_REGNUM) == 8 + && DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) == 8 && len == 4) ? 4 : 0); lo->reg = FP0_REGNUM; @@ -4716,7 +4698,7 @@ return_value_location (struct type *valtype, } } if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && REGISTER_RAW_SIZE (regnum) == 8 + && DEPRECATED_REGISTER_RAW_SIZE (regnum) == 8 && MIPS_SAVED_REGSIZE == 4) { /* Account for the fact that only the least-signficant part @@ -4784,14 +4766,14 @@ mips_eabi_store_return_value (struct type *valtype, char *valbuf) memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (lo.reg), raw_buffer, - REGISTER_RAW_SIZE (lo.reg)); + DEPRECATED_REGISTER_RAW_SIZE (lo.reg)); if (hi.len > 0) { memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (hi.reg), raw_buffer, - REGISTER_RAW_SIZE (hi.reg)); + DEPRECATED_REGISTER_RAW_SIZE (hi.reg)); } } @@ -4806,14 +4788,14 @@ mips_o64_store_return_value (struct type *valtype, char *valbuf) memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + lo.reg_offset, valbuf + lo.buf_offset, lo.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (lo.reg), raw_buffer, - REGISTER_RAW_SIZE (lo.reg)); + DEPRECATED_REGISTER_RAW_SIZE (lo.reg)); if (hi.len > 0) { memset (raw_buffer, 0, sizeof (raw_buffer)); memcpy (raw_buffer + hi.reg_offset, valbuf + hi.buf_offset, hi.len); deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (hi.reg), raw_buffer, - REGISTER_RAW_SIZE (hi.reg)); + DEPRECATED_REGISTER_RAW_SIZE (hi.reg)); } } @@ -4908,9 +4890,9 @@ mips_o32_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += REGISTER_RAW_SIZE (regnum), regnum++) + offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) { - int xfer = REGISTER_RAW_SIZE (regnum); + int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -5019,9 +5001,9 @@ mips_n32n64_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += REGISTER_RAW_SIZE (regnum), regnum++) + offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) { - int xfer = REGISTER_RAW_SIZE (regnum); + int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -5039,9 +5021,9 @@ mips_n32n64_xfer_return_value (struct type *type, int regnum; for (offset = 0, regnum = V0_REGNUM; offset < TYPE_LENGTH (type); - offset += REGISTER_RAW_SIZE (regnum), regnum++) + offset += DEPRECATED_REGISTER_RAW_SIZE (regnum), regnum++) { - int xfer = REGISTER_RAW_SIZE (regnum); + int xfer = DEPRECATED_REGISTER_RAW_SIZE (regnum); int pos = 0; if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; @@ -6047,11 +6029,8 @@ mips_gdbarch_init (struct gdbarch_info info, /* MIPS version of register names. NOTE: At present the MIPS register name management is part way between the old - - #undef/#define REGISTER_NAMES and the new REGISTER_NAME(nr). + #undef/#define MIPS_REGISTER_NAMES and the new REGISTER_NAME(nr). Further work on it is required. */ - /* NOTE: many targets (esp. embedded) do not go thru the - gdbarch_register_name vector at all, instead bypassing it - by defining REGISTER_NAMES. */ set_gdbarch_register_name (gdbarch, mips_register_name); set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); @@ -6065,7 +6044,6 @@ mips_gdbarch_init (struct gdbarch_info info, /* There's a mess in stack frame creation. See comments in blockframe.c near reference to DEPRECATED_INIT_FRAME_PC_FIRST. */ set_gdbarch_deprecated_init_frame_pc_first (gdbarch, mips_init_frame_pc_first); - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); /* Map debug register numbers onto internal register numbers. */ set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); @@ -6370,9 +6348,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: PRID_REGNUM = %d\n", PRID_REGNUM); fprintf_unfiltered (file, - "mips_dump_tdep: PRINT_EXTRA_FRAME_INFO # %s\n", - XSTRING (PRINT_EXTRA_FRAME_INFO (FRAME))); - fprintf_unfiltered (file, "mips_dump_tdep: PROC_DESC_IS_DUMMY = function?\n"); fprintf_unfiltered (file, "mips_dump_tdep: PROC_FRAME_ADJUST = function?\n"); @@ -6402,12 +6377,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: RA_REGNUM = %d\n", RA_REGNUM); - fprintf_unfiltered (file, - "mips_dump_tdep: REGISTER_NAMES = delete?\n"); - fprintf_unfiltered (file, - "mips_dump_tdep: ROUND_DOWN = function?\n"); - fprintf_unfiltered (file, - "mips_dump_tdep: ROUND_UP = function?\n"); #ifdef SAVED_BYTES fprintf_unfiltered (file, "mips_dump_tdep: SAVED_BYTES = %d\n", @@ -6511,11 +6480,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: VM_MIN_ADDRESS = %ld\n", (long) VM_MIN_ADDRESS); -#ifdef VX_NUM_REGS - fprintf_unfiltered (file, - "mips_dump_tdep: VX_NUM_REGS = %d (used?)\n", - VX_NUM_REGS); -#endif fprintf_unfiltered (file, "mips_dump_tdep: ZERO_REGNUM = %d\n", ZERO_REGNUM); diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c deleted file mode 100644 index f1fd859..0000000 --- a/gdb/mipsm3-nat.c +++ /dev/null @@ -1,386 +0,0 @@ -// 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/mipsv4-nat.c b/gdb/mipsv4-nat.c index 1c75389..686d256 100644 --- a/gdb/mipsv4-nat.c +++ b/gdb/mipsv4-nat.c @@ -127,7 +127,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); - memcpy (to, from, REGISTER_RAW_SIZE (regi)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } diff --git a/gdb/mn10200-tdep.c b/gdb/mn10200-tdep.c deleted file mode 100644 index a484f02a..0000000 --- a/gdb/mn10200-tdep.c +++ /dev/null @@ -1,899 +0,0 @@ -// OBSOLETE /* Target-dependent code for the Matsushita MN10200 for GDB, the GNU debugger. -// OBSOLETE -// OBSOLETE Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software -// OBSOLETE 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 "frame.h" -// OBSOLETE #include "inferior.h" -// OBSOLETE #include "target.h" -// OBSOLETE #include "value.h" -// OBSOLETE #include "bfd.h" -// OBSOLETE #include "gdb_string.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "symfile.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE -// OBSOLETE /* Should call_function allocate stack space for a struct return? */ -// OBSOLETE int -// OBSOLETE mn10200_use_struct_convention (int gcc_p, struct type *type) -// OBSOLETE { -// OBSOLETE return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8); -// OBSOLETE } -// OBSOLETE /* *INDENT-OFF* */ -// OBSOLETE /* The main purpose of this file is dealing with prologues to extract -// OBSOLETE information about stack frames and saved registers. -// OBSOLETE -// OBSOLETE For reference here's how prologues look on the mn10200: -// OBSOLETE -// OBSOLETE With frame pointer: -// OBSOLETE mov fp,a0 -// OBSOLETE mov sp,fp -// OBSOLETE add <size>,sp -// OBSOLETE Register saves for d2, d3, a1, a2 as needed. Saves start -// OBSOLETE at fp - <size> + <outgoing_args_size> and work towards higher -// OBSOLETE addresses. Note that the saves are actually done off the stack -// OBSOLETE pointer in the prologue! This makes for smaller code and easier -// OBSOLETE prologue scanning as the displacement fields will unlikely -// OBSOLETE be more than 8 bits! -// OBSOLETE -// OBSOLETE Without frame pointer: -// OBSOLETE add <size>,sp -// OBSOLETE Register saves for d2, d3, a1, a2 as needed. Saves start -// OBSOLETE at sp + <outgoing_args_size> and work towards higher addresses. -// OBSOLETE -// OBSOLETE Out of line prologue: -// OBSOLETE add <local size>,sp -- optional -// OBSOLETE jsr __prologue -// OBSOLETE add <outgoing_size>,sp -- optional -// OBSOLETE -// OBSOLETE The stack pointer remains constant throughout the life of most -// OBSOLETE functions. As a result the compiler will usually omit the -// OBSOLETE frame pointer, so we must handle frame pointerless functions. */ -// OBSOLETE -// OBSOLETE /* Analyze the prologue to determine where registers are saved, -// OBSOLETE the end of the prologue, etc etc. Return the end of the prologue -// OBSOLETE scanned. -// OBSOLETE -// OBSOLETE We store into FI (if non-null) several tidbits of information: -// OBSOLETE -// OBSOLETE * stack_size -- size of this stack frame. Note that if we stop in -// OBSOLETE certain parts of the prologue/epilogue we may claim the size of the -// OBSOLETE current frame is zero. This happens when the current frame has -// OBSOLETE not been allocated yet or has already been deallocated. -// OBSOLETE -// OBSOLETE * fsr -- Addresses of registers saved in the stack by this frame. -// OBSOLETE -// OBSOLETE * status -- A (relatively) generic status indicator. It's a bitmask -// OBSOLETE with the following bits: -// OBSOLETE -// OBSOLETE MY_FRAME_IN_SP: The base of the current frame is actually in -// OBSOLETE the stack pointer. This can happen for frame pointerless -// OBSOLETE functions, or cases where we're stopped in the prologue/epilogue -// OBSOLETE itself. For these cases mn10200_analyze_prologue will need up -// OBSOLETE update fi->frame before returning or analyzing the register -// OBSOLETE save instructions. -// OBSOLETE -// OBSOLETE MY_FRAME_IN_FP: The base of the current frame is in the -// OBSOLETE frame pointer register ($a2). -// OBSOLETE -// OBSOLETE CALLER_A2_IN_A0: $a2 from the caller's frame is temporarily -// OBSOLETE in $a0. This can happen if we're stopped in the prologue. -// OBSOLETE -// OBSOLETE NO_MORE_FRAMES: Set this if the current frame is "start" or -// OBSOLETE if the first instruction looks like mov <imm>,sp. This tells -// OBSOLETE frame chain to not bother trying to unwind past this frame. */ -// OBSOLETE /* *INDENT-ON* */ -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE -// OBSOLETE #define MY_FRAME_IN_SP 0x1 -// OBSOLETE #define MY_FRAME_IN_FP 0x2 -// OBSOLETE #define CALLER_A2_IN_A0 0x4 -// OBSOLETE #define NO_MORE_FRAMES 0x8 -// OBSOLETE -// OBSOLETE static CORE_ADDR -// OBSOLETE mn10200_analyze_prologue (struct frame_info *fi, CORE_ADDR pc) -// OBSOLETE { -// OBSOLETE CORE_ADDR func_addr, func_end, addr, stop; -// OBSOLETE CORE_ADDR stack_size = 0; -// OBSOLETE unsigned char buf[4]; -// OBSOLETE int status; -// OBSOLETE char *name; -// OBSOLETE int out_of_line_prologue = 0; -// OBSOLETE -// OBSOLETE /* Use the PC in the frame if it's provided to look up the -// OBSOLETE start of this function. */ -// OBSOLETE pc = (fi ? get_frame_pc (fi) : pc); -// OBSOLETE -// OBSOLETE /* Find the start of this function. */ -// OBSOLETE status = find_pc_partial_function (pc, &name, &func_addr, &func_end); -// OBSOLETE -// OBSOLETE /* Do nothing if we couldn't find the start of this function or if we're -// OBSOLETE stopped at the first instruction in the prologue. */ -// OBSOLETE if (status == 0) -// OBSOLETE return pc; -// OBSOLETE -// OBSOLETE /* If we're in start, then give up. */ -// OBSOLETE if (strcmp (name, "start") == 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE fi->status = NO_MORE_FRAMES; -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* At the start of a function our frame is in the stack pointer. */ -// OBSOLETE if (fi) -// OBSOLETE fi->status = MY_FRAME_IN_SP; -// OBSOLETE -// OBSOLETE /* If we're physically on an RTS instruction, then our frame has already -// OBSOLETE been deallocated. -// OBSOLETE -// OBSOLETE fi->frame is bogus, we need to fix it. */ -// OBSOLETE if (fi && get_frame_pc (fi) + 1 == func_end) -// OBSOLETE { -// OBSOLETE status = target_read_memory (get_frame_pc (fi), buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (buf[0] == 0xfe) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Similarly if we're stopped on the first insn of a prologue as our -// OBSOLETE frame hasn't been allocated yet. */ -// OBSOLETE if (fi && get_frame_pc (fi) == func_addr) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return get_frame_pc (fi); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Figure out where to stop scanning. */ -// OBSOLETE stop = fi ? get_frame_pc (fi) : func_end; -// OBSOLETE -// OBSOLETE /* Don't walk off the end of the function. */ -// OBSOLETE stop = stop > func_end ? func_end : stop; -// OBSOLETE -// OBSOLETE /* Start scanning on the first instruction of this function. */ -// OBSOLETE addr = func_addr; -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && fi->status & MY_FRAME_IN_SP) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* First see if this insn sets the stack pointer; if so, it's something -// OBSOLETE we won't understand, so quit now. */ -// OBSOLETE if (buf[0] == 0xdf -// OBSOLETE || (buf[0] == 0xf4 && buf[1] == 0x77)) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE fi->status = NO_MORE_FRAMES; -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now see if we have a frame pointer. -// OBSOLETE -// OBSOLETE Search for mov a2,a0 (0xf278) -// OBSOLETE then mov a3,a2 (0xf27e). */ -// OBSOLETE -// OBSOLETE if (buf[0] == 0xf2 && buf[1] == 0x78) -// OBSOLETE { -// OBSOLETE /* Our caller's $a2 will be found in $a0 now. Note it for -// OBSOLETE our callers. */ -// OBSOLETE if (fi) -// OBSOLETE fi->status |= CALLER_A2_IN_A0; -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE /* We still haven't allocated our local stack. Handle this -// OBSOLETE as if we stopped on the first or last insn of a function. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xf2 && buf[1] == 0x7e) -// OBSOLETE { -// OBSOLETE addr += 2; -// OBSOLETE -// OBSOLETE /* Our frame pointer is valid now. */ -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->status |= MY_FRAME_IN_FP; -// OBSOLETE fi->status &= ~MY_FRAME_IN_SP; -// OBSOLETE } -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Next we should allocate the local frame. -// OBSOLETE -// OBSOLETE Search for add imm8,a3 (0xd3XX) -// OBSOLETE or add imm16,a3 (0xf70bXXXX) -// OBSOLETE or add imm24,a3 (0xf467XXXXXX). -// OBSOLETE -// OBSOLETE If none of the above was found, then this prologue has -// OBSOLETE no stack, and therefore can't have any register saves, -// OBSOLETE so quit now. */ -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xd3) -// OBSOLETE { -// OBSOLETE stack_size = extract_signed_integer (&buf[1], 1); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf7 && buf[1] == 0x0b) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE stack_size = extract_signed_integer (buf, 2); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 4; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0x67) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE stack_size = extract_signed_integer (buf, 3); -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size = stack_size; -// OBSOLETE addr += 5; -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - stack_size); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now see if we have a call to __prologue for an out of line -// OBSOLETE prologue. */ -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE -// OBSOLETE /* First check for 16bit pc-relative call to __prologue. */ -// OBSOLETE if (buf[0] == 0xfd) -// OBSOLETE { -// OBSOLETE CORE_ADDR temp; -// OBSOLETE status = target_read_memory (addr + 1, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Get the PC this instruction will branch to. */ -// OBSOLETE temp = (extract_signed_integer (buf, 2) + addr + 3) & 0xffffff; -// OBSOLETE -// OBSOLETE /* Get the name of the function at the target address. */ -// OBSOLETE status = find_pc_partial_function (temp, &name, NULL, NULL); -// OBSOLETE if (status == 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Note if it is an out of line prologue. */ -// OBSOLETE out_of_line_prologue = (strcmp (name, "__prologue") == 0); -// OBSOLETE -// OBSOLETE /* This sucks up 3 bytes of instruction space. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE addr += 3; -// OBSOLETE -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE { -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE /* Now check for the 24bit pc-relative call to __prologue. */ -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0xe1) -// OBSOLETE { -// OBSOLETE CORE_ADDR temp; -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Get the PC this instruction will branch to. */ -// OBSOLETE temp = (extract_signed_integer (buf, 3) + addr + 5) & 0xffffff; -// OBSOLETE -// OBSOLETE /* Get the name of the function at the target address. */ -// OBSOLETE status = find_pc_partial_function (temp, &name, NULL, NULL); -// OBSOLETE if (status == 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp ()); -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Note if it is an out of line prologue. */ -// OBSOLETE out_of_line_prologue = (strcmp (name, "__prologue") == 0); -// OBSOLETE -// OBSOLETE /* This sucks up 5 bytes of instruction space. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE addr += 5; -// OBSOLETE -// OBSOLETE if (addr >= stop) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP)) -// OBSOLETE { -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Now actually handle the out of line prologue. */ -// OBSOLETE if (out_of_line_prologue) -// OBSOLETE { -// OBSOLETE int outgoing_args_size = 0; -// OBSOLETE -// OBSOLETE /* First adjust the stack size for this function. The out of -// OBSOLETE line prologue saves 4 registers (16bytes of data). */ -// OBSOLETE if (fi) -// OBSOLETE fi->stack_size -= 16; -// OBSOLETE -// OBSOLETE /* Update fi->frame if necessary. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE -// OBSOLETE /* After the out of line prologue, there may be another -// OBSOLETE stack adjustment for the outgoing arguments. -// OBSOLETE -// OBSOLETE Search for add imm8,a3 (0xd3XX) -// OBSOLETE or add imm16,a3 (0xf70bXXXX) -// OBSOLETE or add imm24,a3 (0xf467XXXXXX). */ -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (buf[0] == 0xd3) -// OBSOLETE { -// OBSOLETE outgoing_args_size = extract_signed_integer (&buf[1], 1); -// OBSOLETE addr += 2; -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf7 && buf[1] == 0x0b) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE outgoing_args_size = extract_signed_integer (buf, 2); -// OBSOLETE addr += 4; -// OBSOLETE } -// OBSOLETE else if (buf[0] == 0xf4 && buf[1] == 0x67) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 3); -// OBSOLETE if (status != 0) -// OBSOLETE { -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE outgoing_args_size = extract_signed_integer (buf, 3); -// OBSOLETE addr += 5; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE outgoing_args_size = 0; -// OBSOLETE -// OBSOLETE /* Now that we know the size of the outgoing arguments, fix -// OBSOLETE fi->frame again if this is the innermost frame. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL) -// OBSOLETE deprecated_update_frame_base_hack (fi, get_frame_base (fi) - outgoing_args_size); -// OBSOLETE -// OBSOLETE /* Note the register save information and update the stack -// OBSOLETE size for this frame too. */ -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4; -// OBSOLETE fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8; -// OBSOLETE fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12; -// OBSOLETE fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16; -// OBSOLETE fi->stack_size += outgoing_args_size; -// OBSOLETE } -// OBSOLETE /* There can be no more prologue insns, so return now. */ -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* At this point fi->frame needs to be correct. -// OBSOLETE -// OBSOLETE If MY_FRAME_IN_SP is set and we're the innermost frame, then we -// OBSOLETE need to fix fi->frame so that backtracing, find_frame_saved_regs, -// OBSOLETE etc work correctly. */ -// OBSOLETE if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP) != 0) -// OBSOLETE deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size); -// OBSOLETE -// OBSOLETE /* And last we have the register saves. These are relatively -// OBSOLETE simple because they're physically done off the stack pointer, -// OBSOLETE and thus the number of different instructions we need to -// OBSOLETE check is greatly reduced because we know the displacements -// OBSOLETE will be small. -// OBSOLETE -// OBSOLETE Search for movx d2,(X,a3) (0xf55eXX) -// OBSOLETE then movx d3,(X,a3) (0xf55fXX) -// OBSOLETE then mov a1,(X,a3) (0x5dXX) No frame pointer case -// OBSOLETE then mov a2,(X,a3) (0x5eXX) No frame pointer case -// OBSOLETE or mov a0,(X,a3) (0x5cXX) Frame pointer case. */ -// OBSOLETE -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE if (buf[0] == 0xf5 && buf[1] == 0x5e) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[2] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 3; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0xf5 && buf[1] == 0x5f) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 2, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[3] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 3; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0x5d) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 1, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[5] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE } -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE status = target_read_memory (addr, buf, 2); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE if (buf[0] == 0x5e || buf[0] == 0x5c) -// OBSOLETE { -// OBSOLETE if (fi) -// OBSOLETE { -// OBSOLETE status = target_read_memory (addr + 1, buf, 1); -// OBSOLETE if (status != 0) -// OBSOLETE return addr; -// OBSOLETE fi->fsr.regs[6] = (get_frame_base (fi) + stack_size -// OBSOLETE + extract_signed_integer (buf, 1)); -// OBSOLETE fi->status &= ~CALLER_A2_IN_A0; -// OBSOLETE } -// OBSOLETE addr += 2; -// OBSOLETE if (addr >= stop) -// OBSOLETE return addr; -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE return addr; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: frame_chain -// OBSOLETE Figure out and return the caller's frame pointer given current -// OBSOLETE frame_info struct. -// OBSOLETE -// OBSOLETE We don't handle dummy frames yet but we would probably just return the -// OBSOLETE stack pointer that was in use at the time the function call was made? */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_frame_chain (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE struct frame_info *dummy_frame = deprecated_frame_xmalloc (); -// OBSOLETE struct cleanup *old_chain = make_cleanup (xfree, dummy_frame); -// OBSOLETE CORE_ADDR ret; -// OBSOLETE -// OBSOLETE /* Walk through the prologue to determine the stack size, -// OBSOLETE location of saved registers, end of the prologue, etc. */ -// OBSOLETE if (fi->status == 0) -// OBSOLETE mn10200_analyze_prologue (fi, (CORE_ADDR) 0); -// OBSOLETE -// OBSOLETE /* Quit now if mn10200_analyze_prologue set NO_MORE_FRAMES. */ -// OBSOLETE if (fi->status & NO_MORE_FRAMES) -// OBSOLETE return 0; -// OBSOLETE -// OBSOLETE /* Now that we've analyzed our prologue, determine the frame -// OBSOLETE pointer for our caller. -// OBSOLETE -// OBSOLETE If our caller has a frame pointer, then we need to -// OBSOLETE find the entry value of $a2 to our function. -// OBSOLETE -// OBSOLETE If CALLER_A2_IN_A0, then the chain is in $a0. -// OBSOLETE -// OBSOLETE If fsr.regs[6] is nonzero, then it's at the memory -// OBSOLETE location pointed to by fsr.regs[6]. -// OBSOLETE -// OBSOLETE Else it's still in $a2. -// OBSOLETE -// OBSOLETE If our caller does not have a frame pointer, then his -// OBSOLETE frame base is fi->frame + -caller's stack size + 4. */ -// OBSOLETE -// OBSOLETE /* The easiest way to get that info is to analyze our caller's frame. -// OBSOLETE -// OBSOLETE So we set up a dummy frame and call mn10200_analyze_prologue to -// OBSOLETE find stuff for us. */ -// OBSOLETE deprecated_update_frame_pc_hack (dummy_frame, FRAME_SAVED_PC (fi)); -// OBSOLETE deprecated_update_frame_base_hack (dummy_frame, get_frame_base (fi)); -// OBSOLETE memset (dummy_frame->fsr.regs, '\000', sizeof dummy_frame->fsr.regs); -// OBSOLETE dummy_frame->status = 0; -// OBSOLETE dummy_frame->stack_size = 0; -// OBSOLETE mn10200_analyze_prologue (dummy_frame, 0); -// OBSOLETE -// OBSOLETE if (dummy_frame->status & MY_FRAME_IN_FP) -// OBSOLETE { -// OBSOLETE /* Our caller has a frame pointer. So find the frame in $a2, $a0, -// OBSOLETE or in the stack. */ -// OBSOLETE if (fi->fsr.regs[6]) -// OBSOLETE ret = (read_memory_integer (fi->fsr.regs[FP_REGNUM], REGISTER_SIZE) -// OBSOLETE & 0xffffff); -// OBSOLETE else if (fi->status & CALLER_A2_IN_A0) -// OBSOLETE ret = read_register (4); -// OBSOLETE else -// OBSOLETE ret = read_register (FP_REGNUM); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Our caller does not have a frame pointer. So his frame starts -// OBSOLETE at the base of our frame (fi->frame) + <his size> + 4 (saved pc). */ -// OBSOLETE ret = get_frame_base (fi) + -dummy_frame->stack_size + 4; -// OBSOLETE } -// OBSOLETE do_cleanups (old_chain); -// OBSOLETE return ret; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: skip_prologue -// OBSOLETE Return the address of the first inst past the prologue of the function. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_skip_prologue (CORE_ADDR pc) -// OBSOLETE { -// OBSOLETE /* We used to check the debug symbols, but that can lose if -// OBSOLETE we have a null prologue. */ -// OBSOLETE return mn10200_analyze_prologue (NULL, pc); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: pop_frame -// OBSOLETE This routine gets called when either the user uses the `return' -// OBSOLETE command, or the call dummy breakpoint gets hit. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE mn10200_pop_frame (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE int regnum; -// OBSOLETE -// OBSOLETE if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), -// OBSOLETE get_frame_base (frame), -// OBSOLETE get_frame_base (frame))) -// OBSOLETE generic_pop_dummy_frame (); -// OBSOLETE else -// OBSOLETE { -// OBSOLETE write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); -// OBSOLETE -// OBSOLETE /* Restore any saved registers. */ -// OBSOLETE for (regnum = 0; regnum < NUM_REGS; regnum++) -// OBSOLETE if (frame->fsr.regs[regnum] != 0) -// OBSOLETE { -// OBSOLETE ULONGEST value; -// OBSOLETE -// OBSOLETE value = read_memory_unsigned_integer (frame->fsr.regs[regnum], -// OBSOLETE REGISTER_RAW_SIZE (regnum)); -// OBSOLETE write_register (regnum, value); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Actually cut back the stack. */ -// OBSOLETE write_register (SP_REGNUM, get_frame_base (frame)); -// OBSOLETE -// OBSOLETE /* Don't we need to set the PC?!? XXX FIXME. */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Throw away any cached frame information. */ -// OBSOLETE flush_cached_frames (); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: push_arguments -// OBSOLETE Setup arguments for a call to the target. Arguments go in -// OBSOLETE order on the stack. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_push_arguments (int nargs, struct value **args, CORE_ADDR sp, -// OBSOLETE unsigned char struct_return, CORE_ADDR struct_addr) -// OBSOLETE { -// OBSOLETE int argnum = 0; -// OBSOLETE int len = 0; -// OBSOLETE int stack_offset = 0; -// OBSOLETE int regsused = struct_return ? 1 : 0; -// OBSOLETE -// OBSOLETE /* This should be a nop, but align the stack just in case something -// OBSOLETE went wrong. Stacks are two byte aligned on the mn10200. */ -// OBSOLETE sp &= ~1; -// OBSOLETE -// OBSOLETE /* Now make space on the stack for the args. -// OBSOLETE -// OBSOLETE XXX This doesn't appear to handle pass-by-invisible reference -// OBSOLETE arguments. */ -// OBSOLETE for (argnum = 0; argnum < nargs; argnum++) -// OBSOLETE { -// OBSOLETE int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1; -// OBSOLETE -// OBSOLETE /* If we've used all argument registers, then this argument is -// OBSOLETE pushed. */ -// OBSOLETE if (regsused >= 2 || arg_length > 4) -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE len += arg_length; -// OBSOLETE } -// OBSOLETE /* We know we've got some arg register space left. If this argument -// OBSOLETE will fit entirely in regs, then put it there. */ -// OBSOLETE else if (arg_length <= 2 -// OBSOLETE || TYPE_CODE (VALUE_TYPE (args[argnum])) == TYPE_CODE_PTR) -// OBSOLETE { -// OBSOLETE regsused++; -// OBSOLETE } -// OBSOLETE else if (regsused == 0) -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE len += arg_length; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Allocate stack space. */ -// OBSOLETE sp -= len; -// OBSOLETE -// OBSOLETE regsused = struct_return ? 1 : 0; -// OBSOLETE /* Push all arguments onto the stack. */ -// OBSOLETE for (argnum = 0; argnum < nargs; argnum++) -// OBSOLETE { -// OBSOLETE int len; -// OBSOLETE char *val; -// OBSOLETE -// OBSOLETE /* XXX Check this. What about UNIONS? */ -// OBSOLETE if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT -// OBSOLETE && TYPE_LENGTH (VALUE_TYPE (*args)) > 8) -// OBSOLETE { -// OBSOLETE /* XXX Wrong, we want a pointer to this argument. */ -// OBSOLETE len = TYPE_LENGTH (VALUE_TYPE (*args)); -// OBSOLETE val = (char *) VALUE_CONTENTS (*args); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE len = TYPE_LENGTH (VALUE_TYPE (*args)); -// OBSOLETE val = (char *) VALUE_CONTENTS (*args); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (regsused < 2 -// OBSOLETE && (len <= 2 -// OBSOLETE || TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_PTR)) -// OBSOLETE { -// OBSOLETE write_register (regsused, extract_unsigned_integer (val, 4)); -// OBSOLETE regsused++; -// OBSOLETE } -// OBSOLETE else if (regsused == 0 && len == 4) -// OBSOLETE { -// OBSOLETE write_register (regsused, extract_unsigned_integer (val, 2)); -// OBSOLETE write_register (regsused + 1, extract_unsigned_integer (val + 2, 2)); -// OBSOLETE regsused = 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regsused = 2; -// OBSOLETE while (len > 0) -// OBSOLETE { -// OBSOLETE write_memory (sp + stack_offset, val, 2); -// OBSOLETE -// OBSOLETE len -= 2; -// OBSOLETE val += 2; -// OBSOLETE stack_offset += 2; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE args++; -// OBSOLETE } -// OBSOLETE -// OBSOLETE return sp; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: push_return_address (pc) -// OBSOLETE Set up the return address for the inferior function call. -// OBSOLETE Needed for targets where we don't actually execute a JSR/BSR instruction */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_push_return_address (CORE_ADDR pc, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE unsigned char buf[4]; -// OBSOLETE -// OBSOLETE store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ()); -// OBSOLETE write_memory (sp - 4, buf, 4); -// OBSOLETE return sp - 4; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: store_struct_return (addr,sp) -// OBSOLETE Store the structure value return address for an inferior function -// OBSOLETE call. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE /* The structure return address is passed as the first argument. */ -// OBSOLETE write_register (0, addr); -// OBSOLETE return sp; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: frame_saved_pc -// OBSOLETE Find the caller of this frame. We do this by seeing if RP_REGNUM -// OBSOLETE is saved in the stack anywhere, otherwise we get it from the -// OBSOLETE registers. If the inner frame is a dummy frame, return its PC -// OBSOLETE instead of RP, because that's where "caller" of the dummy-frame -// OBSOLETE will be found. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE mn10200_frame_saved_pc (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE /* The saved PC will always be at the base of the current frame. */ -// OBSOLETE return (read_memory_integer (get_frame_base (fi), REGISTER_SIZE) & 0xffffff); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Function: init_extra_frame_info -// OBSOLETE Setup the frame's frame pointer, pc, and frame addresses for saved -// OBSOLETE registers. Most of the work is done in mn10200_analyze_prologue(). -// OBSOLETE -// OBSOLETE Note that when we are called for the last frame (currently active frame), -// OBSOLETE that get_frame_pc (fi) and fi->frame will already be setup. However, fi->frame will -// OBSOLETE be valid only if this routine uses FP. For previous frames, fi-frame will -// OBSOLETE always be correct. mn10200_analyze_prologue will fix fi->frame if -// OBSOLETE it's not valid. -// OBSOLETE -// OBSOLETE We can be called with the PC in the call dummy under two circumstances. -// OBSOLETE First, during normal backtracing, second, while figuring out the frame -// OBSOLETE pointer just prior to calling the target function (see run_stack_dummy). */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE mn10200_init_extra_frame_info (struct frame_info *fi) -// OBSOLETE { -// OBSOLETE if (get_next_frame (fi)) -// OBSOLETE deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); -// OBSOLETE -// OBSOLETE memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs); -// OBSOLETE fi->status = 0; -// OBSOLETE fi->stack_size = 0; -// OBSOLETE -// OBSOLETE mn10200_analyze_prologue (fi, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_mn10200_tdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = print_insn_mn10200; -// OBSOLETE } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 2385d37..42c54fc 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -134,7 +134,7 @@ static CORE_ADDR mn10300_extract_struct_value_address (char *regbuf) { return extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (4), - REGISTER_RAW_SIZE (4)); + DEPRECATED_REGISTER_RAW_SIZE (4)); } static void @@ -169,7 +169,7 @@ analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) deprecated_update_frame_base_hack (dummy, frame); get_frame_extra_info (dummy)->status = 0; get_frame_extra_info (dummy)->stack_size = 0; - memset (get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); + memset (deprecated_get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mn10300_analyze_prologue (dummy, pc); return dummy; } @@ -237,59 +237,59 @@ set_movm_offsets (struct frame_info *fi, int movm_args) /* The `other' bit leaves a blank area of four bytes at the beginning of its block of saved registers, making it 32 bytes long in total. */ - get_frame_saved_regs (fi)[LAR_REGNUM] = get_frame_base (fi) + offset + 4; - get_frame_saved_regs (fi)[LIR_REGNUM] = get_frame_base (fi) + offset + 8; - get_frame_saved_regs (fi)[MDR_REGNUM] = get_frame_base (fi) + offset + 12; - get_frame_saved_regs (fi)[A0_REGNUM + 1] = get_frame_base (fi) + offset + 16; - get_frame_saved_regs (fi)[A0_REGNUM] = get_frame_base (fi) + offset + 20; - get_frame_saved_regs (fi)[D0_REGNUM + 1] = get_frame_base (fi) + offset + 24; - get_frame_saved_regs (fi)[D0_REGNUM] = get_frame_base (fi) + offset + 28; + deprecated_get_frame_saved_regs (fi)[LAR_REGNUM] = get_frame_base (fi) + offset + 4; + deprecated_get_frame_saved_regs (fi)[LIR_REGNUM] = get_frame_base (fi) + offset + 8; + deprecated_get_frame_saved_regs (fi)[MDR_REGNUM] = get_frame_base (fi) + offset + 12; + deprecated_get_frame_saved_regs (fi)[A0_REGNUM + 1] = get_frame_base (fi) + offset + 16; + deprecated_get_frame_saved_regs (fi)[A0_REGNUM] = get_frame_base (fi) + offset + 20; + deprecated_get_frame_saved_regs (fi)[D0_REGNUM + 1] = get_frame_base (fi) + offset + 24; + deprecated_get_frame_saved_regs (fi)[D0_REGNUM] = get_frame_base (fi) + offset + 28; offset += 32; } if (movm_args & movm_a3_bit) { - get_frame_saved_regs (fi)[A3_REGNUM] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[A3_REGNUM] = get_frame_base (fi) + offset; offset += 4; } if (movm_args & movm_a2_bit) { - get_frame_saved_regs (fi)[A2_REGNUM] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[A2_REGNUM] = get_frame_base (fi) + offset; offset += 4; } if (movm_args & movm_d3_bit) { - get_frame_saved_regs (fi)[D3_REGNUM] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[D3_REGNUM] = get_frame_base (fi) + offset; offset += 4; } if (movm_args & movm_d2_bit) { - get_frame_saved_regs (fi)[D2_REGNUM] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[D2_REGNUM] = get_frame_base (fi) + offset; offset += 4; } if (AM33_MODE) { if (movm_args & movm_exother_bit) { - get_frame_saved_regs (fi)[MCVF_REGNUM] = get_frame_base (fi) + offset; - get_frame_saved_regs (fi)[MCRL_REGNUM] = get_frame_base (fi) + offset + 4; - get_frame_saved_regs (fi)[MCRH_REGNUM] = get_frame_base (fi) + offset + 8; - get_frame_saved_regs (fi)[MDRQ_REGNUM] = get_frame_base (fi) + offset + 12; - get_frame_saved_regs (fi)[E0_REGNUM + 1] = get_frame_base (fi) + offset + 16; - get_frame_saved_regs (fi)[E0_REGNUM + 0] = get_frame_base (fi) + offset + 20; + deprecated_get_frame_saved_regs (fi)[MCVF_REGNUM] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[MCRL_REGNUM] = get_frame_base (fi) + offset + 4; + deprecated_get_frame_saved_regs (fi)[MCRH_REGNUM] = get_frame_base (fi) + offset + 8; + deprecated_get_frame_saved_regs (fi)[MDRQ_REGNUM] = get_frame_base (fi) + offset + 12; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 1] = get_frame_base (fi) + offset + 16; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 0] = get_frame_base (fi) + offset + 20; offset += 24; } if (movm_args & movm_exreg1_bit) { - get_frame_saved_regs (fi)[E0_REGNUM + 7] = get_frame_base (fi) + offset; - get_frame_saved_regs (fi)[E0_REGNUM + 6] = get_frame_base (fi) + offset + 4; - get_frame_saved_regs (fi)[E0_REGNUM + 5] = get_frame_base (fi) + offset + 8; - get_frame_saved_regs (fi)[E0_REGNUM + 4] = get_frame_base (fi) + offset + 12; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 7] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 6] = get_frame_base (fi) + offset + 4; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 5] = get_frame_base (fi) + offset + 8; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 4] = get_frame_base (fi) + offset + 12; offset += 16; } if (movm_args & movm_exreg0_bit) { - get_frame_saved_regs (fi)[E0_REGNUM + 3] = get_frame_base (fi) + offset; - get_frame_saved_regs (fi)[E0_REGNUM + 2] = get_frame_base (fi) + offset + 4; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 3] = get_frame_base (fi) + offset; + deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 2] = get_frame_base (fi) + offset + 4; offset += 8; } } @@ -648,14 +648,14 @@ saved_regs_size (struct frame_info *fi) /* Reserve four bytes for every register saved. */ for (i = 0; i < NUM_REGS; i++) - if (get_frame_saved_regs (fi)[i]) + if (deprecated_get_frame_saved_regs (fi)[i]) adjust += 4; /* If we saved LIR, then it's most likely we used a `movm' instruction with the `other' bit set, in which case the SP is decremented by an extra four bytes, "to simplify calculation of the transfer area", according to the processor manual. */ - if (get_frame_saved_regs (fi)[LIR_REGNUM]) + if (deprecated_get_frame_saved_regs (fi)[LIR_REGNUM]) adjust += 4; return adjust; @@ -705,8 +705,8 @@ mn10300_frame_chain (struct frame_info *fi) { /* Our caller has a frame pointer. So find the frame in $a3 or in the stack. */ - if (get_frame_saved_regs (fi)[A3_REGNUM]) - return (read_memory_integer (get_frame_saved_regs (fi)[A3_REGNUM], + if (deprecated_get_frame_saved_regs (fi)[A3_REGNUM]) + return (read_memory_integer (deprecated_get_frame_saved_regs (fi)[A3_REGNUM], DEPRECATED_REGISTER_SIZE)); else return read_register (A3_REGNUM); @@ -744,12 +744,12 @@ mn10300_pop_frame_regular (struct frame_info *frame) /* Restore any saved registers. */ for (regnum = 0; regnum < NUM_REGS; regnum++) - if (get_frame_saved_regs (frame)[regnum] != 0) + if (deprecated_get_frame_saved_regs (frame)[regnum] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], - REGISTER_RAW_SIZE (regnum)); + value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], + DEPRECATED_REGISTER_RAW_SIZE (regnum)); write_register (regnum, value); } @@ -1039,14 +1039,14 @@ mn10300_print_register (const char *name, int regnum, int reg_width) int byte; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { - for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); - byte < REGISTER_RAW_SIZE (regnum); + for (byte = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); + byte < DEPRECATED_REGISTER_RAW_SIZE (regnum); byte++) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); } else { - for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1; + for (byte = DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum) - 1; byte >= 0; byte--) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); @@ -1189,7 +1189,6 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_inner_than (gdbarch, core_addr_lessthan); 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_deprecated_frame_chain (gdbarch, mn10300_frame_chain); set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); diff --git a/gdb/monitor.c b/gdb/monitor.c index ee2280d..198155f 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -521,7 +521,6 @@ monitor_expect (char *string, char *buf, int buflen) char *p = string; int obuflen = buflen; int c; - extern struct target_ops *targ_ops; if (monitor_debug_p) { @@ -569,14 +568,6 @@ monitor_expect (char *string, char *buf, int buflen) return 0; } } -#if 0 - // OBSOLETE else if ((c == '\021' || c == '\023') && - // OBSOLETE (STREQ (targ_ops->to_shortname, "m32r") - // OBSOLETE || STREQ (targ_ops->to_shortname, "mon2000"))) - // OBSOLETE { /* m32r monitor emits random DC1/DC3 chars */ - // OBSOLETE continue; - // OBSOLETE } -#endif else { /* We got a character that doesn't match the string. We need to @@ -930,7 +921,7 @@ monitor_supply_register (int regno, char *valstr) /* supply register stores in target byte order, so swap here */ - store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), val); + store_unsigned_integer (regbuf, DEPRECATED_REGISTER_RAW_SIZE (regno), val); supply_register (regno, regbuf); @@ -1236,7 +1227,7 @@ monitor_fetch_register (int regno) spaces, but stop reading if something else is seen. Some monitors like to drop leading zeros. */ - for (i = 0; i < REGISTER_RAW_SIZE (regno) * 2; i++) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno) * 2; i++) { int c; c = readchar (timeout); @@ -1353,7 +1344,7 @@ monitor_store_register (int regno) val = read_register (regno); monitor_debug ("MON storeg %d %s\n", regno, - phex (val, REGISTER_RAW_SIZE (regno))); + phex (val, DEPRECATED_REGISTER_RAW_SIZE (regno))); /* send the register deposit command */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 2485276..d426113 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -370,7 +370,7 @@ ns32k_frame_init_saved_regs (struct frame_info *frame) int localcount; CORE_ADDR enter_addr, next_addr; - if (get_frame_saved_regs (frame)) + if (deprecated_get_frame_saved_regs (frame)) return; frame_saved_regs_zalloc (frame); @@ -385,18 +385,18 @@ ns32k_frame_init_saved_regs (struct frame_info *frame) for (regnum = 0; regnum < 8; regnum++) { if (regmask & (1 << regnum)) - get_frame_saved_regs (frame)[regnum] = next_addr -= 4; + deprecated_get_frame_saved_regs (frame)[regnum] = next_addr -= 4; } - get_frame_saved_regs (frame)[SP_REGNUM] = get_frame_base (frame) + 4; - get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 4; - get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = read_memory_integer (get_frame_base (frame), 4); + deprecated_get_frame_saved_regs (frame)[SP_REGNUM] = get_frame_base (frame) + 4; + deprecated_get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 4; + deprecated_get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = read_memory_integer (get_frame_base (frame), 4); } else if (enter_addr == 1) { CORE_ADDR sp = read_register (SP_REGNUM); - get_frame_saved_regs (frame)[PC_REGNUM] = sp; - get_frame_saved_regs (frame)[SP_REGNUM] = sp + 4; + deprecated_get_frame_saved_regs (frame)[PC_REGNUM] = sp; + deprecated_get_frame_saved_regs (frame)[SP_REGNUM] = sp + 4; } } @@ -427,9 +427,9 @@ ns32k_pop_frame (void) DEPRECATED_FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < 8; regnum++) - if (get_frame_saved_regs (frame)[regnum]) + if (deprecated_get_frame_saved_regs (frame)[regnum]) write_register (regnum, - read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); + read_memory_integer (deprecated_get_frame_saved_regs (frame)[regnum], 4)); write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); @@ -498,7 +498,7 @@ ns32k_store_return_value (struct type *valtype, char *valbuf) static CORE_ADDR ns32k_extract_struct_value_address (char *regbuf) { - return (extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (0), REGISTER_RAW_SIZE (0))); + return (extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (0), DEPRECATED_REGISTER_RAW_SIZE (0))); } void @@ -542,7 +542,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* Register info */ ns32k_gdbarch_init_32082 (gdbarch); diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index 1c3e2a4..057833b 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -770,7 +770,7 @@ variable: name_not_typename else { struct minimal_symbol *msymbol; - register char *arg = copy_name ($1.stoken); + char *arg = copy_name ($1.stoken); msymbol = lookup_minimal_symbol_linkage_or_natural (arg); @@ -993,21 +993,21 @@ name_not_typename : NAME static int parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; + char *p; + int len; int parsed_float; YYSTYPE *putithere; { /* FIXME: Shouldn't these be unsigned? We don't deal with negative values here, and we do kind of silly things like cast to unsigned. */ - register LONGEST n = 0; - register LONGEST prevn = 0; + LONGEST n = 0; + LONGEST prevn = 0; unsigned LONGEST un; - register int i = 0; - register int c; - register int base = input_radix; + int i = 0; + int c; + int base = input_radix; int unsigned_p = 0; /* Number of "L" suffixes encountered. */ @@ -1363,7 +1363,7 @@ yylex () /* It's a number. */ int got_dot = 0, got_e = 0, toktype = FLOAT; /* Initialize toktype to anything other than ERROR. */ - register char *p = tokstart; + char *p = tokstart; int hex = input_radix > 10; int local_radix = input_radix; if (tokchr == '0' && (p[1] == 'x' || p[1] == 'X')) @@ -1593,7 +1593,7 @@ yylex () if (STREQN (tokstart, "unsigned", 8)) return UNSIGNED; if (current_language->la_language == language_cplus - && STREQN (tokstart, "template", 8)) + && strncmp (tokstart, "template", 8) == 0) return TEMPLATE; if (STREQN (tokstart, "volatile", 8)) return VOLATILE_KEYWORD; @@ -1610,7 +1610,7 @@ yylex () break; case 5: if ((current_language->la_language == language_cplus) - && STREQN (tokstart, "class", 5)) + && strncmp (tokstart, "class", 5) == 0) return CLASS; if (STREQN (tokstart, "union", 5)) return UNION; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index d4e070d..657b563 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -659,9 +659,9 @@ const struct language_defn objc_language_defn = { range_check_off, type_check_off, case_sensitive_on, + &exp_descriptor_standard, objc_parse, objc_error, - evaluate_subexp_standard, objc_printchar, /* Print a character constant */ objc_printstr, /* Function to print string constant */ objc_emit_char, @@ -681,6 +681,7 @@ const struct language_defn objc_language_defn = { 1, /* C-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; @@ -1540,8 +1541,8 @@ print_object_command (char *args, int from_tty) make_cleanup (free_current_contents, &expr); int pc = 0; - object = expr->language_defn->evaluate_exp (builtin_type_void_data_ptr, - expr, &pc, EVAL_NORMAL); + object = expr->language_defn->la_exp_desc->evaluate_exp + (builtin_type_void_data_ptr, expr, &pc, EVAL_NORMAL); do_cleanups (old_chain); } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ce927fc..0a5ed81 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -60,8 +60,6 @@ static void *map_to_file (int); #endif /* defined(USE_MMALLOC) && defined(HAVE_MMAP) */ -static void add_to_objfile_sections (bfd *, sec_ptr, void *); - static void objfile_alloc_data (struct objfile *objfile); static void objfile_free_data (struct objfile *objfile); @@ -89,7 +87,8 @@ int mapped_symbol_files; /* Try to use mapped symbol files */ the end of the table (objfile->sections_end). */ static void -add_to_objfile_sections (bfd *abfd, sec_ptr asect, void *objfile_p_char) +add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect, + void *objfile_p_char) { struct objfile *objfile = (struct objfile *) objfile_p_char; struct obj_section section; @@ -1044,14 +1043,14 @@ map_to_file (int fd) #endif /* defined(USE_MMALLOC) && defined(HAVE_MMAP) */ -/* Returns a section whose range includes PC and SECTION, - or NULL if none found. Note the distinction between the return type, - struct obj_section (which is defined in gdb), and the input type - struct sec (which is a bfd-defined data type). The obj_section - contains a pointer to the bfd struct sec section. */ +/* Returns a section whose range includes PC and SECTION, or NULL if + none found. Note the distinction between the return type, struct + obj_section (which is defined in gdb), and the input type "struct + bfd_section" (which is a bfd-defined data type). The obj_section + contains a pointer to the "struct bfd_section". */ struct obj_section * -find_pc_sect_section (CORE_ADDR pc, struct sec *section) +find_pc_sect_section (CORE_ADDR pc, struct bfd_section *section) { struct obj_section *s; struct objfile *objfile; @@ -1088,7 +1087,7 @@ in_plt_section (CORE_ADDR pc, char *name) retval = (s != NULL && s->the_bfd_section->name != NULL - && STREQ (s->the_bfd_section->name, ".plt")); + && strcmp (s->the_bfd_section->name, ".plt") == 0); return (retval); } @@ -1166,6 +1165,13 @@ objfile_free_data (struct objfile *objfile) } void +clear_objfile_data (struct objfile *objfile) +{ + gdb_assert (objfile->data != NULL); + memset (objfile->data, 0, objfile->num_data * sizeof (void *)); +} + +void set_objfile_data (struct objfile *objfile, const struct objfile_data *data, void *value) { diff --git a/gdb/objfiles.h b/gdb/objfiles.h index fe54f6d..ebc10b3 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -178,7 +178,7 @@ struct obj_section addresses. */ CORE_ADDR offset; - sec_ptr the_bfd_section; /* BFD section pointer */ + struct bfd_section *the_bfd_section; /* BFD section pointer */ /* Objfile this section is part of. */ struct objfile *objfile; @@ -599,6 +599,7 @@ extern int is_in_import_list (char *, struct objfile *); modules. */ extern const struct objfile_data *register_objfile_data (void); +extern void clear_objfile_data (struct objfile *objfile); extern void set_objfile_data (struct objfile *objfile, const struct objfile_data *data, void *value); extern void *objfile_data (struct objfile *objfile, @@ -159,7 +159,6 @@ ocd_thread_alive (ptid_t th) /* Clean up connection to a remote debugger. */ -/* ARGSUSED */ void ocd_close (int quitting) { @@ -737,7 +736,6 @@ ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len) nonzero. Returns length of data written or read; 0 for error. TARGET is ignored. */ -/* ARGSUSED */ int ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write, struct mem_attrib *attrib, struct target_ops *target) diff --git a/gdb/osabi.c b/gdb/osabi.c index dbba578..ee13277 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -283,11 +283,28 @@ gdbarch_lookup_osabi (bfd *abfd) return match; } + +/* Return non-zero if architecture A can run code written for + architecture B. */ +static int +can_run_code_for (const struct bfd_arch_info *a, const struct bfd_arch_info *b) +{ + /* BFD's 'A->compatible (A, B)' functions return zero if A and B are + incompatible. But if they are compatible, it returns the 'more + featureful' of the two arches. That is, if A can run code + written for B, but B can't run code written for A, then it'll + return A. + + struct bfd_arch_info objects are singletons: that is, there's + supposed to be exactly one instance for a given machine. So you + can tell whether two are equivalent by comparing pointers. */ + return (a == b || a->compatible (a, b) == a); +} + + void gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) { - const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch); - const struct bfd_arch_info *compatible; struct gdb_osabi_handler *handler; if (info.osabi == GDB_OSABI_UNKNOWN) @@ -303,29 +320,38 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) if (handler->osabi != info.osabi) continue; - /* Check whether the machine type and architecture of the - handler are compatible with the desired machine type and - architecture. + /* If the architecture described by ARCH_INFO can run code for + the architcture we registered the handler for, then the + handler is applicable. Note, though, that if the handler is + for an architecture that is a superset of ARCH_INFO, we can't + use that --- it would be perfectly correct for it to install + gdbarch methods that refer to registers / instructions / + other facilities ARCH_INFO doesn't have. - NOTE: kettenis/20021027: There may be more than one machine + NOTE: kettenis/20021027: There may be more than one machine type that is compatible with the desired machine type. Right now we simply return the first match, which is fine for now. However, we might want to do something smarter in the future. */ - compatible = arch_info->compatible (arch_info, handler->arch_info); - if (compatible == handler->arch_info) + /* NOTE: cagney/2003-10-23: The code for "a can_run_code_for b" + is implemented using BFD's compatible method (a->compatible + (b) == a -- the lowest common denominator between a and b is + a). That method's definition of compatible may not be as you + expect. For instance the test "amd64 can run code for i386" + (or more generally "64-bit ISA can run code for the 32-bit + ISA"). BFD doesn't normally consider 32-bit and 64-bit + "compatible" so it doesn't succeed. */ + if (can_run_code_for (info.bfd_arch_info, handler->arch_info)) { (*handler->init_osabi) (info, gdbarch); return; } } - fprintf_filtered - (gdb_stderr, - "A handler for the OS ABI \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default %s settings", - gdbarch_osabi_name (info.osabi), - bfd_printable_arch_mach (arch_info->arch, arch_info->mach)); + warning ("A handler for the OS ABI \"%s\" is not built into this " + "configuration of GDB. " + "Attempting to continue with the default %s settings", + gdbarch_osabi_name (info.osabi), + info.bfd_arch_info->printable_name); } diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 22b3dcd..b03241f 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -686,7 +686,7 @@ variable: name_not_typename else { struct minimal_symbol *msymbol; - register char *arg = copy_name ($1.stoken); + char *arg = copy_name ($1.stoken); msymbol = lookup_minimal_symbol_linkage_or_natural (arg); @@ -765,20 +765,20 @@ name_not_typename : NAME static int parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; + char *p; + int len; int parsed_float; YYSTYPE *putithere; { /* FIXME: Shouldn't these be unsigned? We don't deal with negative values here, and we do kind of silly things like cast to unsigned. */ - register LONGEST n = 0; - register LONGEST prevn = 0; + LONGEST n = 0; + LONGEST prevn = 0; ULONGEST un; - register int i = 0; - register int c; - register int base = input_radix; + int i = 0; + int c; + int base = input_radix; int unsigned_p = 0; /* Number of "L" suffixes encountered. */ @@ -1190,7 +1190,7 @@ yylex () { /* It's a number. */ int got_dot = 0, got_e = 0, toktype; - register char *p = tokstart; + char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 836f5f3..3ebb433 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -451,9 +451,9 @@ const struct language_defn pascal_language_defn = range_check_on, type_check_on, case_sensitive_on, + &exp_descriptor_standard, pascal_parse, pascal_error, - evaluate_subexp_standard, pascal_printchar, /* Print a character constant */ pascal_printstr, /* Function to print string constant */ pascal_emit_char, /* Print a single char */ @@ -473,6 +473,7 @@ const struct language_defn pascal_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index d1b6b36..c45a167 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -553,8 +553,8 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format, type is indicated by the quoted string anyway. */ if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_NAME (type) == NULL && - TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL && - STREQ (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char")) + TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL + && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0) { /* Print nothing */ } @@ -694,7 +694,7 @@ pascal_object_is_vtbl_ptr_type (struct type *type) const char *typename = type_name_no_tag (type); return (typename != NULL - && (STREQ (typename, pascal_vtbl_ptr_name))); + && strcmp (typename, pascal_vtbl_ptr_name) == 0); } /* Return truth value for the assertion that TYPE is of the type diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index b67532d..8a5cae1 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -1,6 +1,7 @@ /* Handle HP ELF shared libraries for GDB, the GNU Debugger. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -50,6 +51,7 @@ #include "gdbcmd.h" #include "language.h" #include "regcache.h" +#include "exec.h" #include <fcntl.h> @@ -57,9 +59,6 @@ #define O_BINARY 0 #endif -/* Defined in exec.c; used to prevent dangling pointer bug. */ -extern struct target_ops exec_ops; - static CORE_ADDR bfd_lookup_symbol (bfd *, char *); /* This lives in hppa-tdep.c. */ extern struct unwind_table_entry *find_unwind_entry (CORE_ADDR pc); @@ -110,7 +109,7 @@ typedef struct { CORE_ADDR dld_flags_addr; LONGEST dld_flags; - sec_ptr dyninfo_sect; + struct bfd_section *dyninfo_sect; int have_read_dld_descriptor; int is_valid; CORE_ADDR load_map; diff --git a/gdb/parse.c b/gdb/parse.c index 61be543..e12fa20 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -50,6 +50,17 @@ #include "gdb_assert.h" #include "block.h" +/* Standard set of definitions for printing, dumping, prefixifying, + * and evaluating expressions. */ + +const struct exp_descriptor exp_descriptor_standard = + { + print_subexp_standard, + operator_length_standard, + op_name_standard, + dump_subexp_body_standard, + evaluate_subexp_standard + }; /* Symbols which architectures can redefine. */ @@ -783,18 +794,48 @@ prefixify_expression (struct expression *expr) prefixify_subexp (temp, expr, inpos, outpos); } -/* Return the number of exp_elements in the subexpression of EXPR - whose last exp_element is at index ENDPOS - 1 in EXPR. */ +/* Return the number of exp_elements in the postfix subexpression + of EXPR whose operator is at index ENDPOS - 1 in EXPR. */ int length_of_subexp (struct expression *expr, int endpos) { + int oplen, args, i; + + operator_length (expr, endpos, &oplen, &args); + + while (args > 0) + { + oplen += length_of_subexp (expr, endpos - oplen); + args--; + } + + return oplen; +} + +/* Sets *OPLENP to the length of the operator whose (last) index is + ENDPOS - 1 in EXPR, and sets *ARGSP to the number of arguments that + operator takes. */ + +void +operator_length (struct expression *expr, int endpos, int *oplenp, int *argsp) +{ + expr->language_defn->la_exp_desc->operator_length (expr, endpos, + oplenp, argsp); +} + +/* Default value for operator_length in exp_descriptor vectors. */ + +void +operator_length_standard (struct expression *expr, int endpos, + int *oplenp, int *argsp) +{ int oplen = 1; int args = 0; int i; if (endpos < 1) - error ("?error in length_of_subexp"); + error ("?error in operator_length_standard"); i = (int) expr->elts[endpos - 1].opcode; @@ -915,13 +956,8 @@ length_of_subexp (struct expression *expr, int endpos) args = 1 + (i < (int) BINOP_END); } - while (args > 0) - { - oplen += length_of_subexp (expr, endpos - oplen); - args--; - } - - return oplen; + *oplenp = oplen; + *argsp = args; } /* Copy the subexpression ending just before index INEND in INEXPR @@ -932,132 +968,13 @@ static void prefixify_subexp (struct expression *inexpr, struct expression *outexpr, int inend, int outbeg) { - int oplen = 1; - int args = 0; + int oplen; + int args; int i; int *arglens; enum exp_opcode opcode; - /* Compute how long the last operation is (in OPLEN), - and also how many preceding subexpressions serve as - arguments for it (in ARGS). */ - - opcode = inexpr->elts[inend - 1].opcode; - switch (opcode) - { - /* C++ */ - case OP_SCOPE: - oplen = longest_to_int (inexpr->elts[inend - 2].longconst); - oplen = 5 + BYTES_TO_EXP_ELEM (oplen + 1); - break; - - case OP_LONG: - case OP_DOUBLE: - case OP_VAR_VALUE: - oplen = 4; - break; - - case OP_TYPE: - case OP_BOOL: - case OP_LAST: - case OP_REGISTER: - case OP_INTERNALVAR: - oplen = 3; - break; - - case OP_COMPLEX: - oplen = 1; - args = 2; - break; - - case OP_FUNCALL: - case OP_F77_UNDETERMINED_ARGLIST: - oplen = 3; - args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); - break; - - case OP_OBJC_MSGCALL: /* Objective C message (method) call */ - oplen = 4; - args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); - break; - - case UNOP_MIN: - case UNOP_MAX: - oplen = 3; - break; - - case UNOP_CAST: - case UNOP_MEMVAL: - oplen = 3; - args = 1; - break; - - case UNOP_ABS: - case UNOP_CAP: - case UNOP_CHR: - case UNOP_FLOAT: - case UNOP_HIGH: - case UNOP_ODD: - case UNOP_ORD: - case UNOP_TRUNC: - oplen = 1; - args = 1; - break; - - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: - case OP_LABELED: - args = 1; - /* fall through */ - case OP_M2_STRING: - case OP_STRING: - case OP_OBJC_NSSTRING: /* Objective C Foundation Class NSString constant */ - case OP_OBJC_SELECTOR: /* Objective C "@selector" pseudo-op */ - case OP_NAME: - case OP_EXPRSTRING: - oplen = longest_to_int (inexpr->elts[inend - 2].longconst); - oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1); - break; - - case OP_BITSTRING: - oplen = longest_to_int (inexpr->elts[inend - 2].longconst); - oplen = (oplen + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; - oplen = 4 + BYTES_TO_EXP_ELEM (oplen); - break; - - case OP_ARRAY: - oplen = 4; - args = longest_to_int (inexpr->elts[inend - 2].longconst); - args -= longest_to_int (inexpr->elts[inend - 3].longconst); - args += 1; - break; - - case TERNOP_COND: - case TERNOP_SLICE: - case TERNOP_SLICE_COUNT: - args = 3; - break; - - case BINOP_ASSIGN_MODIFY: - oplen = 3; - args = 2; - break; - - /* Modula-2 */ - case MULTI_SUBSCRIPT: - oplen = 3; - args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); - break; - - /* C++ */ - case OP_THIS: - case OP_OBJC_SELF: - oplen = 2; - break; - - default: - args = 1 + ((int) opcode < (int) BINOP_END); - } + operator_length (inexpr, inend, &oplen, &args); /* Copy the final operator itself, from the end of the input to the beginning of the output. */ @@ -1155,14 +1072,13 @@ parse_exp_1 (char **stringptr, struct block *block, int comma) parser, to a prefix form. */ if (expressiondebug) - dump_prefix_expression (expout, gdb_stdlog, - "before conversion to prefix form"); + dump_raw_expression (expout, gdb_stdlog, + "before conversion to prefix form"); prefixify_expression (expout); if (expressiondebug) - dump_postfix_expression (expout, gdb_stdlog, - "after conversion to prefix form"); + dump_prefix_expression (expout, gdb_stdlog); *stringptr = lexptr; return expout; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index f03f537..c84fcad 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -159,6 +159,17 @@ extern int pop_type_int (void); extern int length_of_subexp (struct expression *, int); +extern int dump_subexp (struct expression *, struct ui_file *, int); + +extern int dump_subexp_body_standard (struct expression *, + struct ui_file *, int); + +extern void operator_length (struct expression *, int, int *, int *); + +extern void operator_length_standard (struct expression *, int, int *, int *); + +extern char *op_name_standard (enum exp_opcode); + extern struct type *follow_types (struct type *); /* During parsing of a C expression, the pointer to the next character @@ -220,6 +231,46 @@ struct op_print int right_assoc; }; +/* Information needed to print, prefixify, and evaluate expressions for + a given language. */ + +struct exp_descriptor + { + /* Print subexpression. */ + void (*print_subexp) (struct expression *, int *, struct ui_file *, + enum precedence); + + /* Returns number of exp_elements needed to represent an operator and + the number of subexpressions it takes. */ + void (*operator_length) (struct expression*, int, int*, int *); + + /* Name of this operator for dumping purposes. */ + char *(*op_name) (enum exp_opcode); + + /* Dump the rest of this (prefix) expression after the operator + itself has been printed. See dump_subexp_body_standard in + (expprint.c). */ + int (*dump_subexp_body) (struct expression *, struct ui_file *, int); + + /* Evaluate an expression. */ + struct value *(*evaluate_exp) (struct type *, struct expression *, + int *, enum noside); + }; + + +/* Default descriptor containing standard definitions of all + elements. */ +extern const struct exp_descriptor exp_descriptor_standard; + +/* Functions used by language-specific extended operators to (recursively) + print/dump subexpressions. */ + +extern void print_subexp (struct expression *, int *, struct ui_file *, + enum precedence); + +extern void print_subexp_standard (struct expression *, int *, + struct ui_file *, enum precedence); + /* Function used to avoid direct calls to fprintf in the code generated by the bison parser. */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index be278f9..8227aa8 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -178,7 +178,7 @@ fetch_altivec_register (int tid, int regno) int offset = 0; gdb_vrregset_t regs; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); + int vrregsize = DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); if (ret < 0) @@ -196,7 +196,7 @@ fetch_altivec_register (int tid, int regno) vector. VRSAVE is at the end of the array in a 4 bytes slot, so there is no need to define an offset for it. */ if (regno == (tdep->ppc_vrsave_regnum - 1)) - offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); + offset = vrregsize - DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); supply_register (regno, regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); @@ -230,12 +230,12 @@ fetch_register (int tid, int regno) if (regaddr == -1) { - memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ + memset (buf, '\0', DEPRECATED_REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ supply_register (regno, buf); return; } - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; *(PTRACE_XFER_TYPE *) & buf[i] = ptrace (PT_READ_U, tid, @@ -257,8 +257,8 @@ supply_vrregset (gdb_vrregset_t *vrregsetp) int i; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; - int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); - int offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); + int vrregsize = DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); + int offset = vrregsize - DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); for (i = 0; i < num_of_vrregs; i++) { @@ -335,7 +335,7 @@ store_altivec_register (int tid, int regno) int offset = 0; gdb_vrregset_t regs; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); + int vrregsize = DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); if (ret < 0) @@ -351,7 +351,7 @@ store_altivec_register (int tid, int regno) /* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes long on the hardware. */ if (regno == (tdep->ppc_vrsave_regnum - 1)) - offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); + offset = vrregsize - DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); regcache_collect (regno, regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); @@ -381,7 +381,7 @@ store_register (int tid, int regno) return; regcache_collect (regno, buf); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, @@ -410,8 +410,8 @@ fill_vrregset (gdb_vrregset_t *vrregsetp) int i; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; - int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); - int offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); + int vrregsize = DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); + int offset = vrregsize - DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum); for (i = 0; i < num_of_vrregs; i++) { diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 22ebfd2..c094efe 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -331,7 +331,7 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc) /* This might not work right if we have multiple symbols with the same name; the only way to really get it right is to perform the same sort of lookup as the dynamic linker. */ - msymbol = lookup_minimal_symbol_text (symname, NULL, NULL); + msymbol = lookup_minimal_symbol_text (symname, NULL); if (!msymbol) return 0; @@ -402,7 +402,7 @@ ppc_linux_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR regs_addr; int i; - if (get_frame_saved_regs (fi)) + if (deprecated_get_frame_saved_regs (fi)) return; frame_saved_regs_zalloc (fi); @@ -410,24 +410,24 @@ ppc_linux_frame_init_saved_regs (struct frame_info *fi) regs_addr = 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] = + deprecated_get_frame_saved_regs (fi)[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP; + deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] = regs_addr + 4 * PPC_LINUX_PT_MSR; - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] = + deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] = regs_addr + 4 * PPC_LINUX_PT_CCR; - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] = + deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] = regs_addr + 4 * PPC_LINUX_PT_LNK; - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] = + deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] = regs_addr + 4 * PPC_LINUX_PT_CTR; - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] = + deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] = regs_addr + 4 * PPC_LINUX_PT_XER; - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] = + deprecated_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++) - get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] = + deprecated_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++) - get_frame_saved_regs (fi)[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i; + deprecated_get_frame_saved_regs (fi)[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i; } else rs6000_frame_init_saved_regs (fi); @@ -596,13 +596,17 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) structures, no matter their size, are put in memory. Vectors, which were added later, do get returned in a register though. */ -static int -ppc_linux_use_struct_convention (int gcc_p, struct type *value_type) +static enum return_value_convention +ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, const void *inval, void *outval) { - if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) - && TYPE_VECTOR (value_type)) - return 0; - return 1; + if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT + || TYPE_CODE (valtype) == TYPE_CODE_UNION) + && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) + && TYPE_VECTOR (valtype))) + return RETURN_VALUE_STRUCT_CONVENTION; + else + return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, inval, outval); } /* Fetch (and possibly build) an appropriate link_map_offsets @@ -908,7 +912,8 @@ ppc64_skip_trampoline_code (CORE_ADDR pc) } -/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR) on PPC64 GNU/Linux. +/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG) on PPC64 + GNU/Linux. Usually a function pointer's representation is simply the address of the function. On GNU/Linux on the 64-bit PowerPC however, a @@ -925,21 +930,23 @@ ppc64_skip_trampoline_code (CORE_ADDR pc) find_function_addr uses this function to get the function address from a function pointer. */ -/* Return real function address if ADDR (a function pointer) is in the data - space and is therefore a special function pointer. */ +/* If ADDR points at what is clearly a function descriptor, transform + it into the address of the corresponding function. Be + conservative, otherwize GDB will do the transformation on any + random addresses such as occures when there is no symbol table. */ static CORE_ADDR -ppc64_linux_convert_from_func_ptr_addr (CORE_ADDR addr) +ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, + CORE_ADDR addr, + struct target_ops *targ) { - struct obj_section *s; + struct section_table *s = target_section_by_addr (targ, addr); - s = find_pc_section (addr); - if (s && s->the_bfd_section->flags & SEC_CODE) - return addr; + /* Check if ADDR points to a function descriptor. */ + if (s && strcmp (s->the_bfd_section->name, ".opd") == 0) + return get_target_memory_unsigned (targ, addr, 8); - /* ADDR is in the data space, so it's a pointer to a descriptor, not - the entry point. */ - return ppc64_desc_entry_point (addr); + return addr; } @@ -1040,7 +1047,7 @@ ppc_linux_init_abi (struct gdbarch_info info, (well ignoring vectors that is). When this was corrected, it wasn't fixed for GNU/Linux native platform. Use the PowerOpen struct convention. */ - set_gdbarch_use_struct_convention (gdbarch, ppc_linux_use_struct_convention); + set_gdbarch_return_value (gdbarch, ppc_linux_return_value); /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding *_push_arguments(). The same remarks hold for the methods below. */ @@ -1080,7 +1087,13 @@ ppc_linux_init_abi (struct gdbarch_info info, void _initialize_ppc_linux_tdep (void) { - gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_LINUX, - ppc_linux_init_abi); + /* Register for all sub-familes of the POWER/PowerPC: 32-bit and + 64-bit PowerPC, and the older rs6k. */ + gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX, + ppc_linux_init_abi); + gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX, + ppc_linux_init_abi); + gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX, + ppc_linux_init_abi); add_core_fns (&ppc_linux_regset_core_fns); } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 622bc65..01438c1 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1,7 +1,7 @@ /* Target-dependent code for PowerPC systems using the SVR4 ABI for GDB, the GNU debugger. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -26,23 +26,9 @@ #include "regcache.h" #include "value.h" #include "gdb_string.h" - +#include "gdb_assert.h" #include "ppc-tdep.h" - -/* Ensure that X is aligned to an S byte boundary (assuming that S is - a power of 2) rounding up/down where necessary. */ - -static ULONGEST -align_up (ULONGEST x, int s) -{ - return (x + s - 1) & -s; -} - -static ULONGEST -align_down (ULONGEST x, int s) -{ - return (x & -s); -} +#include "target.h" /* Pass the arguments in either registers, or in the stack. Using the ppc sysv ABI, the first eight words of the argument list (that might @@ -94,9 +80,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, int structoffset = argoffset + argspace; /* If the function is returning a `struct', then the first word - (which will be passed in r3) is used for struct return - address. In that case we should advance one word and start - from r4 register to copy parameters. */ + (which will be passed in r3) is used for struct return + address. In that case we should advance one word and start + from r4 register to copy parameters. */ if (struct_return) { if (write_pass) @@ -114,18 +100,17 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, char *val = VALUE_CONTENTS (arg); if (TYPE_CODE (type) == TYPE_CODE_FLT - && ppc_floating_point_unit_p (current_gdbarch) - && len <= 8) + && ppc_floating_point_unit_p (current_gdbarch) && len <= 8) { /* Floating point value converted to "double" then - passed in an FP register, when the registers run out, - 8 byte aligned stack is used. */ + passed in an FP register, when the registers run out, + 8 byte aligned stack is used. */ if (freg <= 8) { if (write_pass) { /* Always store the floating point value using - the register's floating-point format. */ + the register's floating-point format. */ char regval[MAX_REGISTER_SIZE]; struct type *regtype = register_type (gdbarch, FP0_REGNUM + freg); @@ -138,7 +123,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, else { /* SysV ABI converts floats to doubles before - writing them to an 8 byte aligned stack location. */ + writing them to an 8 byte aligned stack location. */ argoffset = align_up (argoffset, 8); if (write_pass) { @@ -161,16 +146,14 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, argoffset += 8; } } - 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 */ + 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 */ { /* "long long" or "double" passed in an odd/even - register pair with the low addressed word in the odd - register and the high addressed word in the even - register, or when the registers run out an 8 byte - aligned stack location. */ + register pair with the low addressed word in the odd + register and the high addressed word in the even + register, or when the registers run out an 8 byte + aligned stack location. */ if (greg > 9) { /* Just in case GREG was 10. */ @@ -184,8 +167,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, { if (write_pass) regcache_cooked_write (regcache, - tdep->ppc_gp0_regnum + greg, - val); + tdep->ppc_gp0_regnum + greg, val); greg += 1; } else @@ -207,17 +189,15 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, } else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) - && tdep->ppc_vr0_regnum >= 0) + && TYPE_VECTOR (type) && tdep->ppc_vr0_regnum >= 0) { /* Vector parameter passed in an Altivec register, or - when that runs out, 16 byte aligned stack location. */ + when that runs out, 16 byte aligned stack location. */ if (vreg <= 13) { if (write_pass) regcache_cooked_write (current_regcache, - tdep->ppc_vr0_regnum + vreg, - val); + tdep->ppc_vr0_regnum + vreg, val); vreg++; } else @@ -228,38 +208,36 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, argoffset += 16; } } - else if (len == 8 + else if (len == 8 && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) - && tdep->ppc_ev0_regnum >= 0) - { + && TYPE_VECTOR (type) && tdep->ppc_ev0_regnum >= 0) + { /* Vector parameter passed in an e500 register, or when - that runs out, 8 byte aligned stack location. Note - that since e500 vector and general purpose registers - both map onto the same underlying register set, a - "greg" and not a "vreg" is consumed here. A cooked - write stores the value in the correct locations - within the raw register cache. */ - if (greg <= 10) - { + that runs out, 8 byte aligned stack location. Note + that since e500 vector and general purpose registers + both map onto the same underlying register set, a + "greg" and not a "vreg" is consumed here. A cooked + write stores the value in the correct locations + within the raw register cache. */ + if (greg <= 10) + { if (write_pass) regcache_cooked_write (current_regcache, - tdep->ppc_ev0_regnum + greg, - val); - greg++; - } - else - { + tdep->ppc_ev0_regnum + greg, val); + greg++; + } + else + { argoffset = align_up (argoffset, 8); if (write_pass) write_memory (sp + argoffset, val, 8); - argoffset += 8; - } - } + argoffset += 8; + } + } else { /* Reduce the parameter down to something that fits in a - "word". */ + "word". */ char word[MAX_REGISTER_SIZE]; memset (word, 0, MAX_REGISTER_SIZE); if (len > tdep->wordsize @@ -267,12 +245,12 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, || TYPE_CODE (type) == TYPE_CODE_UNION) { /* Structs and large values are put on an 8 byte - aligned stack ... */ + aligned stack ... */ structoffset = align_up (structoffset, 8); if (write_pass) write_memory (sp + structoffset, val, len); /* ... and then a "word" pointing to that address is - passed as the parameter. */ + passed as the parameter. */ store_unsigned_integer (word, tdep->wordsize, sp + structoffset); structoffset += len; @@ -285,13 +263,12 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Always goes in the low address. */ memcpy (word, val, len); /* Store that "word" in a register, or on the stack. - The words have "4" byte alignment. */ + The words have "4" byte alignment. */ if (greg <= 10) { if (write_pass) regcache_cooked_write (regcache, - tdep->ppc_gp0_regnum + greg, - word); + tdep->ppc_gp0_regnum + greg, word); greg++; } else @@ -329,14 +306,685 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, return sp; } -/* Structures 8 bytes or less long are returned in the r3 & r4 - registers, according to the SYSV ABI. */ -int -ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type) +/* Handle the return-value conventions specified by the SysV 32-bit + PowerPC ABI (including all the supplements): + + no floating-point: floating-point values returned using 32-bit + general-purpose registers. + + Altivec: 128-bit vectors returned using vector registers. + + e500: 64-bit vectors returned using the full full 64 bit EV + register, floating-point values returned using 32-bit + general-purpose registers. + + GCC (broken): Small struct values right (instead of left) aligned + when returned in general-purpose registers. */ + +static enum return_value_convention +do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type, + struct regcache *regcache, void *readbuf, + const void *writebuf, int broken_gcc) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + gdb_assert (tdep->wordsize == 4); + if (TYPE_CODE (type) == TYPE_CODE_FLT + && TYPE_LENGTH (type) <= 8 + && ppc_floating_point_unit_p (gdbarch)) + { + if (readbuf) + { + /* Floats and doubles stored in "f1". Convert the value to + the required type. */ + char regval[MAX_REGISTER_SIZE]; + struct type *regtype = register_type (gdbarch, FP0_REGNUM + 1); + regcache_cooked_read (regcache, FP0_REGNUM + 1, regval); + convert_typed_floating (regval, regtype, readbuf, type); + } + if (writebuf) + { + /* Floats and doubles stored in "f1". Convert the value to + the register's "double" type. */ + char regval[MAX_REGISTER_SIZE]; + struct type *regtype = register_type (gdbarch, FP0_REGNUM); + convert_typed_floating (writebuf, type, regval, regtype); + regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8) + || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)) + { + if (readbuf) + { + /* A long long, or a double stored in the 32 bit r3/r4. */ + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, + (bfd_byte *) readbuf + 0); + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, + (bfd_byte *) readbuf + 4); + } + if (writebuf) + { + /* A long long, or a double stored in the 32 bit r3/r4. */ + regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, + (const bfd_byte *) writebuf + 0); + regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4, + (const bfd_byte *) writebuf + 4); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_CODE (type) == TYPE_CODE_INT + && TYPE_LENGTH (type) <= tdep->wordsize) + { + if (readbuf) + { + /* Some sort of integer stored in r3. Since TYPE isn't + bigger than the register, sign extension isn't a problem + - just do everything unsigned. */ + ULONGEST regval; + regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3, + ®val); + store_unsigned_integer (readbuf, TYPE_LENGTH (type), regval); + } + if (writebuf) + { + /* Some sort of integer stored in r3. Use unpack_long since + that should handle any required sign extension. */ + regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3, + unpack_long (type, writebuf)); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_LENGTH (type) == 16 + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (type) && tdep->ppc_vr0_regnum >= 0) + { + if (readbuf) + { + /* Altivec places the return value in "v2". */ + regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf); + } + if (writebuf) + { + /* Altivec places the return value in "v2". */ + regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_LENGTH (type) == 8 + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (type) && tdep->ppc_ev0_regnum >= 0) + { + /* The e500 ABI places return values for the 64-bit DSP types + (__ev64_opaque__) in r3. However, in GDB-speak, ev3 + corresponds to the entire r3 value for e500, whereas GDB's r3 + only corresponds to the least significant 32-bits. So place + the 64-bit DSP type's value in ev3. */ + if (readbuf) + regcache_cooked_read (regcache, tdep->ppc_ev0_regnum + 3, readbuf); + if (writebuf) + regcache_cooked_write (regcache, tdep->ppc_ev0_regnum + 3, writebuf); + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (broken_gcc && TYPE_LENGTH (type) <= 8) + { + if (readbuf) + { + /* GCC screwed up. The last register isn't "left" aligned. + Need to extract the least significant part of each + register and then store that. */ + /* Transfer any full words. */ + int word = 0; + while (1) + { + ULONGEST reg; + int len = TYPE_LENGTH (type) - word * tdep->wordsize; + if (len <= 0) + break; + if (len > tdep->wordsize) + len = tdep->wordsize; + regcache_cooked_read_unsigned (regcache, + tdep->ppc_gp0_regnum + 3 + word, + ®); + store_unsigned_integer (((bfd_byte *) readbuf + + word * tdep->wordsize), len, reg); + word++; + } + } + if (writebuf) + { + /* GCC screwed up. The last register isn't "left" aligned. + Need to extract the least significant part of each + register and then store that. */ + /* Transfer any full words. */ + int word = 0; + while (1) + { + ULONGEST reg; + int len = TYPE_LENGTH (type) - word * tdep->wordsize; + if (len <= 0) + break; + if (len > tdep->wordsize) + len = tdep->wordsize; + reg = extract_unsigned_integer (((const bfd_byte *) writebuf + + word * tdep->wordsize), len); + regcache_cooked_write_unsigned (regcache, + tdep->ppc_gp0_regnum + 3 + word, + reg); + word++; + } + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_LENGTH (type) <= 8) + { + if (readbuf) + { + /* This matches SVr4 PPC, it does not match GCC. */ + /* The value is right-padded to 8 bytes and then loaded, as + two "words", into r3/r4. */ + char regvals[MAX_REGISTER_SIZE * 2]; + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, + regvals + 0 * tdep->wordsize); + if (TYPE_LENGTH (type) > tdep->wordsize) + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4, + regvals + 1 * tdep->wordsize); + memcpy (readbuf, regvals, TYPE_LENGTH (type)); + } + if (writebuf) + { + /* This matches SVr4 PPC, it does not match GCC. */ + /* The value is padded out to 8 bytes and then loaded, as + two "words" into r3/r4. */ + char regvals[MAX_REGISTER_SIZE * 2]; + memset (regvals, 0, sizeof regvals); + memcpy (regvals, writebuf, TYPE_LENGTH (type)); + regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, + regvals + 0 * tdep->wordsize); + if (TYPE_LENGTH (type) > tdep->wordsize) + regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4, + regvals + 1 * tdep->wordsize); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + return RETURN_VALUE_STRUCT_CONVENTION; +} + +enum return_value_convention +ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) +{ + return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf, + writebuf, 0); +} + +enum return_value_convention +ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch, + struct type *valtype, + struct regcache *regcache, + void *readbuf, const void *writebuf) +{ + return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf, + writebuf, 1); +} + +/* Pass the arguments in either registers, or in the stack. Using the + ppc 64 bit SysV ABI. + + This implements a dumbed down version of the ABI. It always writes + values to memory, GPR and FPR, even when not necessary. Doing this + greatly simplifies the logic. */ + +CORE_ADDR +ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, + struct regcache *regcache, CORE_ADDR bp_addr, + int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + /* By this stage in the proceedings, SP has been decremented by "red + zone size" + "struct return size". Fetch the stack-pointer from + before this and use that as the BACK_CHAIN. */ + const CORE_ADDR back_chain = read_sp (); + /* See for-loop comment below. */ + int write_pass; + /* Size of the Altivec's vector parameter region, the final value is + computed in the for-loop below. */ + LONGEST vparam_size = 0; + /* Size of the general parameter region, the final value is computed + in the for-loop below. */ + LONGEST gparam_size = 0; + /* Kevin writes ... I don't mind seeing tdep->wordsize used in the + calls to align_up(), align_down(), etc. because this makes it + easier to reuse this code (in a copy/paste sense) in the future, + but it is a 64-bit ABI and asserting that the wordsize is 8 bytes + at some point makes it easier to verify that this function is + correct without having to do a non-local analysis to figure out + the possible values of tdep->wordsize. */ + gdb_assert (tdep->wordsize == 8); + + /* Go through the argument list twice. + + Pass 1: Compute the function call's stack space and register + requirements. + + Pass 2: Replay the same computation but this time also write the + values out to the target. */ + + for (write_pass = 0; write_pass < 2; write_pass++) + { + int argno; + /* Next available floating point register for float and double + arguments. */ + int freg = 1; + /* Next available general register for non-vector (but possibly + float) arguments. */ + int greg = 3; + /* Next available vector register for vector arguments. */ + int vreg = 2; + /* The address, at which the next general purpose parameter + (integer, struct, float, ...) should be saved. */ + CORE_ADDR gparam; + /* Address, at which the next Altivec vector parameter should be + saved. */ + CORE_ADDR vparam; + + if (!write_pass) + { + /* During the first pass, GPARAM and VPARAM are more like + offsets (start address zero) than addresses. That way + the accumulate the total stack space each region + requires. */ + gparam = 0; + vparam = 0; + } + else + { + /* Decrement the stack pointer making space for the Altivec + and general on-stack parameters. Set vparam and gparam + to their corresponding regions. */ + vparam = align_down (sp - vparam_size, 16); + gparam = align_down (vparam - gparam_size, 16); + /* Add in space for the TOC, link editor double word, + compiler double word, LR save area, CR save area. */ + sp = align_down (gparam - 48, 16); + } + + /* If the function is returning a `struct', then there is an + extra hidden parameter (which will be passed in r3) + containing the address of that struct.. In that case we + should advance one word and start from r4 register to copy + parameters. This also consumes one on-stack parameter slot. */ + if (struct_return) + { + if (write_pass) + regcache_cooked_write_signed (regcache, + tdep->ppc_gp0_regnum + greg, + struct_addr); + greg++; + gparam = align_up (gparam + tdep->wordsize, tdep->wordsize); + } + + for (argno = 0; argno < nargs; argno++) + { + struct value *arg = args[argno]; + struct type *type = check_typedef (VALUE_TYPE (arg)); + char *val = VALUE_CONTENTS (arg); + if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8) + { + /* Floats and Doubles go in f1 .. f13. They also + consume a left aligned GREG,, and can end up in + memory. */ + if (write_pass) + { + if (ppc_floating_point_unit_p (current_gdbarch) + && freg <= 13) + { + char regval[MAX_REGISTER_SIZE]; + struct type *regtype = register_type (gdbarch, + FP0_REGNUM); + convert_typed_floating (val, type, regval, regtype); + regcache_cooked_write (regcache, FP0_REGNUM + freg, + regval); + } + if (greg <= 10) + { + /* The ABI states "Single precision floating + point values are mapped to the first word in + a single doubleword" and "... floating point + values mapped to the first eight doublewords + of the parameter save area are also passed in + general registers"). + + This code interprets that to mean: store it, + left aligned, in the general register. */ + char regval[MAX_REGISTER_SIZE]; + memset (regval, 0, sizeof regval); + memcpy (regval, val, TYPE_LENGTH (type)); + regcache_cooked_write (regcache, + tdep->ppc_gp0_regnum + greg, + regval); + } + write_memory (gparam, val, TYPE_LENGTH (type)); + } + /* Always consume parameter stack space. */ + freg++; + greg++; + gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); + } + else if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type) + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && tdep->ppc_vr0_regnum >= 0) + { + /* In the Altivec ABI, vectors go in the vector + registers v2 .. v13, or when that runs out, a vector + annex which goes above all the normal parameters. + NOTE: cagney/2003-09-21: This is a guess based on the + PowerOpen Altivec ABI. */ + if (vreg <= 13) + { + if (write_pass) + regcache_cooked_write (regcache, + tdep->ppc_vr0_regnum + vreg, val); + vreg++; + } + else + { + if (write_pass) + write_memory (vparam, val, TYPE_LENGTH (type)); + vparam = align_up (vparam + TYPE_LENGTH (type), 16); + } + } + else if ((TYPE_CODE (type) == TYPE_CODE_INT + || TYPE_CODE (type) == TYPE_CODE_ENUM) + && TYPE_LENGTH (type) <= 8) + { + /* Scalars get sign[un]extended and go in gpr3 .. gpr10. + They can also end up in memory. */ + if (write_pass) + { + /* Sign extend the value, then store it unsigned. */ + ULONGEST word = unpack_long (type, val); + if (greg <= 10) + regcache_cooked_write_unsigned (regcache, + tdep->ppc_gp0_regnum + + greg, word); + write_memory_unsigned_integer (gparam, tdep->wordsize, + word); + } + greg++; + gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); + } + else + { + int byte; + for (byte = 0; byte < TYPE_LENGTH (type); + byte += tdep->wordsize) + { + if (write_pass && greg <= 10) + { + char regval[MAX_REGISTER_SIZE]; + int len = TYPE_LENGTH (type) - byte; + if (len > tdep->wordsize) + len = tdep->wordsize; + memset (regval, 0, sizeof regval); + /* WARNING: cagney/2003-09-21: As best I can + tell, the ABI specifies that the value should + be left aligned. Unfortunately, GCC doesn't + do this - it instead right aligns even sized + values and puts odd sized values on the + stack. Work around that by putting both a + left and right aligned value into the + register (hopefully no one notices :-^). + Arrrgh! */ + /* Left aligned (8 byte values such as pointers + fill the buffer). */ + memcpy (regval, val + byte, len); + /* Right aligned (but only if even). */ + if (len == 1 || len == 2 || len == 4) + memcpy (regval + tdep->wordsize - len, + val + byte, len); + regcache_cooked_write (regcache, greg, regval); + } + greg++; + } + if (write_pass) + /* WARNING: cagney/2003-09-21: Strictly speaking, this + isn't necessary, unfortunately, GCC appears to get + "struct convention" parameter passing wrong putting + odd sized structures in memory instead of in a + register. Work around this by always writing the + value to memory. Fortunately, doing this + simplifies the code. */ + write_memory (gparam, val, TYPE_LENGTH (type)); + /* Always consume parameter stack space. */ + gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); + } + } + + if (!write_pass) + { + /* Save the true region sizes ready for the second pass. */ + vparam_size = vparam; + /* Make certain that the general parameter save area is at + least the minimum 8 registers (or doublewords) in size. */ + if (greg < 8) + gparam_size = 8 * tdep->wordsize; + else + gparam_size = gparam; + } + } + + /* Update %sp. */ + regcache_cooked_write_signed (regcache, SP_REGNUM, sp); + + /* Write the backchain (it occupies WORDSIZED bytes). */ + write_memory_signed_integer (sp, tdep->wordsize, back_chain); + + /* Point the inferior function call's return address at the dummy's + breakpoint. */ + regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr); + + /* Find a value for the TOC register. Every symbol should have both + ".FN" and "FN" in the minimal symbol table. "FN" points at the + FN's descriptor, while ".FN" points at the entry point (which + matches FUNC_ADDR). Need to reverse from FUNC_ADDR back to the + FN's descriptor address. */ + { + /* Find the minimal symbol that corresponds to FUNC_ADDR (should + have the name ".FN"). */ + struct minimal_symbol *dot_fn = lookup_minimal_symbol_by_pc (func_addr); + if (dot_fn != NULL && SYMBOL_LINKAGE_NAME (dot_fn)[0] == '.') + { + /* Now find the corresponding "FN" (dropping ".") minimal + symbol's address. */ + struct minimal_symbol *fn = + lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL, + NULL); + if (fn != NULL) + { + /* Got the address of that descriptor. The TOC is the + second double word. */ + CORE_ADDR toc = + read_memory_unsigned_integer (SYMBOL_VALUE_ADDRESS (fn) + + tdep->wordsize, tdep->wordsize); + regcache_cooked_write_unsigned (regcache, + tdep->ppc_gp0_regnum + 2, toc); + } + } + } + + return sp; +} + + +/* The 64 bit ABI retun value convention. + + Return non-zero if the return-value is stored in a register, return + 0 if the return-value is instead stored on the stack (a.k.a., + struct return convention). + + For a return-value stored in a register: when WRITEBUF is non-NULL, + copy the buffer to the corresponding register return-value location + location; when READBUF is non-NULL, fill the buffer from the + corresponding register return-value location. */ +enum return_value_convention +ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) { - if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) - && TYPE_VECTOR (value_type)) - return 0; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + /* Floats and doubles in F1. */ + if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8) + { + char regval[MAX_REGISTER_SIZE]; + struct type *regtype = register_type (gdbarch, FP0_REGNUM); + if (writebuf != NULL) + { + convert_typed_floating (writebuf, valtype, regval, regtype); + regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); + } + if (readbuf != NULL) + { + regcache_cooked_read (regcache, FP0_REGNUM + 1, regval); + convert_typed_floating (regval, regtype, readbuf, valtype); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 8) + { + /* Integers in r3. */ + if (writebuf != NULL) + { + /* Be careful to sign extend the value. */ + regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3, + unpack_long (valtype, writebuf)); + } + if (readbuf != NULL) + { + /* Extract the integer from r3. Since this is truncating the + value, there isn't a sign extension problem. */ + ULONGEST regval; + regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3, + ®val); + store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), regval); + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + /* All pointers live in r3. */ + if (TYPE_CODE (valtype) == TYPE_CODE_PTR) + { + /* All pointers live in r3. */ + if (writebuf != NULL) + regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, writebuf); + if (readbuf != NULL) + regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf); + return RETURN_VALUE_REGISTER_CONVENTION; + } + if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY + && TYPE_LENGTH (valtype) <= 8 + && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT + && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) + { + /* Small character arrays are returned, right justified, in r3. */ + int offset = (register_size (gdbarch, tdep->ppc_gp0_regnum + 3) + - TYPE_LENGTH (valtype)); + if (writebuf != NULL) + regcache_cooked_write_part (regcache, tdep->ppc_gp0_regnum + 3, + offset, TYPE_LENGTH (valtype), writebuf); + if (readbuf != NULL) + regcache_cooked_read_part (regcache, tdep->ppc_gp0_regnum + 3, + offset, TYPE_LENGTH (valtype), readbuf); + return RETURN_VALUE_REGISTER_CONVENTION; + } + /* Big floating point values get stored in adjacent floating + point registers. */ + if (TYPE_CODE (valtype) == TYPE_CODE_FLT + && (TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 32)) + { + if (writebuf || readbuf != NULL) + { + int i; + for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++) + { + if (writebuf != NULL) + regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + (const bfd_byte *) writebuf + i * 8); + if (readbuf != NULL) + regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, + (bfd_byte *) readbuf + i * 8); + } + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + /* Complex values get returned in f1:f2, need to convert. */ + if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX + && (TYPE_LENGTH (valtype) == 8 || TYPE_LENGTH (valtype) == 16)) + { + if (regcache != NULL) + { + int i; + for (i = 0; i < 2; i++) + { + char regval[MAX_REGISTER_SIZE]; + struct type *regtype = + register_type (current_gdbarch, FP0_REGNUM); + if (writebuf != NULL) + { + convert_typed_floating ((const bfd_byte *) writebuf + + i * (TYPE_LENGTH (valtype) / 2), + valtype, regval, regtype); + regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + regval); + } + if (readbuf != NULL) + { + regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, regval); + convert_typed_floating (regval, regtype, + (bfd_byte *) readbuf + + i * (TYPE_LENGTH (valtype) / 2), + valtype); + } + } + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + /* Big complex values get stored in f1:f4. */ + if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX && TYPE_LENGTH (valtype) == 32) + { + if (regcache != NULL) + { + int i; + for (i = 0; i < 4; i++) + { + if (writebuf != NULL) + regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + (const bfd_byte *) writebuf + i * 8); + if (readbuf != NULL) + regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, + (bfd_byte *) readbuf + i * 8); + } + } + return RETURN_VALUE_REGISTER_CONVENTION; + } + return RETURN_VALUE_STRUCT_CONVENTION; +} - return (TYPE_LENGTH (value_type) > 8); -} +CORE_ADDR +ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr) +{ + /* PPC64 SYSV specifies that the minimal-symbol "FN" should point at + a function-descriptor while the corresponding minimal-symbol + ".FN" should point at the entry point. Consequently, a command + like "break FN" applied to an object file with only minimal + symbols, will insert the breakpoint into the descriptor at "FN" + and not the function at ".FN". Avoid this confusion by adjusting + any attempt to set a descriptor breakpoint into a corresponding + function breakpoint. Note that GDB warns the user when this + adjustment is applied - that's ok as otherwise the user will have + no way of knowing why their breakpoint at "FN" resulted in the + program stopping at ".FN". */ + return gdbarch_convert_from_func_ptr_addr (gdbarch, bpaddr, ¤t_target); +} diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index dd84fd1..1c1c9ef 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -26,6 +26,7 @@ struct gdbarch; struct frame_info; struct value; struct regcache; +struct type; /* From ppc-linux-tdep.c... */ CORE_ADDR ppc_linux_frame_saved_pc (struct frame_info *fi); @@ -33,8 +34,16 @@ void ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *); int ppc_linux_frameless_function_invocation (struct frame_info *); void ppc_linux_frame_init_saved_regs (struct frame_info *); CORE_ADDR ppc_linux_frame_chain (struct frame_info *); -int ppc_sysv_abi_use_struct_convention (int, struct type *); -int ppc_sysv_abi_broken_use_struct_convention (int, struct type *); +enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch, + struct type *valtype, + struct regcache *regcache, + void *readbuf, + const void *writebuf); +enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch, + struct type *valtype, + struct regcache *regcache, + void *readbuf, + const void *writebuf); CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, @@ -42,11 +51,25 @@ CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, + CORE_ADDR func_addr, + struct regcache *regcache, + CORE_ADDR bp_addr, int nargs, + struct value **args, CORE_ADDR sp, + int struct_return, + CORE_ADDR struct_addr); +CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr); int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache); struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void); void ppc_linux_supply_gregset (char *buf); void ppc_linux_supply_fpregset (char *buf); +enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, + struct type *valtype, + struct regcache *regcache, + void *readbuf, + const void *writebuf); /* From rs6000-tdep.c... */ CORE_ADDR rs6000_frame_saved_pc (struct frame_info *fi); diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 21ab858..adc2a4f 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -204,12 +204,37 @@ ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) return (nbsd_pc_in_sigtramp (pc, func_name)); } +/* NetBSD is confused. It appears that 1.5 was using the correct SVr4 + convention but, 1.6 switched to the below broken convention. For + the moment use the broken convention. Ulgh!. */ + +static enum return_value_convention +ppcnbsd_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) +{ + if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT + || TYPE_CODE (valtype) == TYPE_CODE_UNION) + && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) + && TYPE_VECTOR (valtype)) + && !(TYPE_LENGTH (valtype) == 1 + || TYPE_LENGTH (valtype) == 2 + || TYPE_LENGTH (valtype) == 4 + || TYPE_LENGTH (valtype) == 8)) + return RETURN_VALUE_STRUCT_CONVENTION; + else + return ppc_sysv_abi_broken_return_value (gdbarch, valtype, regcache, + readbuf, writebuf); +} + static void ppcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp); - + /* For NetBSD, this is an on again, off again thing. Some systems + do use the broken struct convention, and some don't. */ + set_gdbarch_return_value (gdbarch, ppcnbsd_return_value); set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 6e4765a..3f992e8 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -943,7 +943,6 @@ print_command_1 (char *exp, int inspect, int voidprint) inspect_it = 0; /* Reset print routines to normal */ } -/* ARGSUSED */ static void print_command (char *exp, int from_tty) { @@ -951,7 +950,6 @@ print_command (char *exp, int from_tty) } /* Same as print, except in epoch, it gets its own window */ -/* ARGSUSED */ static void inspect_command (char *exp, int from_tty) { @@ -961,14 +959,12 @@ inspect_command (char *exp, int from_tty) } /* Same as print, except it doesn't print void results. */ -/* ARGSUSED */ static void call_command (char *exp, int from_tty) { print_command_1 (exp, 0, 0); } -/* ARGSUSED */ void output_command (char *exp, int from_tty) { @@ -1003,7 +999,6 @@ output_command (char *exp, int from_tty) do_cleanups (old_chain); } -/* ARGSUSED */ static void set_command (char *exp, int from_tty) { @@ -1014,7 +1009,6 @@ set_command (char *exp, int from_tty) do_cleanups (old_chain); } -/* ARGSUSED */ static void sym_info (char *arg, int from_tty) { @@ -1059,7 +1053,6 @@ sym_info (char *arg, int from_tty) printf_filtered ("No symbol matches %s.\n", arg); } -/* ARGSUSED */ static void address_info (char *exp, int from_tty) { @@ -1695,7 +1688,6 @@ enable_display (char *args, int from_tty) } } -/* ARGSUSED */ static void disable_display_command (char *args, int from_tty) { @@ -1738,7 +1730,6 @@ print_variable_value (struct symbol *var, struct frame_info *frame, value_print (val, stream, 0, Val_pretty_default); } -/* ARGSUSED */ static void printf_command (char *arg, int from_tty) { diff --git a/gdb/procfs.c b/gdb/procfs.c index 11fa6f3..a92b849 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -5519,7 +5519,6 @@ mappingflags (long flags) * Callback function, does the actual work for 'info proc mappings'. */ -/* ARGSUSED */ static int info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused) { diff --git a/gdb/regcache.c b/gdb/regcache.c index 3561d7c..62c0de5 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -107,14 +107,14 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch, for (i = 0; i < descr->nr_cooked_registers; i++) { /* FIXME: cagney/2001-12-04: This code shouldn't need to use - DEPRECATED_REGISTER_BYTE(). Unfortunatly, legacy code likes + DEPRECATED_REGISTER_BYTE(). Unfortunately, legacy code likes to lay the buffer out so that certain registers just happen to overlap. Ulgh! New targets use gdbarch's register read/write and entirely avoid this uglyness. */ descr->register_offset[i] = DEPRECATED_REGISTER_BYTE (i); - descr->sizeof_register[i] = REGISTER_RAW_SIZE (i); - gdb_assert (MAX_REGISTER_SIZE >= REGISTER_RAW_SIZE (i)); - gdb_assert (MAX_REGISTER_SIZE >= REGISTER_VIRTUAL_SIZE (i)); + descr->sizeof_register[i] = DEPRECATED_REGISTER_RAW_SIZE (i); + gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_RAW_SIZE (i)); + gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_VIRTUAL_SIZE (i)); } /* Compute the real size of the register buffer. Start out by @@ -138,7 +138,7 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch, descr->sizeof_cooked_registers = regend; } /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers - in the register cache. Unfortunatly some architectures still + in the register cache. Unfortunately some architectures still rely on this and the pseudo_register_write() method. */ descr->sizeof_raw_registers = descr->sizeof_cooked_registers; } @@ -167,11 +167,11 @@ init_regcache_descr (struct gdbarch *gdbarch) { if (gdbarch_register_type_p (gdbarch)) { - gdb_assert (!REGISTER_VIRTUAL_TYPE_P ()); /* OK */ + gdb_assert (!DEPRECATED_REGISTER_VIRTUAL_TYPE_P ()); /* OK */ descr->register_type[i] = gdbarch_register_type (gdbarch, i); } else - descr->register_type[i] = REGISTER_VIRTUAL_TYPE (i); /* OK */ + descr->register_type[i] = DEPRECATED_REGISTER_VIRTUAL_TYPE (i); /* OK */ } /* Construct a strictly RAW register cache. Don't allow pseudo's @@ -187,7 +187,7 @@ init_regcache_descr (struct gdbarch *gdbarch) /* If an old style architecture, fill in the remainder of the register cache descriptor using the register macros. */ /* NOTE: cagney/2003-06-29: If either of DEPRECATED_REGISTER_BYTE or - REGISTER_RAW_SIZE are still present, things are most likely + DEPRECATED_REGISTER_RAW_SIZE are still present, things are most likely totally screwed. Ex: an architecture with raw register sizes smaller than what DEPRECATED_REGISTER_BYTE indicates; non monotonic DEPRECATED_REGISTER_BYTE values. For GDB 6 check for @@ -196,7 +196,8 @@ init_regcache_descr (struct gdbarch *gdbarch) if ((!gdbarch_pseudo_register_read_p (gdbarch) && !gdbarch_pseudo_register_write_p (gdbarch) && !gdbarch_register_type_p (gdbarch)) - || DEPRECATED_REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ()) + || DEPRECATED_REGISTER_BYTE_P () + || DEPRECATED_REGISTER_RAW_SIZE_P ()) { descr->legacy_p = 1; init_legacy_regcache_descr (gdbarch, descr); @@ -228,7 +229,7 @@ init_regcache_descr (struct gdbarch *gdbarch) } /* FIXME: cagney/2002-05-22: Should only need to allocate space for - the raw registers. Unfortunatly some code still accesses the + the raw registers. Unfortunately some code still accesses the register array directly using the global registers[]. Until that code has been purged, play safe and over allocating the register buffer. Ulgh! */ @@ -242,8 +243,8 @@ init_regcache_descr (struct gdbarch *gdbarch) if (DEPRECATED_REGISTER_BYTE_P ()) gdb_assert (descr->register_offset[i] == DEPRECATED_REGISTER_BYTE (i)); #if 0 - gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i)); - gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i)); + gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_RAW_SIZE (i)); + gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_VIRTUAL_SIZE (i)); #endif } /* gdb_assert (descr->sizeof_raw_registers == DEPRECATED_REGISTER_BYTES (i)); */ @@ -278,9 +279,9 @@ register_size (struct gdbarch *gdbarch, int regnum) int size; gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS)); size = descr->sizeof_register[regnum]; - /* NB: The deprecated REGISTER_RAW_SIZE, if not provided, defaults + /* NB: The deprecated DEPRECATED_REGISTER_RAW_SIZE, if not provided, defaults to the size of the register's type. */ - gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */ + gdb_assert (size == DEPRECATED_REGISTER_RAW_SIZE (regnum)); /* OK */ /* NB: Don't check the register's virtual size. It, in say the case of the MIPS, may not match the raw size! */ return size; @@ -344,6 +345,14 @@ make_cleanup_regcache_xfree (struct regcache *regcache) return make_cleanup (do_regcache_xfree, regcache); } +/* Return REGCACHE's architecture. */ + +struct gdbarch * +get_regcache_arch (const struct regcache *regcache) +{ + return regcache->descr->gdbarch; +} + /* Return a pointer to register REGNUM's buffer cache. */ static char * @@ -653,7 +662,7 @@ deprecated_read_register_bytes (int in_start, char *in_buf, int in_len) int byte; reg_start = DEPRECATED_REGISTER_BYTE (regnum); - reg_len = REGISTER_RAW_SIZE (regnum); + reg_len = DEPRECATED_REGISTER_RAW_SIZE (regnum); reg_end = reg_start + reg_len; if (reg_end <= in_start || in_end <= reg_start) @@ -718,7 +727,7 @@ legacy_read_register_gen (int regnum, char *myaddr) target_fetch_registers (regnum); memcpy (myaddr, register_buffer (current_regcache, regnum), - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); } void @@ -905,7 +914,7 @@ legacy_write_register_gen (int regnum, const void *myaddr) registers_ptid = inferior_ptid; } - size = REGISTER_RAW_SIZE (regnum); + size = DEPRECATED_REGISTER_RAW_SIZE (regnum); if (real_register (regnum)) { @@ -1015,7 +1024,7 @@ deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen) int regstart, regend; regstart = DEPRECATED_REGISTER_BYTE (regnum); - regend = regstart + REGISTER_RAW_SIZE (regnum); + regend = regstart + DEPRECATED_REGISTER_RAW_SIZE (regnum); /* Is this register completely outside the range the user is writing? */ if (myregend <= regstart || regend <= myregstart) @@ -1144,9 +1153,9 @@ register_offset_hack (struct gdbarch *gdbarch, int regnum) ULONGEST read_register (int regnum) { - char *buf = alloca (REGISTER_RAW_SIZE (regnum)); + char *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum)); deprecated_read_register_gen (regnum, buf); - return (extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum))); + return (extract_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum))); } ULONGEST @@ -1177,7 +1186,7 @@ write_register (int regnum, LONGEST val) { void *buf; int size; - size = REGISTER_RAW_SIZE (regnum); + size = DEPRECATED_REGISTER_RAW_SIZE (regnum); buf = alloca (size); store_signed_integer (buf, size, (LONGEST) val); deprecated_write_register_gen (regnum, buf); @@ -1407,7 +1416,6 @@ deprecated_read_fp (void) internal_error (__FILE__, __LINE__, "deprecated_read_fp"); } -/* ARGSUSED */ static void reg_flush_command (char *command, int from_tty) { @@ -1544,9 +1552,9 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, fprintf_unfiltered (file, " %5ld", regcache->descr->sizeof_register[regnum]); if ((regcache->descr->sizeof_register[regnum] - != REGISTER_RAW_SIZE (regnum)) + != DEPRECATED_REGISTER_RAW_SIZE (regnum)) || (regcache->descr->sizeof_register[regnum] - != REGISTER_VIRTUAL_SIZE (regnum)) + != DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)) || (regcache->descr->sizeof_register[regnum] != TYPE_LENGTH (register_type (regcache->descr->gdbarch, regnum))) @@ -1602,7 +1610,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, regcache_raw_read (regcache, regnum, buf); fprintf_unfiltered (file, "0x"); dump_endian_bytes (file, TARGET_BYTE_ORDER, buf, - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); } } @@ -1616,7 +1624,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, regcache_cooked_read (regcache, regnum, buf); fprintf_unfiltered (file, "0x"); dump_endian_bytes (file, TARGET_BYTE_ORDER, buf, - REGISTER_VIRTUAL_SIZE (regnum)); + DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum)); } } diff --git a/gdb/regcache.h b/gdb/regcache.h index b8ac182..26a1b8a 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -32,6 +32,10 @@ void regcache_xfree (struct regcache *regcache); struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); struct regcache *regcache_xmalloc (struct gdbarch *gdbarch); +/* Return REGCACHE's architecture. */ + +extern struct gdbarch *get_regcache_arch (const struct regcache *regcache); + /* Transfer a raw register [0..NUM_REGS) between core-gdb and the regcache. */ @@ -117,9 +121,9 @@ extern int register_offset_hack (struct gdbarch *gdbarch, int regnum); value stored in a table. NOTE: cagney/2002-08-17: The original macro was called - REGISTER_VIRTUAL_TYPE. This was because the register could have - different raw and cooked (nee virtual) representations. The - CONVERTABLE methods being used to convert between the two + DEPRECATED_REGISTER_VIRTUAL_TYPE. This was because the register + could have different raw and cooked (nee virtual) representations. + The CONVERTABLE methods being used to convert between the two representations. Current code does not do this. Instead, the first [0..NUM_REGS) registers are 1:1 raw:cooked, and the type exactly describes the register's representation. Consequently, the @@ -136,15 +140,15 @@ extern struct type *register_type (struct gdbarch *gdbarch, int regnum); FIXME: cagney/2003-02-28: - Unfortunatly, thanks to some legacy architectures, this doesn't + Unfortunately, thanks to some legacy architectures, this doesn't hold. A register's cooked (nee virtual) and raw size can differ (see MIPS). Such architectures should be using different register numbers for the different sized views of identical registers. Anyway, the up-shot is that, until that mess is fixed, core code can end up being very confused - should the RAW or VIRTUAL size be - used? As a rule of thumb, use REGISTER_VIRTUAL_SIZE in cooked - code, but with the comment: + used? As a rule of thumb, use DEPRECATED_REGISTER_VIRTUAL_SIZE in + cooked code, but with the comment: OK: REGISTER_VIRTUAL_SIZE diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 94985fe..10d7362 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -1,4 +1,4 @@ -/* Remote debugging interface for Hitachi E7000 ICE, for GDB +/* Remote debugging interface for Renesas E7000 ICE, for GDB Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* The E7000 is an in-circuit emulator for the Hitachi H8/300-H and - Hitachi-SH processor. It has serial port and a lan port. +/* The E7000 is an in-circuit emulator for the Renesas H8/300-H and + Renesas-SH processor. It has serial port and a lan port. The monitor command set makes it difficult to load large ammounts of data over the lan without using ftp - so try not to issue load @@ -882,7 +882,7 @@ fetch_regs_from_dump (int (*nextchar) (), char *want) internal_error (__FILE__, __LINE__, "failed internal consistency check"); } store_signed_integer (buf, - REGISTER_RAW_SIZE (regno), + DEPRECATED_REGISTER_RAW_SIZE (regno), (LONGEST) get_hex (&thischar)); supply_register (regno, buf); break; @@ -1964,7 +1964,7 @@ sub2_from_pc (void) char buf2[200]; store_signed_integer (buf, - REGISTER_RAW_SIZE (PC_REGNUM), + DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM), read_register (PC_REGNUM) - 2); supply_register (PC_REGNUM, buf); sprintf (buf2, ".PC %s\r", phex_nz (read_register (PC_REGNUM), 0)); @@ -2131,8 +2131,8 @@ static void init_e7000_ops (void) { e7000_ops.to_shortname = "e7000"; - e7000_ops.to_longname = "Remote Hitachi e7000 target"; - e7000_ops.to_doc = "Use a remote Hitachi e7000 ICE connected by a serial line;\n\ + e7000_ops.to_longname = "Remote Renesas e7000 target"; + e7000_ops.to_doc = "Use a remote Renesas e7000 ICE connected by a serial line;\n\ or a network connection.\n\ Arguments are the name of the device for the serial line,\n\ the speed to connect at in bits per second.\n\ diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c index cd7f4d3..ee40051 100644 --- a/gdb/remote-hms.c +++ b/gdb/remote-hms.c @@ -1,4 +1,4 @@ -/* Remote debugging interface for Hitachi HMS Monitor Version 1.0 +/* Remote debugging interface for Renesas HMS Monitor Version 1.0 Copyright 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain @@ -149,7 +149,7 @@ _initialize_remote_hms (void) init_monitor_ops (&hms_ops); hms_ops.to_shortname = "hms"; - hms_ops.to_longname = "Hitachi Microsystems H8/300 debug monitor"; + hms_ops.to_longname = "Renesas Microsystems H8/300 debug monitor"; hms_ops.to_doc = "Debug via the HMS monitor.\n\ Specify the serial device it is connected to (e.g. /dev/ttya)."; hms_ops.to_open = hms_open; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 3dc3601..8512e444 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1494,10 +1494,6 @@ mips_initialize (void) the request itself succeeds or fails. */ mips_request ('r', 0, 0, &err, mips_receive_wait, NULL); - /* FIXME: cagney/2002-11-29: Force the update of selected frame. - This shouldn't be necessary, only many many places still refer to - selected_frame directly (instead of using get_selected_frame(). */ - get_selected_frame (); /* Hack!!! */ } /* Open a connection to the remote board. */ @@ -1793,16 +1789,16 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status) { char buf[MAX_REGISTER_SIZE]; - store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc); + store_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM), rpc); supply_register (PC_REGNUM, buf); - store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rfp); + store_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM), rfp); supply_register (30, buf); /* This register they are avoiding and so it is unnamed */ - store_unsigned_integer (buf, REGISTER_RAW_SIZE (SP_REGNUM), rsp); + store_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (SP_REGNUM), rsp); supply_register (SP_REGNUM, buf); - store_unsigned_integer (buf, REGISTER_RAW_SIZE (DEPRECATED_FP_REGNUM), 0); + store_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (DEPRECATED_FP_REGNUM), 0); supply_register (DEPRECATED_FP_REGNUM, buf); if (nfields == 9) @@ -1976,7 +1972,7 @@ mips_fetch_registers (int regno) /* We got the number the register holds, but gdb expects to see a value in the target byte ordering. */ - store_unsigned_integer (buf, REGISTER_RAW_SIZE (regno), val); + store_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regno), val); supply_register (regno, buf); } } diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index a868f38..bd208c1 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -524,7 +524,6 @@ arm_rdi_wait (ptid_t ptid, struct target_waitstatus *status) /* Read the remote registers into the block REGS. */ -/* ARGSUSED */ static void arm_rdi_fetch_registers (int regno) { @@ -624,7 +623,6 @@ arm_rdi_store_registers (int regno) if SHOULD_WRITE is nonzero. Returns length of data written or read; 0 for error. TARGET is unused. */ -/* ARGSUSED */ static int arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write, struct mem_attrib *attrib, diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c index a07827c..c920997 100644 --- a/gdb/remote-sds.c +++ b/gdb/remote-sds.c @@ -148,7 +148,6 @@ static int message_pending; /* Clean up connection to a remote debugger. */ -/* ARGSUSED */ static void sds_close (int quitting) { @@ -467,7 +466,6 @@ static unsigned char sprs[16]; /* Read the remote registers into the block REGS. */ /* Currently we just read all the registers, so we don't use regno. */ -/* ARGSUSED */ static void sds_fetch_registers (int regno) { @@ -657,7 +655,6 @@ sds_read_bytes (CORE_ADDR memaddr, char *myaddr, int len) if SHOULD_WRITE is nonzero. Returns length of data written or read; 0 for error. TARGET is unused. */ -/* ARGSUSED */ static int sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write, struct mem_attrib *attrib, struct target_ops *target) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 11424bb..538f8a4 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -320,14 +320,14 @@ gdbsim_fetch_register (int regno) memset (buf, 0, MAX_REGISTER_SIZE); nr_bytes = sim_fetch_register (gdbsim_desc, REGISTER_SIM_REGNO (regno), - buf, REGISTER_RAW_SIZE (regno)); - if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno) && warn_user) + buf, DEPRECATED_REGISTER_RAW_SIZE (regno)); + if (nr_bytes > 0 && nr_bytes != DEPRECATED_REGISTER_RAW_SIZE (regno) && warn_user) { fprintf_unfiltered (gdb_stderr, "Size of register %s (%d/%d) incorrect (%d instead of %d))", REGISTER_NAME (regno), regno, REGISTER_SIM_REGNO (regno), - nr_bytes, REGISTER_RAW_SIZE (regno)); + nr_bytes, DEPRECATED_REGISTER_RAW_SIZE (regno)); warn_user = 0; } /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' @@ -340,7 +340,7 @@ gdbsim_fetch_register (int regno) { printf_filtered ("gdbsim_fetch_register: %d", regno); /* FIXME: We could print something more intelligible. */ - dump_mem (buf, REGISTER_RAW_SIZE (regno)); + dump_mem (buf, DEPRECATED_REGISTER_RAW_SIZE (regno)); } break; } @@ -364,8 +364,8 @@ gdbsim_store_register (int regno) deprecated_read_register_gen (regno, tmp); nr_bytes = sim_store_register (gdbsim_desc, REGISTER_SIM_REGNO (regno), - tmp, REGISTER_RAW_SIZE (regno)); - if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)) + tmp, DEPRECATED_REGISTER_RAW_SIZE (regno)); + if (nr_bytes > 0 && nr_bytes != DEPRECATED_REGISTER_RAW_SIZE (regno)) internal_error (__FILE__, __LINE__, "Register size different to expected"); /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' @@ -375,7 +375,7 @@ gdbsim_store_register (int regno) { printf_filtered ("gdbsim_store_register: %d", regno); /* FIXME: We could print something more intelligible. */ - dump_mem (tmp, REGISTER_RAW_SIZE (regno)); + dump_mem (tmp, DEPRECATED_REGISTER_RAW_SIZE (regno)); } } } diff --git a/gdb/remote-st.c b/gdb/remote-st.c index 7c452a2..ce4c7ab 100644 --- a/gdb/remote-st.c +++ b/gdb/remote-st.c @@ -385,9 +385,10 @@ st2000_wait (ptid_t ptid, struct target_waitstatus *status) return inferior_ptid; } -/* Return the name of register number REGNO in the form input and output by - STDEBUG. Currently, REGISTER_NAMES just happens to contain exactly what - STDEBUG wants. Lets take advantage of that just as long as possible! */ +/* Return the name of register number REGNO in the form input and + output by STDEBUG. Currently, REGISTER_NAME just happens return + exactly what STDEBUG wants. Lets take advantage of that just as + long as possible! */ static char * get_reg_name (int regno) diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 74665e8..fd51781 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -1335,7 +1335,6 @@ vx_close (int quitting) } /* A vxprocess target should be started via "run" not "target". */ -/*ARGSUSED */ static void vx_proc_open (char *name, int from_tty) { diff --git a/gdb/remote-vx68.c b/gdb/remote-vx68.c index 3e21fe6..8cdac6f 100644 --- a/gdb/remote-vx68.c +++ b/gdb/remote-vx68.c @@ -111,10 +111,10 @@ vx_read_register (int regno) } else { - bzero (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], - MC68K_FPREG_SIZE * 8); - bzero (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FPC_REGNUM)], - MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], + 0, MC68K_FPREG_SIZE * 8); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FPC_REGNUM)], + 0, MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); } /* Mark the register cache valid. */ diff --git a/gdb/remote-vxmips.c b/gdb/remote-vxmips.c index 28a4070..6cc7ca5 100644 --- a/gdb/remote-vxmips.c +++ b/gdb/remote-vxmips.c @@ -131,20 +131,20 @@ vx_read_register (int regno) bcopy (&mips_fpreg_packet[MIPS_R_FP0], &deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); + DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) * 32); /* Copy the floating point control/status register (fpcsr). */ bcopy (&mips_fpreg_packet[MIPS_R_FPCSR], &deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); } else { - bzero ((char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - bzero ((char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], + 0, DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) * 32); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], + 0, DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); } /* Mark the register cache valid. */ @@ -187,13 +187,13 @@ vx_write_register (int regno) bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], &mips_fpreg_packet[MIPS_R_FP0], - REGISTER_RAW_SIZE (FP0_REGNUM) * 32); + DEPRECATED_REGISTER_RAW_SIZE (FP0_REGNUM) * 32); /* Copy the floating point control/status register (fpcsr). */ bcopy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FCRCS_REGNUM)], &mips_fpreg_packet[MIPS_R_FPCSR], - REGISTER_RAW_SIZE (FCRCS_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (FCRCS_REGNUM)); net_write_registers (mips_fpreg_packet, MIPS_FPREG_PLEN, PTRACE_SETFPREGS); diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c index 339b99f..d313c8f 100644 --- a/gdb/remote-vxsparc.c +++ b/gdb/remote-vxsparc.c @@ -102,9 +102,9 @@ vx_read_register (int regno) automatically; it greatly simplifies debugging. */ sp = extract_unsigned_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)], - REGISTER_RAW_SIZE (SP_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (SP_REGNUM)); write_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); /* If the target has floating point registers, fetch them. Otherwise, zero the floating point register values in @@ -124,10 +124,10 @@ vx_read_register (int regno) } else { - bzero (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], - 32 * SPARC_FPREG_SIZE); - bzero (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FPS_REGNUM)], - 1 * SPARC_FPREG_SIZE); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM)], + 0, 32 * SPARC_FPREG_SIZE); + memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FPS_REGNUM)], + 0, 1 * SPARC_FPREG_SIZE); } /* Mark the register cache valid. */ @@ -177,9 +177,9 @@ vx_write_register (int regno) if (regno < 0 || (L0_REGNUM <= regno && regno <= I7_REGNUM)) { sp = extract_unsigned_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)], - REGISTER_RAW_SIZE (SP_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (SP_REGNUM)); write_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); } } diff --git a/gdb/remote.c b/gdb/remote.c index ae17b53..80726bc 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -161,8 +161,6 @@ static int ishex (int ch, int *val); static int stubhex (int ch); -static int remote_query (int /*char */ , char *, char *, int *); - static int hexnumstr (char *, ULONGEST); static int hexnumnstr (char *, ULONGEST, int); @@ -206,7 +204,7 @@ void _initialize_remote (void); /* Description of the remote protocol. Strictly speaking, when the target is open()ed, remote.c should create a per-target description of the remote protocol using that target's architecture. - Unfortunatly, the target stack doesn't include local state. For + Unfortunately, the target stack doesn't include local state. For the moment keep the information in the target's architecture object. Sigh.. */ @@ -216,7 +214,7 @@ struct packet_reg long regnum; /* GDB's internal register number. */ LONGEST pnum; /* Remote protocol register number. */ int in_g_packet; /* Always part of G packet. */ - /* long size in bytes; == REGISTER_RAW_SIZE (regnum); at present. */ + /* long size in bytes; == DEPRECATED_REGISTER_RAW_SIZE (regnum); at present. */ /* char *name; == REGISTER_NAME (regnum); at present. */ }; @@ -749,6 +747,23 @@ packet_ok (const char *buf, struct packet_config *config) } } +/* Should we try the 'vCont' (descriptive resume) request? */ +static struct packet_config remote_protocol_vcont; + +static void +set_remote_protocol_vcont_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + update_packet_config (&remote_protocol_vcont); +} + +static void +show_remote_protocol_vcont_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) +{ + show_packet_config_cmd (&remote_protocol_vcont); +} + /* Should we try the 'qSymbol' (target symbol lookup service) request? */ static struct packet_config remote_protocol_qSymbol; @@ -1903,7 +1918,6 @@ extended_remote_restart (void) /* Clean up connection to a remote debugger. */ -/* ARGSUSED */ static void remote_close (int quitting) { @@ -2191,6 +2205,7 @@ init_all_packet_configs (void) update_packet_config (&remote_protocol_E); update_packet_config (&remote_protocol_P); update_packet_config (&remote_protocol_qSymbol); + update_packet_config (&remote_protocol_vcont); for (i = 0; i < NR_Z_PACKET_TYPES; i++) update_packet_config (&remote_protocol_Z[i]); /* Force remote_write_bytes to check whether target supports binary @@ -2353,7 +2368,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, FIXME: cagney/2002-05-19: Instead of re-throwing the exception, this function should return an error indication letting the - caller restore the previous state. Unfortunatly the command + caller restore the previous state. Unfortunately the command ``target remote'' is directly wired to this function making that impossible. On a positive note, the CLI side of this problem has been fixed - the function set_cmd_context() makes it possible for @@ -2507,115 +2522,144 @@ bin2hex (const char *bin, char *hex, int count) return i; } -/* Tell the remote machine to resume. */ - -static enum target_signal last_sent_signal = TARGET_SIGNAL_0; - -static int last_sent_step; +/* Check for the availability of vCont. This function should also check + the response. */ static void -remote_resume (ptid_t ptid, int step, enum target_signal siggnal) +remote_vcont_probe (struct remote_state *rs, char *buf) { - struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); - int pid = PIDGET (ptid); - char *p; + strcpy (buf, "vCont?"); + putpkt (buf); + getpkt (buf, rs->remote_packet_size, 0); - if (pid == -1) - set_thread (0, 0); /* run any thread */ - else - set_thread (pid, 0); /* run this thread */ + /* Make sure that the features we assume are supported. */ + if (strncmp (buf, "vCont", 5) == 0) + { + char *p = &buf[5]; + int support_s, support_S, support_c, support_C; + + support_s = 0; + support_S = 0; + support_c = 0; + support_C = 0; + while (p && *p == ';') + { + p++; + if (*p == 's' && (*(p + 1) == ';' || *(p + 1) == 0)) + support_s = 1; + else if (*p == 'S' && (*(p + 1) == ';' || *(p + 1) == 0)) + support_S = 1; + else if (*p == 'c' && (*(p + 1) == ';' || *(p + 1) == 0)) + support_c = 1; + else if (*p == 'C' && (*(p + 1) == ';' || *(p + 1) == 0)) + support_C = 1; + + p = strchr (p, ';'); + } - last_sent_signal = siggnal; - last_sent_step = step; + /* If s, S, c, and C are not all supported, we can't use vCont. Clearing + BUF will make packet_ok disable the packet. */ + if (!support_s || !support_S || !support_c || !support_C) + buf[0] = 0; + } - /* A hook for when we need to do something at the last moment before - resumption. */ - if (target_resume_hook) - (*target_resume_hook) (); + packet_ok (buf, &remote_protocol_vcont); +} +/* Resume the remote inferior by using a "vCont" packet. The thread + to be resumed is PTID; STEP and SIGGNAL indicate whether the + resumed thread should be single-stepped and/or signalled. If PTID's + PID is -1, then all threads are resumed; the thread to be stepped and/or + signalled is given in the global INFERIOR_PTID. This function returns + non-zero iff it resumes the inferior. - /* The s/S/c/C packets do not return status. So if the target does - not support the S or C packets, the debug agent returns an empty - string which is detected in remote_wait(). This protocol defect - is fixed in the e/E packets. */ + This function issues a strict subset of all possible vCont commands at the + moment. */ - if (step && step_range_end) - { - /* If the target does not support the 'E' packet, we try the 'S' - packet. Ideally we would fall back to the 'e' packet if that - too is not supported. But that would require another copy of - the code to issue the 'e' packet (and fall back to 's' if not - supported) in remote_wait(). */ - - if (siggnal != TARGET_SIGNAL_0) - { - if (remote_protocol_E.support != PACKET_DISABLE) - { - p = buf; - *p++ = 'E'; - *p++ = tohex (((int) siggnal >> 4) & 0xf); - *p++ = tohex (((int) siggnal) & 0xf); - *p++ = ','; - p += hexnumstr (p, (ULONGEST) step_range_start); - *p++ = ','; - p += hexnumstr (p, (ULONGEST) step_range_end); - *p++ = 0; - - putpkt (buf); - getpkt (buf, (rs->remote_packet_size), 0); +static int +remote_vcont_resume (ptid_t ptid, int step, enum target_signal siggnal) +{ + struct remote_state *rs = get_remote_state (); + int pid = PIDGET (ptid); + char *buf = NULL; + struct cleanup *old_cleanup; - if (packet_ok (buf, &remote_protocol_E) == PACKET_OK) - return; - } - } - else - { - if (remote_protocol_e.support != PACKET_DISABLE) - { - p = buf; - *p++ = 'e'; - p += hexnumstr (p, (ULONGEST) step_range_start); - *p++ = ','; - p += hexnumstr (p, (ULONGEST) step_range_end); - *p++ = 0; + buf = xmalloc (rs->remote_packet_size); + old_cleanup = make_cleanup (xfree, buf); - putpkt (buf); - getpkt (buf, (rs->remote_packet_size), 0); + if (remote_protocol_vcont.support == PACKET_SUPPORT_UNKNOWN) + remote_vcont_probe (rs, buf); - if (packet_ok (buf, &remote_protocol_e) == PACKET_OK) - return; - } - } + if (remote_protocol_vcont.support == PACKET_DISABLE) + { + do_cleanups (old_cleanup); + return 0; } - if (siggnal != TARGET_SIGNAL_0) + /* If we could generate a wider range of packets, we'd have to worry + about overflowing BUF. Should there be a generic + "multi-part-packet" packet? */ + + if (PIDGET (inferior_ptid) == MAGIC_NULL_PID) { - buf[0] = step ? 'S' : 'C'; - buf[1] = tohex (((int) siggnal >> 4) & 0xf); - buf[2] = tohex (((int) siggnal) & 0xf); - buf[3] = '\0'; + /* MAGIC_NULL_PTID means that we don't have any active threads, so we + don't have any PID numbers the inferior will understand. Make sure + to only send forms that do not specify a PID. */ + if (step && siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;S%02x", siggnal); + else if (step) + sprintf (buf, "vCont;s"); + else if (siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;C%02x", siggnal); + else + sprintf (buf, "vCont;c"); + } + else if (pid == -1) + { + /* Resume all threads, with preference for INFERIOR_PTID. */ + if (step && siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;S%02x:%x;c", siggnal, PIDGET (inferior_ptid)); + else if (step) + sprintf (buf, "vCont;s:%x;c", PIDGET (inferior_ptid)); + else if (siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;C%02x:%x;c", siggnal, PIDGET (inferior_ptid)); + else + sprintf (buf, "vCont;c"); } else - strcpy (buf, step ? "s" : "c"); + { + /* Scheduler locking; resume only PTID. */ + if (step && siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;S%02x:%x", siggnal, pid); + else if (step) + sprintf (buf, "vCont;s:%x", pid); + else if (siggnal != TARGET_SIGNAL_0) + sprintf (buf, "vCont;C%02x:%x", siggnal, pid); + else + sprintf (buf, "vCont;c:%x", pid); + } putpkt (buf); + + do_cleanups (old_cleanup); + + return 1; } -/* Same as remote_resume, but with async support. */ +/* Tell the remote machine to resume. */ + +static enum target_signal last_sent_signal = TARGET_SIGNAL_0; + +static int last_sent_step; + static void -remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) +remote_resume (ptid_t ptid, int step, enum target_signal siggnal) { struct remote_state *rs = get_remote_state (); char *buf = alloca (rs->remote_packet_size); int pid = PIDGET (ptid); char *p; - if (pid == -1) - set_thread (0, 0); /* run any thread */ - else - set_thread (pid, 0); /* run this thread */ - last_sent_signal = siggnal; last_sent_step = step; @@ -2624,6 +2668,16 @@ remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) if (target_resume_hook) (*target_resume_hook) (); + /* The vCont packet doesn't need to specify threads via Hc. */ + if (remote_vcont_resume (ptid, step, siggnal)) + return; + + /* All other supported resume packets do use Hc, so call set_thread. */ + if (pid == -1) + set_thread (0, 0); /* run any thread */ + else + set_thread (pid, 0); /* run this thread */ + /* The s/S/c/C packets do not return status. So if the target does not support the S or C packets, the debug agent returns an empty string which is detected in remote_wait(). This protocol defect @@ -2655,7 +2709,7 @@ remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) getpkt (buf, (rs->remote_packet_size), 0); if (packet_ok (buf, &remote_protocol_E) == PACKET_OK) - goto register_event_loop; + return; } } else @@ -2673,7 +2727,7 @@ remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) getpkt (buf, (rs->remote_packet_size), 0); if (packet_ok (buf, &remote_protocol_e) == PACKET_OK) - goto register_event_loop; + return; } } } @@ -2682,15 +2736,21 @@ remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) { buf[0] = step ? 'S' : 'C'; buf[1] = tohex (((int) siggnal >> 4) & 0xf); - buf[2] = tohex ((int) siggnal & 0xf); + buf[2] = tohex (((int) siggnal) & 0xf); buf[3] = '\0'; } else strcpy (buf, step ? "s" : "c"); - + putpkt (buf); +} + +/* Same as remote_resume, but with async support. */ +static void +remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal) +{ + remote_resume (ptid, step, siggnal); -register_event_loop: /* We are about to start executing the inferior, let's register it with the event loop. NOTE: this is the one place where all the execution commands end up. We could alternatively do this in each @@ -3027,9 +3087,9 @@ Packet: '%s'\n", error ("Remote sent bad register number %s: %s\nPacket: '%s'\n", phex_nz (pnum, 0), p, buf); - fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (reg->regnum)); + fieldsize = hex2bin (p, regs, DEPRECATED_REGISTER_RAW_SIZE (reg->regnum)); p += 2 * fieldsize; - if (fieldsize < REGISTER_RAW_SIZE (reg->regnum)) + if (fieldsize < DEPRECATED_REGISTER_RAW_SIZE (reg->regnum)) warning ("Remote reply is too short: %s", buf); supply_register (reg->regnum, regs); } @@ -3275,9 +3335,9 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status) error ("Remote sent bad register number %ld: %s\nPacket: '%s'\n", pnum, p, buf); - fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (reg->regnum)); + fieldsize = hex2bin (p, regs, DEPRECATED_REGISTER_RAW_SIZE (reg->regnum)); p += 2 * fieldsize; - if (fieldsize < REGISTER_RAW_SIZE (reg->regnum)) + if (fieldsize < DEPRECATED_REGISTER_RAW_SIZE (reg->regnum)) warning ("Remote reply is too short: %s", buf); supply_register (reg->regnum, regs); } @@ -3416,7 +3476,6 @@ static int register_bytes_found; /* Read the remote registers into the block REGS. */ /* Currently we just read all the registers, so we don't use regnum. */ -/* ARGSUSED */ static void remote_fetch_registers (int regnum) { @@ -3553,7 +3612,7 @@ store_register_using_P (int regnum) sprintf (buf, "P%s=", phex_nz (reg->pnum, 0)); p = buf + strlen (buf); regcache_collect (reg->regnum, regp); - bin2hex (regp, p, REGISTER_RAW_SIZE (reg->regnum)); + bin2hex (regp, p, DEPRECATED_REGISTER_RAW_SIZE (reg->regnum)); remote_send (buf, rs->remote_packet_size); return buf[0] != '\0'; @@ -3970,7 +4029,6 @@ remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len) SHOULD_WRITE is nonzero. Returns length of data written or read; 0 for error. TARGET is unused. */ -/* ARGSUSED */ static int remote_xfer_memory (CORE_ADDR mem_addr, char *buffer, int mem_len, int should_write, struct mem_attrib *attrib, @@ -3995,73 +4053,6 @@ remote_xfer_memory (CORE_ADDR mem_addr, char *buffer, int mem_len, return res; } - -#if 0 -/* Enable after 4.12. */ - -void -remote_search (int len, char *data, char *mask, CORE_ADDR startaddr, - int increment, CORE_ADDR lorange, CORE_ADDR hirange, - CORE_ADDR *addr_found, char *data_found) -{ - if (increment == -4 && len == 4) - { - long mask_long, data_long; - long data_found_long; - CORE_ADDR addr_we_found; - char *buf = alloca (rs->remote_packet_size); - long returned_long[2]; - char *p; - - mask_long = extract_unsigned_integer (mask, len); - data_long = extract_unsigned_integer (data, len); - sprintf (buf, "t%x:%x,%x", startaddr, data_long, mask_long); - putpkt (buf); - getpkt (buf, (rs->remote_packet_size), 0); - if (buf[0] == '\0') - { - /* The stub doesn't support the 't' request. We might want to - remember this fact, but on the other hand the stub could be - switched on us. Maybe we should remember it only until - the next "target remote". */ - generic_search (len, data, mask, startaddr, increment, lorange, - hirange, addr_found, data_found); - return; - } - - if (buf[0] == 'E') - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just use EIO. */ - memory_error (EIO, startaddr); - p = buf; - addr_we_found = 0; - while (*p != '\0' && *p != ',') - addr_we_found = (addr_we_found << 4) + fromhex (*p++); - if (*p == '\0') - error ("Protocol error: short return for search"); - - data_found_long = 0; - while (*p != '\0' && *p != ',') - data_found_long = (data_found_long << 4) + fromhex (*p++); - /* Ignore anything after this comma, for future extensions. */ - - if (addr_we_found < lorange || addr_we_found >= hirange) - { - *addr_found = 0; - return; - } - - *addr_found = addr_we_found; - *data_found = store_unsigned_integer (data_we_found, len); - return; - } - generic_search (len, data, mask, startaddr, increment, lorange, - hirange, addr_found, data_found); -} -#endif /* 0 */ - static void remote_files_info (struct target_ops *ignore) { @@ -5113,41 +5104,51 @@ the loaded file\n"); printf_filtered ("No loaded section named '%s'.\n", args); } -static int -remote_query (int query_type, char *buf, char *outbuf, int *bufsiz) +static LONGEST +remote_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len) { struct remote_state *rs = get_remote_state (); int i; char *buf2 = alloca (rs->remote_packet_size); char *p2 = &buf2[0]; + char query_type; - if (!bufsiz) - error ("null pointer to remote bufer size specified"); + /* Only handle reads. */ + if (writebuf != NULL || readbuf == NULL) + return -1; - /* minimum outbuf size is (rs->remote_packet_size) - if bufsiz is not large enough let - the caller know and return what the minimum size is */ - /* Note: a zero bufsiz can be used to query the minimum buffer size */ - if (*bufsiz < (rs->remote_packet_size)) + /* Map pre-existing objects onto letters. DO NOT do this for new + objects!!! Instead specify new query packets. */ + switch (object) { - *bufsiz = (rs->remote_packet_size); + case TARGET_OBJECT_KOD: + query_type = 'K'; + break; + case TARGET_OBJECT_AVR: + query_type = 'R'; + break; + default: return -1; } + /* Note: a zero OFFSET and LEN can be used to query the minimum + buffer size. */ + if (offset == 0 && len == 0) + return (rs->remote_packet_size); + /* Minimum outbuf size is (rs->remote_packet_size) - if bufsiz is + not large enough let the caller. */ + if (len < (rs->remote_packet_size)) + return -1; + len = rs->remote_packet_size; + /* except for querying the minimum buffer size, target must be open */ if (!remote_desc) error ("remote query is only available after target open"); - /* we only take uppercase letters as query types, at least for now */ - if ((query_type < 'A') || (query_type > 'Z')) - error ("invalid remote query type"); - - if (!buf) - error ("null remote query specified"); - - if (!outbuf) - error ("remote query requires a buffer to receive data"); - - outbuf[0] = '\0'; + gdb_assert (annex != NULL); + gdb_assert (readbuf != NULL); *p2++ = 'q'; *p2++ = query_type; @@ -5157,27 +5158,23 @@ remote_query (int query_type, char *buf, char *outbuf, int *bufsiz) plus one extra in case we are debugging (remote_debug), we have PBUFZIZ - 7 left to pack the query string */ i = 0; - while (buf[i] && (i < ((rs->remote_packet_size) - 8))) + while (annex[i] && (i < ((rs->remote_packet_size) - 8))) { - /* bad caller may have sent forbidden characters */ - if ((!isprint (buf[i])) || (buf[i] == '$') || (buf[i] == '#')) - error ("illegal characters in query string"); - - *p2++ = buf[i]; + /* Bad caller may have sent forbidden characters. */ + gdb_assert (isprint (annex[i]) && annex[i] != '$' && annex[i] != '#'); + *p2++ = annex[i]; i++; } - *p2 = buf[i]; - - if (buf[i]) - error ("query larger than available buffer"); + *p2 = '\0'; + gdb_assert (annex[i] == '\0'); i = putpkt (buf2); if (i < 0) return i; - getpkt (outbuf, *bufsiz, 0); + getpkt (readbuf, len, 0); - return 0; + return strlen (readbuf); } static void @@ -5455,7 +5452,7 @@ Specify the serial device it is connected to\n\ remote_ops.to_pid_to_str = remote_pid_to_str; remote_ops.to_extra_thread_info = remote_threads_extra_info; remote_ops.to_stop = remote_stop; - remote_ops.to_query = remote_query; + remote_ops.to_xfer_partial = remote_xfer_partial; remote_ops.to_rcmd = remote_rcmd; remote_ops.to_stratum = process_stratum; remote_ops.to_has_all_memory = 1; @@ -5975,7 +5972,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; remote_async_ops.to_pid_to_str = remote_pid_to_str; remote_async_ops.to_extra_thread_info = remote_threads_extra_info; remote_async_ops.to_stop = remote_stop; - remote_async_ops.to_query = remote_query; + remote_async_ops.to_xfer_partial = remote_xfer_partial; remote_async_ops.to_rcmd = remote_rcmd; remote_async_ops.to_stratum = process_stratum; remote_async_ops.to_has_all_memory = 1; @@ -6025,6 +6022,7 @@ show_remote_cmd (char *args, int from_tty) show_remote_protocol_E_packet_cmd (args, from_tty, NULL); show_remote_protocol_P_packet_cmd (args, from_tty, NULL); show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL); + show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL); show_remote_protocol_binary_download_cmd (args, from_tty, NULL); } @@ -6198,6 +6196,13 @@ in a memory packet.\n", add_info ("remote-process", remote_info_process, "Query the remote system for process info."); + add_packet_config_cmd (&remote_protocol_vcont, + "vCont", "verbose-resume", + set_remote_protocol_vcont_packet_cmd, + show_remote_protocol_vcont_packet_cmd, + &remote_set_cmdlist, &remote_show_cmdlist, + 0); + add_packet_config_cmd (&remote_protocol_qSymbol, "qSymbol", "symbol-lookup", set_remote_protocol_qSymbol_packet_cmd, diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c index af5e023..2ddba0a 100644 --- a/gdb/rom68k-rom.c +++ b/gdb/rom68k-rom.c @@ -101,7 +101,7 @@ rom68k_supply_one_register (int regno, unsigned char *hex) while (is_whitespace (*hex)) hex++; - store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), value); + store_unsigned_integer (regbuf, DEPRECATED_REGISTER_RAW_SIZE (regno), value); supply_register (regno, regbuf); return hex; diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 0c7c122..6f96c17 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -1,7 +1,8 @@ /* IBM RS/6000 native-dependent code for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -34,6 +35,7 @@ #include "arch-utils.h" #include "language.h" /* for local_hex_string(). */ #include "ppc-tdep.h" +#include "exec.h" #include <sys/ptrace.h> #include <sys/reg.h> @@ -71,7 +73,7 @@ #ifndef ARCH3264 # define ARCH64() 0 #else -# define ARCH64() (REGISTER_RAW_SIZE (0) == 8) +# define ARCH64() (DEPRECATED_REGISTER_RAW_SIZE (0) == 8) #endif /* Union of 32-bit and 64-bit ".reg" core file sections. */ @@ -127,8 +129,6 @@ typedef union { extern struct vmap *map_vmap (bfd * bf, bfd * arch); -extern struct target_ops exec_ops; - static void vmap_exec (void); static void vmap_ldinfo (LdInfo *); @@ -251,7 +251,7 @@ fetch_register (int regno) even if the register is really only 32 bits. */ long long buf; rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf); - if (REGISTER_RAW_SIZE (regno) == 8) + if (DEPRECATED_REGISTER_RAW_SIZE (regno) == 8) memcpy (addr, &buf, 8); else *addr = buf; @@ -320,7 +320,7 @@ store_register (int regno) /* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte area, even if the register is really only 32 bits. */ long long buf; - if (REGISTER_RAW_SIZE (regno) == 8) + if (DEPRECATED_REGISTER_RAW_SIZE (regno) == 8) memcpy (&buf, addr, 8); else buf = *addr; @@ -1067,7 +1067,7 @@ xcoff_relocate_symtab (unsigned int pid) void xcoff_relocate_core (struct target_ops *target) { - sec_ptr ldinfo_sec; + struct bfd_section *ldinfo_sec; int offset = 0; LdInfo *ldi; struct vmap *vp; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 0d663b7..b3a322d 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -237,7 +237,7 @@ rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, 3 + argi, &addr); + get_frame_register (frame, 3 + argi, &addr); return addr; } @@ -985,7 +985,8 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata) initializer function as well. */ tmp = find_pc_misc_function (pc); - if (tmp >= 0 && STREQ (misc_function_vector[tmp].name, main_name ())) + if (tmp >= 0 + && strcmp (misc_function_vector[tmp].name, main_name ()) == 0) return pc + 8; } } @@ -1154,7 +1155,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii) { - int reg_size = REGISTER_RAW_SIZE (ii + 3); + int reg_size = DEPRECATED_REGISTER_RAW_SIZE (ii + 3); arg = args[argno]; type = check_typedef (VALUE_TYPE (arg)); @@ -1313,65 +1314,6 @@ ran_out_of_registers_for_arguments: return sp; } -/* Extract a function return value of type TYPE from raw register array - REGBUF, and copy that return value into VALBUF in virtual format. */ -static void -e500_extract_return_value (struct type *valtype, struct regcache *regbuf, void *valbuf) -{ - int offset = 0; - int vallen = TYPE_LENGTH (valtype); - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY - && vallen == 8 - && TYPE_VECTOR (valtype)) - { - regcache_raw_read (regbuf, tdep->ppc_ev0_regnum + 3, valbuf); - } - else - { - /* Return value is copied starting from r3. Note that r3 for us - is a pseudo register. */ - int offset = 0; - int return_regnum = tdep->ppc_gp0_regnum + 3; - int reg_size = REGISTER_RAW_SIZE (return_regnum); - int reg_part_size; - char *val_buffer; - int copied = 0; - int i = 0; - - /* Compute where we will start storing the value from. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - { - if (vallen <= reg_size) - offset = reg_size - vallen; - else - offset = reg_size + (reg_size - vallen); - } - - /* How big does the local buffer need to be? */ - if (vallen <= reg_size) - val_buffer = alloca (reg_size); - else - val_buffer = alloca (vallen); - - /* Read all we need into our private buffer. We copy it in - chunks that are as long as one register, never shorter, even - if the value is smaller than the register. */ - while (copied < vallen) - { - reg_part_size = REGISTER_RAW_SIZE (return_regnum + i); - /* It is a pseudo/cooked register. */ - regcache_cooked_read (regbuf, return_regnum + i, - val_buffer + copied); - copied += reg_part_size; - i++; - } - /* Put the stuff in the return buffer. */ - memcpy (valbuf, val_buffer + offset, vallen); - } -} - /* PowerOpen always puts structures in memory. Vectors, which were added later, do get returned in a register though. */ @@ -1421,8 +1363,8 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) { /* return value is copied starting from r3. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - && TYPE_LENGTH (valtype) < REGISTER_RAW_SIZE (3)) - offset = REGISTER_RAW_SIZE (3) - TYPE_LENGTH (valtype); + && TYPE_LENGTH (valtype) < DEPRECATED_REGISTER_RAW_SIZE (3)) + offset = DEPRECATED_REGISTER_RAW_SIZE (3) - TYPE_LENGTH (valtype); memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (3) + offset, @@ -1628,7 +1570,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) struct gdbarch_tdep * tdep = gdbarch_tdep (current_gdbarch); int wordsize = tdep->wordsize; - if (get_frame_saved_regs (fi)) + if (deprecated_get_frame_saved_regs (fi)) return; if (fdatap == NULL) @@ -1670,7 +1612,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) CORE_ADDR fpr_addr = frame_addr + fdatap->fpr_offset; for (i = fdatap->saved_fpr; i < 32; i++) { - get_frame_saved_regs (fi)[FP0_REGNUM + i] = fpr_addr; + deprecated_get_frame_saved_regs (fi)[FP0_REGNUM + i] = fpr_addr; fpr_addr += 8; } } @@ -1684,7 +1626,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)[tdep->ppc_gp0_regnum + i] = gpr_addr; + deprecated_get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = gpr_addr; gpr_addr += wordsize; } } @@ -1699,8 +1641,8 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) CORE_ADDR vr_addr = frame_addr + fdatap->vr_offset; for (i = fdatap->saved_vr; i < 32; i++) { - get_frame_saved_regs (fi)[tdep->ppc_vr0_regnum + i] = vr_addr; - vr_addr += REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); + deprecated_get_frame_saved_regs (fi)[tdep->ppc_vr0_regnum + i] = vr_addr; + vr_addr += DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum); } } } @@ -1715,9 +1657,9 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) CORE_ADDR ev_addr = frame_addr + fdatap->ev_offset; for (i = fdatap->saved_ev; i < 32; i++) { - get_frame_saved_regs (fi)[tdep->ppc_ev0_regnum + i] = ev_addr; - get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = ev_addr + 4; - ev_addr += REGISTER_RAW_SIZE (tdep->ppc_ev0_regnum); + deprecated_get_frame_saved_regs (fi)[tdep->ppc_ev0_regnum + i] = ev_addr; + deprecated_get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = ev_addr + 4; + ev_addr += DEPRECATED_REGISTER_RAW_SIZE (tdep->ppc_ev0_regnum); } } } @@ -1725,17 +1667,17 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) /* If != 0, fdatap->cr_offset is the offset from the frame that holds the CR. */ if (fdatap->cr_offset != 0) - get_frame_saved_regs (fi)[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset; + deprecated_get_frame_saved_regs (fi)[tdep->ppc_cr_regnum] = frame_addr + fdatap->cr_offset; /* If != 0, fdatap->lr_offset is the offset from the frame that holds the LR. */ if (fdatap->lr_offset != 0) - get_frame_saved_regs (fi)[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset; + deprecated_get_frame_saved_regs (fi)[tdep->ppc_lr_regnum] = frame_addr + fdatap->lr_offset; /* If != 0, fdatap->vrsave_offset is the offset from the frame that holds the VRSAVE. */ if (fdatap->vrsave_offset != 0) - get_frame_saved_regs (fi)[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset; + deprecated_get_frame_saved_regs (fi)[tdep->ppc_vrsave_regnum] = frame_addr + fdatap->vrsave_offset; } /* Return the address of a frame. This is the inital %sp value when the frame @@ -1762,7 +1704,7 @@ frame_initial_stack_address (struct frame_info *fi) /* If saved registers of this frame are not known yet, read and cache them. */ - if (!get_frame_saved_regs (fi)) + if (!deprecated_get_frame_saved_regs (fi)) frame_get_saved_regs (fi, &fdata); /* If no alloca register used, then fi->frame is the value of the %sp for @@ -1782,7 +1724,7 @@ frame_initial_stack_address (struct frame_info *fi) { get_frame_extra_info (fi)->initial_sp = extract_unsigned_integer (tmpbuf, - REGISTER_RAW_SIZE (fdata.alloca_reg)); + DEPRECATED_REGISTER_RAW_SIZE (fdata.alloca_reg)); } else /* NOTE: cagney/2002-04-17: At present the only time @@ -1932,13 +1874,13 @@ static void rs6000_register_convert_to_virtual (int n, struct type *type, char *from, char *to) { - if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n)) + if (TYPE_LENGTH (type) != DEPRECATED_REGISTER_RAW_SIZE (n)) { - double val = deprecated_extract_floating (from, REGISTER_RAW_SIZE (n)); + double val = deprecated_extract_floating (from, DEPRECATED_REGISTER_RAW_SIZE (n)); deprecated_store_floating (to, TYPE_LENGTH (type), val); } else - memcpy (to, from, REGISTER_RAW_SIZE (n)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (n)); } /* Convert data from virtual format with type TYPE in buffer FROM @@ -1948,13 +1890,13 @@ static void rs6000_register_convert_to_raw (struct type *type, int n, const char *from, char *to) { - if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n)) + if (TYPE_LENGTH (type) != DEPRECATED_REGISTER_RAW_SIZE (n)) { double val = deprecated_extract_floating (from, TYPE_LENGTH (type)); - deprecated_store_floating (to, REGISTER_RAW_SIZE (n), val); + deprecated_store_floating (to, DEPRECATED_REGISTER_RAW_SIZE (n), val); } else - memcpy (to, from, REGISTER_RAW_SIZE (n)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (n)); } static void @@ -2046,30 +1988,6 @@ rs6000_stab_reg_to_regnum (int num) return regnum; } -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ -static void -e500_store_return_value (struct type *type, char *valbuf) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - /* Everything is returned in GPR3 and up. */ - int copied = 0; - int i = 0; - int len = TYPE_LENGTH (type); - while (copied < len) - { - int regnum = gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + 3 + i; - int reg_size = REGISTER_RAW_SIZE (regnum); - char *reg_val_buf = alloca (reg_size); - - memcpy (reg_val_buf, valbuf + copied, reg_size); - copied += reg_size; - deprecated_write_register_gen (regnum, reg_val_buf); - i++; - } -} - static void rs6000_store_return_value (struct type *type, char *valbuf) { @@ -2137,7 +2055,7 @@ rs6000_create_inferior (int pid) rs6000_set_host_arch_hook (pid); } -/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR). +/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG). Usually a function pointer's representation is simply the address of the function. On the RS/6000 however, a function pointer is @@ -2157,7 +2075,9 @@ rs6000_create_inferior (int pid) space and is therefore a special function pointer. */ static CORE_ADDR -rs6000_convert_from_func_ptr_addr (CORE_ADDR addr) +rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch, + CORE_ADDR addr, + struct target_ops *targ) { struct obj_section *s; @@ -2830,9 +2750,15 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, 64); set_gdbarch_sp_regnum (gdbarch, 1); set_gdbarch_deprecated_fp_regnum (gdbarch, 1); - set_gdbarch_deprecated_extract_return_value (gdbarch, - rs6000_extract_return_value); - set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value); + if (sysv_abi && wordsize == 8) + set_gdbarch_return_value (gdbarch, ppc64_sysv_abi_return_value); + else if (sysv_abi && wordsize == 4) + set_gdbarch_return_value (gdbarch, ppc_sysv_abi_return_value); + else + { + set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value); + set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value); + } if (v->arch == bfd_arch_powerpc) switch (v->mach) @@ -2866,8 +2792,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_dwarf2_reg_to_regnum (gdbarch, e500_dwarf2_reg_to_regnum); set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write); - set_gdbarch_extract_return_value (gdbarch, e500_extract_return_value); - set_gdbarch_deprecated_store_return_value (gdbarch, e500_store_return_value); break; default: tdep->ppc_vr0_regnum = -1; @@ -2931,8 +2855,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* PPC64 SYSV. */ set_gdbarch_frame_red_zone_size (gdbarch, 288); else if (!sysv_abi && wordsize == 4) - /* PowerOpen / AIX 32 bit. */ - set_gdbarch_frame_red_zone_size (gdbarch, 220); + /* PowerOpen / AIX 32 bit. The saved area or red zone consists of + 19 4 byte GPRS + 18 8 byte FPRs giving a total of 220 bytes. + Problem is, 220 isn't frame (16 byte) aligned. Round it up to + 224. */ + set_gdbarch_frame_red_zone_size (gdbarch, 224); set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_believe_pcc_promotion (gdbarch, 1); @@ -2949,6 +2876,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) revisited. */ if (sysv_abi && wordsize == 4) set_gdbarch_push_dummy_call (gdbarch, ppc_sysv_abi_push_dummy_call); + else if (sysv_abi && wordsize == 8) + set_gdbarch_push_dummy_call (gdbarch, ppc64_sysv_abi_push_dummy_call); else set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call); @@ -2961,13 +2890,19 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc); + /* Handle the 64-bit SVR4 minimal-symbol convention of using "FN" + for the descriptor and ".FN" for the entry-point -- a user + specifying "break FN" will unexpectedly end up with a breakpoint + on the descriptor and not the function. This architecture method + transforms any breakpoints on descriptors into breakpoints on the + corresponding entry point. */ + if (sysv_abi && wordsize == 8) + set_gdbarch_adjust_breakpoint_address (gdbarch, ppc64_sysv_abi_adjust_breakpoint_address); + /* Not sure on this. FIXMEmgo */ set_gdbarch_frame_args_skip (gdbarch, 8); - if (sysv_abi) - set_gdbarch_use_struct_convention (gdbarch, - ppc_sysv_abi_use_struct_convention); - else + if (!sysv_abi) set_gdbarch_use_struct_convention (gdbarch, rs6000_use_struct_convention); @@ -2996,6 +2931,16 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); + if (from_xcoff_exec) + { + /* NOTE: jimix/2003-06-09: This test should really check for + GDB_OSABI_AIX when that is defined and becomes + available. (Actually, once things are properly split apart, + the test goes away.) */ + /* RS6000/AIX does not support PT_STEP. Has to be simulated. */ + set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step); + } + return gdbarch; } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index ee6574d..eb4a62e 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -901,7 +901,7 @@ s390_get_signal_frame_info (struct frame_info *fi) && get_frame_extra_info (next_frame)->sigcontext) { /* We're definitely backtracing from a signal handler. */ - CORE_ADDR *saved_regs = get_frame_saved_regs (fi); + CORE_ADDR *saved_regs = deprecated_get_frame_saved_regs (fi); CORE_ADDR save_reg_addr = (get_frame_extra_info (next_frame)->sigcontext + DEPRECATED_REGISTER_BYTE (S390_GP0_REGNUM)); int reg; @@ -1428,12 +1428,12 @@ s390_get_frame_info (CORE_ADDR start_pc, - the analysis gave us enough information to actually figure it out. */ if (fi - && get_frame_saved_regs (fi) + && deprecated_get_frame_saved_regs (fi) && original_sp != -1) { int slot_num; CORE_ADDR slot_addr; - CORE_ADDR *saved_regs = get_frame_saved_regs (fi); + CORE_ADDR *saved_regs = deprecated_get_frame_saved_regs (fi); /* Scan the spill array; if a spill slot says it holds the original value of some register, then record that slot's @@ -1719,7 +1719,7 @@ s390_frame_init_saved_regs (struct frame_info *fi) int quick; - if (get_frame_saved_regs (fi) == NULL) + if (deprecated_get_frame_saved_regs (fi) == NULL) { /* zalloc memsets the saved regs */ frame_saved_regs_zalloc (fi); @@ -1754,10 +1754,10 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) { get_frame_extra_info (fi)->saved_pc_valid = 1; if (get_frame_extra_info (fi)->good_prologue - && get_frame_saved_regs (fi)[S390_RETADDR_REGNUM]) + && deprecated_get_frame_saved_regs (fi)[S390_RETADDR_REGNUM]) get_frame_extra_info (fi)->saved_pc = ADDR_BITS_REMOVE (read_memory_integer - (get_frame_saved_regs (fi)[S390_RETADDR_REGNUM], + (deprecated_get_frame_saved_regs (fi)[S390_RETADDR_REGNUM], S390_GPR_SIZE)); else get_frame_extra_info (fi)->saved_pc @@ -1841,24 +1841,24 @@ s390_frame_chain (struct frame_info *thisframe) } else { - if (get_frame_saved_regs (thisframe)) + if (deprecated_get_frame_saved_regs (thisframe)) { int regno; if (prev_fextra_info.frame_pointer_saved_pc - && get_frame_saved_regs (thisframe)[S390_FRAME_REGNUM]) + && deprecated_get_frame_saved_regs (thisframe)[S390_FRAME_REGNUM]) regno = S390_FRAME_REGNUM; else regno = S390_SP_REGNUM; - if (get_frame_saved_regs (thisframe)[regno]) + if (deprecated_get_frame_saved_regs (thisframe)[regno]) { /* The SP's entry of `saved_regs' is special. */ if (regno == S390_SP_REGNUM) - prev_fp = get_frame_saved_regs (thisframe)[regno]; + prev_fp = deprecated_get_frame_saved_regs (thisframe)[regno]; else prev_fp = - read_memory_integer (get_frame_saved_regs (thisframe)[regno], + read_memory_integer (deprecated_get_frame_saved_regs (thisframe)[regno], S390_GPR_SIZE); } } @@ -1874,6 +1874,15 @@ s390_frame_chain (struct frame_info *thisframe) +/* NOTE: cagney/2003-10-31: "return_value" makes + "extract_struct_value_address", "extract_return_value", and + "use_struct_convention" redundant. */ +static CORE_ADDR +s390_cannot_extract_struct_value_address (struct regcache *regcache) +{ + return 0; +} + /* a given return value in `regbuf' with a type `valtype', extract and copy its value into `valbuf' */ static void @@ -1992,22 +2001,22 @@ s390_pop_frame_regular (struct frame_info *frame) write_register (S390_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ - if (get_frame_saved_regs (frame)) + if (deprecated_get_frame_saved_regs (frame)) { for (regnum = 0; regnum < NUM_REGS; regnum++) - if (get_frame_saved_regs (frame)[regnum] != 0) + if (deprecated_get_frame_saved_regs (frame)[regnum] != 0) { ULONGEST value; - value = read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], - REGISTER_RAW_SIZE (regnum)); + value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], + DEPRECATED_REGISTER_RAW_SIZE (regnum)); write_register (regnum, value); } /* Actually cut back the stack. Remember that the SP's element of saved_regs is the old SP itself, not the address at which it is saved. */ - write_register (S390_SP_REGNUM, get_frame_saved_regs (frame)[S390_SP_REGNUM]); + write_register (S390_SP_REGNUM, deprecated_get_frame_saved_regs (frame)[S390_SP_REGNUM]); } /* Throw away any cached frame information. */ @@ -2206,28 +2215,6 @@ extend_simple_arg (struct value *arg) } -/* Round ADDR up to the next N-byte boundary. N must be a power of - two. */ -static CORE_ADDR -round_up (CORE_ADDR addr, int n) -{ - /* Check that N is really a power of two. */ - gdb_assert (n && (n & (n-1)) == 0); - return ((addr + n - 1) & -n); -} - - -/* Round ADDR down to the next N-byte boundary. N must be a power of - two. */ -static CORE_ADDR -round_down (CORE_ADDR addr, int n) -{ - /* Check that N is really a power of two. */ - gdb_assert (n && (n & (n-1)) == 0); - return (addr & -n); -} - - /* Return the alignment required by TYPE. */ static int alignment_of (struct type *type) @@ -2304,7 +2291,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, && pass_by_copy_ref (type)) { sp -= length; - sp = round_down (sp, alignment_of (type)); + sp = align_down (sp, alignment_of (type)); write_memory (sp, VALUE_CONTENTS (arg), length); copy_addr[i] = sp; num_copies++; @@ -2323,7 +2310,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, struct type *type = VALUE_TYPE (arg); int length = TYPE_LENGTH (type); - sp = round_down (sp, alignment_of (type)); + sp = align_down (sp, alignment_of (type)); /* SIMPLE_ARG values get extended to DEPRECATED_REGISTER_SIZE bytes. Assume every argument is. */ @@ -2333,12 +2320,12 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, } /* Include space for any reference-to-copy pointers. */ - sp = round_down (sp, pointer_size); + sp = align_down (sp, pointer_size); sp -= num_copies * pointer_size; /* After all that, make sure it's still aligned on an eight-byte boundary. */ - sp = round_down (sp, 8); + sp = align_down (sp, 8); /* Finally, place the actual parameters, working from SP towards higher addresses. The code above is supposed to reserve enough @@ -2403,7 +2390,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { /* Simple args are always extended to DEPRECATED_REGISTER_SIZE bytes. */ - starg = round_up (starg, DEPRECATED_REGISTER_SIZE); + starg = align_up (starg, DEPRECATED_REGISTER_SIZE); /* Do we need to pass a pointer to our copy of this argument? */ @@ -2420,10 +2407,10 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, else { /* You'd think we should say: - starg = round_up (starg, alignment_of (type)); + starg = align_up (starg, alignment_of (type)); Unfortunately, GCC seems to simply align the stack on a four/eight-byte boundary, even when passing doubles. */ - starg = round_up (starg, S390_STACK_PARAMETER_ALIGNMENT); + starg = align_up (starg, S390_STACK_PARAMETER_ALIGNMENT); write_memory (starg, VALUE_CONTENTS (arg), length); starg += length; } @@ -2592,7 +2579,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); set_gdbarch_believe_pcc_promotion (gdbarch, 0); set_gdbarch_char_signed (gdbarch, 0); @@ -2644,8 +2631,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); - set_gdbarch_deprecated_extract_struct_value_address - (gdbarch, generic_cannot_extract_struct_value_address); + set_gdbarch_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address); /* Parameters for inferior function calls. */ set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 83d88cc..7e2ad8f 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -233,6 +233,15 @@ nosideret: return value_from_longest (builtin_type_long, (LONGEST) 1); } +const struct exp_descriptor exp_descriptor_scm = +{ + print_subexp_standard, + operator_length_standard, + op_name_standard, + dump_subexp_body_standard, + evaluate_subexp_scm +}; + const struct language_defn scm_language_defn = { "scheme", /* Language name */ @@ -241,9 +250,9 @@ const struct language_defn scm_language_defn = range_check_off, type_check_off, case_sensitive_off, + &exp_descriptor_scm, scm_parse, c_error, - evaluate_subexp_scm, scm_printchar, /* Print a character constant */ scm_printstr, /* Function to print string constant */ NULL, /* Function to print a single character */ @@ -263,6 +272,7 @@ const struct language_defn scm_language_defn = 1, /* c-style arrays */ 0, /* String lower bound */ &builtin_type_char, /* Type of string elements */ + default_word_break_characters, LANG_MAGIC }; diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c index 8496ae4..1efe142 100644 --- a/gdb/ser-e7kpc.c +++ b/gdb/ser-e7kpc.c @@ -1,4 +1,4 @@ -/* Remote serial interface using Hitachi E7000 PC ISA card in a PC +/* Remote serial interface using Renesas E7000 PC ISA card in a PC Copyright 1994, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. diff --git a/gdb/sh-stub.c b/gdb/sh-stub.c index 73357b4..bdd9e50 100644 --- a/gdb/sh-stub.c +++ b/gdb/sh-stub.c @@ -1,4 +1,4 @@ -/* sh-stub.c -- debugging stub for the Hitachi-SH. +/* sh-stub.c -- debugging stub for the Renesas-SH. NOTE!! This code has to be compiled with optimization, otherwise the function inlining which generates the exception handlers won't work. @@ -147,7 +147,7 @@ #include <string.h> #include <setjmp.h> -/* Hitachi SH architecture instruction encoding masks */ +/* Renesas SH architecture instruction encoding masks */ #define COND_BR_MASK 0xff00 #define UCOND_DBR_MASK 0xe000 @@ -158,7 +158,7 @@ #define UCOND_DISP 0x0fff #define UCOND_REG 0x0f00 -/* Hitachi SH instruction opcodes */ +/* Renesas SH instruction opcodes */ #define BF_INSTR 0x8b00 #define BT_INSTR 0x8900 @@ -171,7 +171,7 @@ #define TRAPA_INSTR 0xc300 #define SSTEP_INSTR 0xc3ff -/* Hitachi SH processor register masks */ +/* Renesas SH processor register masks */ #define T_BIT_MASK 0x0001 @@ -824,7 +824,7 @@ breakpoint (void) /* Note: - The Hitachi SH family uses two exception architectures: + The Renesas SH family uses two exception architectures: SH1 & SH2: diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 529c187..a14c0d9 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1,4 +1,4 @@ -/* Target-dependent code for Hitachi Super-H, for GDB. +/* Target-dependent code for Renesas Super-H, for GDB. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -26,6 +26,9 @@ #include "defs.h" #include "frame.h" +#include "frame-base.h" +#include "frame-unwind.h" +#include "dwarf2-frame.h" #include "symtab.h" #include "symfile.h" #include "gdbtypes.h" @@ -35,6 +38,7 @@ #include "dis-asm.h" #include "inferior.h" #include "gdb_string.h" +#include "gdb_assert.h" #include "arch-utils.h" #include "floatformat.h" #include "regcache.h" @@ -55,29 +59,32 @@ static void (*sh_show_regs) (void); #define SH_NUM_REGS 59 -/* Define other aspects of the stack frame. - we keep a copy of the worked out return pc lying around, since it - is a useful bit of info */ - -struct frame_extra_info +struct sh_frame_cache { - CORE_ADDR return_pc; - int leaf_function; - int f_offset; + /* Base address. */ + CORE_ADDR base; + LONGEST sp_offset; + CORE_ADDR pc; + + /* Flag showing that a frame has been created in the prologue code. */ + int uses_fp; + + /* Saved registers. */ + CORE_ADDR saved_regs[SH_NUM_REGS]; + CORE_ADDR saved_sp; }; static const char * sh_generic_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", "fpul", "fpscr", - "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", - "ssr", "spc", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "ssr", "spc", "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1", }; @@ -91,17 +98,16 @@ sh_generic_register_name (int reg_nr) static const char * sh_sh_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", - "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", }; if (reg_nr < 0) return NULL; @@ -113,15 +119,14 @@ sh_sh_register_name (int reg_nr) static const char * sh_sh3_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", - "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "ssr", "spc", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "ssr", "spc", "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1" }; @@ -135,15 +140,14 @@ sh_sh3_register_name (int reg_nr) static const char * sh_sh3e_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", "fpul", "fpscr", - "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", - "ssr", "spc", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "ssr", "spc", "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1", }; @@ -157,15 +161,14 @@ sh_sh3e_register_name (int reg_nr) static const char * sh_sh2e_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", "fpul", "fpscr", - "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", - "", "", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }; @@ -179,17 +182,16 @@ sh_sh2e_register_name (int reg_nr) static const char * sh_sh_dsp_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", - "", "dsr", - "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1", - "y0", "y1", "", "", "", "", "", "mod", - "", "", - "rs", "re", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "", "dsr", + "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1", + "y0", "y1", "", "", "", "", "", "mod", + "", "", + "rs", "re", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", }; if (reg_nr < 0) return NULL; @@ -201,18 +203,17 @@ sh_sh_dsp_register_name (int reg_nr) static const char * sh_sh3_dsp_register_name (int reg_nr) { - static char *register_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", - "", "dsr", - "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1", - "y0", "y1", "", "", "", "", "", "mod", - "ssr", "spc", - "rs", "re", "", "", "", "", "", "", - "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b" - "", "", "", "", "", "", "", "", + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "", "dsr", + "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1", + "y0", "y1", "", "", "", "", "", "mod", + "ssr", "spc", + "rs", "re", "", "", "", "", "", "", + "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b" + "", "", "", "", "", "", "", "", }; if (reg_nr < 0) return NULL; @@ -224,28 +225,27 @@ sh_sh3_dsp_register_name (int reg_nr) static const char * sh_sh4_register_name (int reg_nr) { - static char *register_names[] = - { + static char *register_names[] = { /* general registers 0-15 */ - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", /* 16 - 22 */ - "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", /* 23, 24 */ "fpul", "fpscr", /* floating point registers 25 - 40 */ - "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", /* 41, 42 */ - "ssr", "spc", + "ssr", "spc", /* bank 0 43 - 50 */ "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", /* bank 1 51 - 58 */ "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1", /* double precision (pseudo) 59 - 66 */ - "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14", + "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14", /* vectors (pseudo) 67 - 70 */ - "fv0", "fv4", "fv8", "fv12", + "fv0", "fv4", "fv8", "fv12", /* FIXME: missing XF 71 - 86 */ /* FIXME: missing XD 87 - 94 */ }; @@ -256,56 +256,83 @@ sh_sh4_register_name (int reg_nr) return register_names[reg_nr]; } +static const char * +sh_sh4_nofpu_register_name (int reg_nr) +{ + static char *register_names[] = { + /* general registers 0-15 */ + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + /* 16 - 22 */ + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + /* 23, 24 */ + "", "", + /* floating point registers 25 - 40 -- not for nofpu target */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* 41, 42 */ + "ssr", "spc", + /* bank 0 43 - 50 */ + "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", + /* bank 1 51 - 58 */ + "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1", + /* double precision (pseudo) 59 - 66 -- not for nofpu target */ + "", "", "", "", "", "", "", "", + /* vectors (pseudo) 67 - 70 -- not for nofpu target */ + "", "", "", "", + }; + if (reg_nr < 0) + return NULL; + if (reg_nr >= (sizeof (register_names) / sizeof (*register_names))) + return NULL; + return register_names[reg_nr]; +} + +static const char * +sh_sh4al_dsp_register_name (int reg_nr) +{ + static char *register_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", + "", "dsr", + "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1", + "y0", "y1", "", "", "", "", "", "mod", + "ssr", "spc", + "rs", "re", "", "", "", "", "", "", + "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b" + "", "", "", "", "", "", "", "", + }; + if (reg_nr < 0) + return NULL; + if (reg_nr >= (sizeof (register_names) / sizeof (*register_names))) + return NULL; + return register_names[reg_nr]; +} + static const unsigned char * sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { /* 0xc3c3 is trapa #c3, and it works in big and little endian modes */ - static unsigned char breakpoint[] = {0xc3, 0xc3}; - + static unsigned char breakpoint[] = { 0xc3, 0xc3 }; + *lenptr = sizeof (breakpoint); return breakpoint; } -static CORE_ADDR -sh_push_dummy_code (struct gdbarch *gdbarch, - CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, - struct value **args, int nargs, - struct type *value_type, - CORE_ADDR *real_pc, CORE_ADDR *bp_addr) -{ - /* Allocate space sufficient for a breakpoint. */ - sp = (sp - 2) & ~1; - /* Store the address of that breakpoint */ - *bp_addr = sp; - /* sh always starts the call at the callee's entry point. */ - *real_pc = funaddr; - return sp; -} - /* Prologue looks like - [mov.l <regs>,@-r15]... - [sts.l pr,@-r15] - [mov.l r14,@-r15] - [mov r15,r14] - - Actually it can be more complicated than this. For instance, with - newer gcc's: - - mov.l r14,@-r15 - add #-12,r15 - mov r15,r14 - mov r4,r1 - mov r5,r2 - mov.l r6,@(4,r14) - mov.l r7,@(8,r14) - mov.b r1,@r14 - mov r14,r1 - mov r14,r1 - add #2,r1 - mov.w r2,@r1 + mov.l r14,@-r15 + sts.l pr,@-r15 + mov.l <regs>,@-r15 + sub <room_for_loca_vars>,r15 + mov r15,r14 + Actually it can be more complicated than this but that's it, basically. */ +#define GET_SOURCE_REG(x) (((x) >> 4) & 0xf) +#define GET_TARGET_REG(x) (((x) >> 8) & 0xf) + /* STS.L PR,@-r15 0100111100100010 r15-4-->r15, PR-->(r15) */ #define IS_STS(x) ((x) == 0x4f22) @@ -314,15 +341,13 @@ sh_push_dummy_code (struct gdbarch *gdbarch, r15-4-->r15, Rm-->(R15) */ #define IS_PUSH(x) (((x) & 0xff0f) == 0x2f06) -#define GET_PUSHED_REG(x) (((x) >> 4) & 0xf) - /* MOV r15,r14 0110111011110011 r15-->r14 */ #define IS_MOV_SP_FP(x) ((x) == 0x6ef3) /* ADD #imm,r15 01111111iiiiiiii r15+imm-->r15 */ -#define IS_ADD_IMM_SP(x) (((x) & 0xff00) == 0x7f00) +#define IS_ADD_IMM_SP(x) (((x) & 0xff00) == 0x7f00) #define IS_MOV_R3(x) (((x) & 0xff00) == 0x1a00) #define IS_SHLL_R3(x) ((x) == 0x4300) @@ -336,259 +361,78 @@ sh_push_dummy_code (struct gdbarch *gdbarch, FMOV XDm,@-Rn Rn-8-->Rn, XDm-->(Rn) 1111nnnnmmm11011 */ /* CV, 2003-08-28: Only suitable with Rn == SP, therefore name changed to make this entirely clear. */ -#define IS_FPUSH(x) (((x) & 0xf00f) == 0xf00b) - -/* MOV Rm,Rn Rm-->Rn 0110nnnnmmmm0011 - MOV.L Rm,@(disp,Rn) Rm-->(dispx4+Rn) 0001nnnnmmmmdddd - MOV.L Rm,@Rn Rm-->(Rn) 0010nnnnmmmm0010 - where Rm is one of r4,r5,r6,r7 which are the argument registers. */ -#define IS_ARG_MOV(x) \ -(((((x) & 0xf00f) == 0x6003) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)) \ - || ((((x) & 0xf000) == 0x1000) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)) \ - || ((((x) & 0xf00f) == 0x2002) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070))) - -/* MOV.L Rm,@(disp,r14) 00011110mmmmdddd - Rm-->(dispx4+r14) where Rm is one of r4,r5,r6,r7 */ -#define IS_MOV_TO_R14(x) \ - ((((x) & 0xff00) == 0x1e) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)) - -#define FPSCR_SZ (1 << 20) - -/* Skip any prologue before the guts of a function */ - -/* Skip the prologue using the debug information. If this fails we'll - fall back on the 'guess' method below. */ -static CORE_ADDR -after_prologue (CORE_ADDR pc) -{ - struct symtab_and_line sal; - CORE_ADDR func_addr, func_end; +/* #define IS_FMOV(x) (((x) & 0xf00f) == 0xf00b) */ +#define IS_FPUSH(x) (((x) & 0xff0f) == 0xff0b) + +/* MOV Rm,Rn Rm-->Rn 0110nnnnmmmm0011 4 <= m <= 7 */ +#define IS_MOV_ARG_TO_REG(x) \ + (((x) & 0xf00f) == 0x6003 && \ + ((x) & 0x00f0) >= 0x0040 && \ + ((x) & 0x00f0) <= 0x0070) +/* MOV.L Rm,@Rn 0010nnnnmmmm0010 n = 14, 4 <= m <= 7 */ +#define IS_MOV_ARG_TO_IND_R14(x) \ + (((x) & 0xff0f) == 0x2e02 && \ + ((x) & 0x00f0) >= 0x0040 && \ + ((x) & 0x00f0) <= 0x0070) +/* MOV.L Rm,@(disp*4,Rn) 00011110mmmmdddd n = 14, 4 <= m <= 7 */ +#define IS_MOV_ARG_TO_IND_R14_WITH_DISP(x) \ + (((x) & 0xff00) == 0x1e00 && \ + ((x) & 0x00f0) >= 0x0040 && \ + ((x) & 0x00f0) <= 0x0070) + +/* MOV.W @(disp*2,PC),Rn 1001nnnndddddddd */ +#define IS_MOVW_PCREL_TO_REG(x) (((x) & 0xf000) == 0x9000) +/* MOV.L @(disp*4,PC),Rn 1101nnnndddddddd */ +#define IS_MOVL_PCREL_TO_REG(x) (((x) & 0xf000) == 0xd000) +/* SUB Rn,R15 00111111nnnn1000 */ +#define IS_SUB_REG_FROM_SP(x) (((x) & 0xff0f) == 0x3f08) - /* If we can not find the symbol in the partial symbol table, then - there is no hope we can determine the function's start address - with this code. */ - if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) - return 0; - - /* Get the line associated with FUNC_ADDR. */ - sal = find_pc_line (func_addr, 0); - - /* There are only two cases to consider. First, the end of the source line - is within the function bounds. In that case we return the end of the - source line. Second is the end of the source line extends beyond the - bounds of the current function. We need to use the slow code to - examine instructions in that case. */ - if (sal.end < func_end) - return sal.end; - else - return 0; -} - -/* Here we look at each instruction in the function, and try to guess - where the prologue ends. Unfortunately this is not always - accurate. */ -static CORE_ADDR -sh_skip_prologue_hard_way (CORE_ADDR start_pc) -{ - CORE_ADDR here, end; - int updated_fp = 0; - - if (!start_pc) - return 0; - - for (here = start_pc, end = start_pc + (2 * 28); here < end;) - { - int w = read_memory_integer (here, 2); - here += 2; - if (IS_FPUSH (w) || IS_PUSH (w) || IS_STS (w) || IS_MOV_R3 (w) - || IS_ADD_R3SP (w) || IS_ADD_IMM_SP (w) || IS_SHLL_R3 (w) - || IS_ARG_MOV (w) || IS_MOV_TO_R14 (w)) - { - start_pc = here; - } - else if (IS_MOV_SP_FP (w)) - { - start_pc = here; - updated_fp = 1; - } - else - /* Don't bail out yet, if we are before the copy of sp. */ - if (updated_fp) - break; - } - - return start_pc; -} - -static CORE_ADDR -sh_skip_prologue (CORE_ADDR pc) -{ - CORE_ADDR post_prologue_pc; - - /* See if we can determine the end of the prologue via the symbol table. - If so, then return either PC, or the PC after the prologue, whichever - is greater. */ - post_prologue_pc = after_prologue (pc); - - /* If after_prologue returned a useful address, then use it. Else - fall back on the instruction skipping code. */ - if (post_prologue_pc != 0) - return max (pc, post_prologue_pc); - else - return sh_skip_prologue_hard_way (pc); -} - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. - - The return address is the value saved in the PR register + 4 */ -static CORE_ADDR -sh_saved_pc_after_call (struct frame_info *frame) -{ - return (ADDR_BITS_REMOVE (read_register (PR_REGNUM))); -} +#define FPSCR_SZ (1 << 20) -/* Should call_function allocate stack space for a struct return? */ -static int -sh_use_struct_convention (int gcc_p, struct type *type) -{ -#if 0 - return (TYPE_LENGTH (type) > 1); -#else - int len = TYPE_LENGTH (type); - int nelem = TYPE_NFIELDS (type); - return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) && - (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4); -#endif -} +/* The following instructions are used for epilogue testing. */ +#define IS_RESTORE_FP(x) ((x) == 0x6ef6) +#define IS_RTS(x) ((x) == 0x000b) +#define IS_LDS(x) ((x) == 0x4f26) +#define IS_MOV_FP_SP(x) ((x) == 0x6fe3) +#define IS_ADD_REG_TO_FP(x) (((x) & 0xff0f) == 0x3e0c) +#define IS_ADD_IMM_FP(x) (((x) & 0xff00) == 0x7e00) /* Disassemble an instruction. */ static int -gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info) +gdb_print_insn_sh (bfd_vma memaddr, disassemble_info * info) { info->endian = TARGET_BYTE_ORDER; return print_insn_sh (memaddr, info); } -/* Given a GDB frame, determine the address of the calling function's - frame. This will be used to create a new GDB frame struct, and - then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC - will be called for the new frame. - - For us, the frame address is its stack pointer value, so we look up - the function prologue to determine the caller's sp value, and return it. */ -static CORE_ADDR -sh_frame_chain (struct frame_info *frame) -{ - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), - get_frame_base (frame), - get_frame_base (frame))) - return get_frame_base (frame); /* dummy frame same as caller's frame */ - if (get_frame_pc (frame) - && !deprecated_inside_entry_file (get_frame_pc (frame))) - return read_memory_integer (get_frame_base (frame) - + get_frame_extra_info (frame)->f_offset, 4); - else - return 0; -} - -/* Find REGNUM on the stack. Otherwise, it's in an active register. One thing - we might want to do here is to check REGNUM against the clobber mask, and - somehow flag it as invalid if it isn't saved on the stack somewhere. This - would provide a graceful failure mode when trying to get the value of - caller-saves registers for an inner frame. */ static CORE_ADDR -sh_find_callers_reg (struct frame_info *fi, int regnum) -{ - for (; fi; fi = get_next_frame (fi)) - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), - get_frame_base (fi))) - /* When the caller requests PR from the dummy frame, we return PC because - that's where the previous routine appears to have done a call from. */ - return deprecated_read_register_dummy (get_frame_pc (fi), - get_frame_base (fi), regnum); - else - { - DEPRECATED_FRAME_INIT_SAVED_REGS (fi); - if (!get_frame_pc (fi)) - return 0; - if (get_frame_saved_regs (fi)[regnum] != 0) - return read_memory_integer (get_frame_saved_regs (fi)[regnum], - register_size (current_gdbarch, regnum)); - } - return read_register (regnum); -} - -/* 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. */ -static void -sh_nofp_frame_init_saved_regs (struct frame_info *fi) -{ - int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof(int)); - int rn; - int have_fp = 0; - int depth; - int pc; - int opc; - int inst; +sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, + struct sh_frame_cache *cache) +{ + ULONGEST inst; + CORE_ADDR opc; + int offset; + int sav_offset = 0; int r3_val = 0; - char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), - get_frame_base (fi)); - - if (get_frame_saved_regs (fi) == NULL) - frame_saved_regs_zalloc (fi); - else - memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); - - if (dummy_regs) - { - /* DANGER! This is ONLY going to work if the char buffer format of - the saved registers is byte-for-byte identical to the - CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */ - memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); - return; - } - - get_frame_extra_info (fi)->leaf_function = 1; - get_frame_extra_info (fi)->f_offset = 0; - - for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) - where[rn] = -1; - - depth = 0; + int reg, sav_reg = -1; - /* Loop around examining the prologue inst until we find something - 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_frame_func (fi); - if (!pc) - { - deprecated_update_frame_pc_hack (fi, 0); - return; - } + if (pc >= current_pc) + return current_pc; + cache->uses_fp = 0; for (opc = pc + (2 * 28); pc < opc; pc += 2) { - inst = read_memory_integer (pc, 2); + inst = read_memory_unsigned_integer (pc, 2); /* See where the registers will be saved to */ if (IS_PUSH (inst)) { - rn = GET_PUSHED_REG (inst); - where[rn] = depth; - depth += 4; + cache->saved_regs[GET_SOURCE_REG (inst)] = cache->sp_offset; + cache->sp_offset += 4; } else if (IS_STS (inst)) { - where[PR_REGNUM] = depth; - /* If we're storing the pr then this isn't a leaf */ - get_frame_extra_info (fi)->leaf_function = 0; - depth += 4; + cache->saved_regs[PR_REGNUM] = cache->sp_offset; + cache->sp_offset += 4; } else if (IS_MOV_R3 (inst)) { @@ -600,237 +444,237 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) } else if (IS_ADD_R3SP (inst)) { - depth += -r3_val; + cache->sp_offset += -r3_val; } else if (IS_ADD_IMM_SP (inst)) { - depth -= ((inst & 0xff) ^ 0x80) - 0x80; + offset = ((inst & 0xff) ^ 0x80) - 0x80; + cache->sp_offset -= offset; + } + else if (IS_MOVW_PCREL_TO_REG (inst)) + { + if (sav_reg < 0) + { + reg = GET_TARGET_REG (inst); + if (reg < 14) + { + sav_reg = reg; + offset = (((inst & 0xff) ^ 0x80) - 0x80) << 1; + sav_offset = + read_memory_integer (((pc + 4) & ~3) + offset, 2); + } + } + } + else if (IS_MOVL_PCREL_TO_REG (inst)) + { + if (sav_reg < 0) + { + reg = (inst & 0x0f00) >> 8; + if (reg < 14) + { + sav_reg = reg; + offset = (((inst & 0xff) ^ 0x80) - 0x80) << 1; + sav_offset = + read_memory_integer (((pc + 4) & ~3) + offset, 4); + } + } + } + else if (IS_SUB_REG_FROM_SP (inst)) + { + reg = GET_SOURCE_REG (inst); + if (sav_reg > 0 && reg == sav_reg) + { + sav_reg = -1; + } + cache->sp_offset += sav_offset; + } + else if (IS_FPUSH (inst)) + { + if (read_register (FPSCR_REGNUM) & FPSCR_SZ) + { + cache->sp_offset += 8; + } + else + { + cache->sp_offset += 4; + } } else if (IS_MOV_SP_FP (inst)) - break; -#if 0 /* This used to just stop when it found an instruction that - was not considered part of the prologue. Now, we just - keep going looking for likely instructions. */ + { + if (!cache->uses_fp) + cache->uses_fp = 1; + /* At this point, only allow argument register moves to other + registers or argument register moves to @(X,fp) which are + moving the register arguments onto the stack area allocated + by a former add somenumber to SP call. Don't allow moving + to an fp indirect address above fp + cache->sp_offset. */ + pc += 2; + for (opc = pc + 12; pc < opc; pc += 2) + { + inst = read_memory_integer (pc, 2); + if (IS_MOV_ARG_TO_IND_R14 (inst)) + { + reg = GET_SOURCE_REG (inst); + if (cache->sp_offset > 0) + cache->saved_regs[reg] = cache->sp_offset; + } + else if (IS_MOV_ARG_TO_IND_R14_WITH_DISP (inst)) + { + reg = GET_SOURCE_REG (inst); + offset = (inst & 0xf) * 4; + if (cache->sp_offset > offset) + cache->saved_regs[reg] = cache->sp_offset - offset; + } + else if (IS_MOV_ARG_TO_REG (inst)) + continue; + else + break; + } + break; + } +#if 0 /* This used to just stop when it found an instruction that + was not considered part of the prologue. Now, we just + keep going looking for likely instructions. */ else break; #endif } - /* Now we know how deep things are, we can work out their addresses */ + return pc; +} - for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) - { - if (where[rn] >= 0) - { - if (rn == DEPRECATED_FP_REGNUM) - have_fp = 1; +/* Skip any prologue before the guts of a function */ - get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4; - } - else - { - get_frame_saved_regs (fi)[rn] = 0; - } - } +/* Skip the prologue using the debug information. If this fails we'll + fall back on the 'guess' method below. */ +static CORE_ADDR +after_prologue (CORE_ADDR pc) +{ + struct symtab_and_line sal; + CORE_ADDR func_addr, func_end; - if (have_fp) - { - get_frame_saved_regs (fi)[SP_REGNUM] = read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4); - } - else - { - get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4; - } + /* If we can not find the symbol in the partial symbol table, then + there is no hope we can determine the function's start address + with this code. */ + if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) + return 0; - get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4; - /* Work out the return pc - either from the saved pr or the pr - value */ + /* Get the line associated with FUNC_ADDR. */ + sal = find_pc_line (func_addr, 0); + + /* There are only two cases to consider. First, the end of the source line + is within the function bounds. In that case we return the end of the + source line. Second is the end of the source line extends beyond the + bounds of the current function. We need to use the slow code to + examine instructions in that case. */ + if (sal.end < func_end) + return sal.end; + else + return 0; } -/* For vectors of 4 floating point registers. */ -static int -fv_reg_base_num (int fv_regnum) +static CORE_ADDR +sh_skip_prologue (CORE_ADDR start_pc) { - int fp_regnum; + CORE_ADDR pc; + struct sh_frame_cache cache; - fp_regnum = FP0_REGNUM + - (fv_regnum - FV0_REGNUM) * 4; - return fp_regnum; -} + /* See if we can determine the end of the prologue via the symbol table. + If so, then return either PC, or the PC after the prologue, whichever + is greater. */ + pc = after_prologue (start_pc); -/* For double precision floating point registers, i.e 2 fp regs.*/ -static int -dr_reg_base_num (int dr_regnum) -{ - int fp_regnum; + /* If after_prologue returned a useful address, then use it. Else + fall back on the instruction skipping code. */ + if (pc) + return max (pc, start_pc); - fp_regnum = FP0_REGNUM + - (dr_regnum - DR0_REGNUM) * 2; - return fp_regnum; + cache.sp_offset = -4; + pc = sh_analyze_prologue (start_pc, (CORE_ADDR) -1, &cache); + if (!cache.uses_fp) + return start_pc; + + return pc; } -static void -sh_fp_frame_init_saved_regs (struct frame_info *fi) -{ - int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (int)); - int rn; - int have_fp = 0; - int depth; - int pc; - int opc; - int inst; - int r3_val = 0; - char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), get_frame_base (fi)); - - if (get_frame_saved_regs (fi) == NULL) - frame_saved_regs_zalloc (fi); - else - memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); - - if (dummy_regs) - { - /* DANGER! This is ONLY going to work if the char buffer format of - the saved registers is byte-for-byte identical to the - CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */ - memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); - return; - } +/* The ABI says: - get_frame_extra_info (fi)->leaf_function = 1; - get_frame_extra_info (fi)->f_offset = 0; + Aggregate types not bigger than 8 bytes that have the same size and + alignment as one of the integer scalar types are returned in the + same registers as the integer type they match. - for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) - where[rn] = -1; + For example, a 2-byte aligned structure with size 2 bytes has the + same size and alignment as a short int, and will be returned in R0. + A 4-byte aligned structure with size 8 bytes has the same size and + alignment as a long long int, and will be returned in R0 and R1. - depth = 0; + When an aggregate type is returned in R0 and R1, R0 contains the + first four bytes of the aggregate, and R1 contains the + remainder. If the size of the aggregate type is not a multiple of 4 + bytes, the aggregate is tail-padded up to a multiple of 4 + bytes. The value of the padding is undefined. For little-endian + targets the padding will appear at the most significant end of the + last element, for big-endian targets the padding appears at the + least significant end of the last element. - /* Loop around examining the prologue inst until we find something - that does not appear to be part of the prologue. But give up - after 20 of them, since we're getting silly then. */ + All other aggregate types are returned by address. The caller + function passes the address of an area large enough to hold the + aggregate value in R2. The called function stores the result in + this location. - pc = get_frame_func (fi); - if (!pc) - { - deprecated_update_frame_pc_hack (fi, 0); - return; - } + To reiterate, structs smaller than 8 bytes could also be returned + in memory, if they don't pass the "same size and alignment as an + integer type" rule. - for (opc = pc + (2 * 28); pc < opc; pc += 2) - { - inst = read_memory_integer (pc, 2); - /* See where the registers will be saved to */ - if (IS_PUSH (inst)) - { - rn = GET_PUSHED_REG (inst); - where[rn] = depth; - depth += 4; - } - else if (IS_STS (inst)) - { - where[PR_REGNUM] = depth; - /* If we're storing the pr then this isn't a leaf */ - get_frame_extra_info (fi)->leaf_function = 0; - depth += 4; - } - else if (IS_MOV_R3 (inst)) - { - r3_val = ((inst & 0xff) ^ 0x80) - 0x80; - } - else if (IS_SHLL_R3 (inst)) - { - r3_val <<= 1; - } - else if (IS_ADD_R3SP (inst)) - { - depth += -r3_val; - } - else if (IS_ADD_IMM_SP (inst)) - { - depth -= ((inst & 0xff) ^ 0x80) - 0x80; - } - else if (IS_FPUSH (inst)) - { - if (read_register (FPSCR_REGNUM) & FPSCR_SZ) - { - depth += 8; - } - else - { - depth += 4; - } - } - else if (IS_MOV_SP_FP (inst)) - break; -#if 0 /* This used to just stop when it found an instruction that - was not considered part of the prologue. Now, we just - keep going looking for likely instructions. */ - else - break; -#endif - } + For example, in - /* Now we know how deep things are, we can work out their addresses */ + struct s { char c[3]; } wibble; + struct s foo(void) { return wibble; } - for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++) - { - if (where[rn] >= 0) - { - if (rn == DEPRECATED_FP_REGNUM) - have_fp = 1; + the return value from foo() will be in memory, not + in R0, because there is no 3-byte integer type. - get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4; - } - else - { - get_frame_saved_regs (fi)[rn] = 0; - } - } + Similarly, in - if (have_fp) - { - get_frame_saved_regs (fi)[SP_REGNUM] = - read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4); - } - else - { - get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4; - } + struct s { char c[2]; } wibble; + struct s foo(void) { return wibble; } - get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4; - /* Work out the return pc - either from the saved pr or the pr - value */ -} + because a struct containing two chars has alignment 1, that matches + type char, but size 2, that matches type short. There's no integer + type that has alignment 1 and size 2, so the struct is returned in + memory. -/* Initialize the extra info saved in a FRAME */ -static void -sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) +*/ + +static int +sh_use_struct_convention (int gcc_p, struct type *type) { + int len = TYPE_LENGTH (type); + int nelem = TYPE_NFIELDS (type); - frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); + /* Non-power of 2 length types and types bigger than 8 bytes (which don't + fit in two registers anyway) use struct convention. */ + if (len != 1 && len != 2 && len != 4 && len != 8) + return 1; - if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); + /* Scalar types and aggregate types with exactly one field are aligned + by definition. They are returned in registers. */ + if (nelem <= 1) + return 0; - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), - get_frame_base (fi))) - { - /* We need to setup fi->frame here because call_function_by_hand - gets it wrong by assuming it's always FP. */ - deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), - SP_REGNUM)); - get_frame_extra_info (fi)->return_pc = deprecated_read_register_dummy (get_frame_pc (fi), - get_frame_base (fi), - PC_REGNUM); - get_frame_extra_info (fi)->f_offset = -(DEPRECATED_CALL_DUMMY_LENGTH + 4); - get_frame_extra_info (fi)->leaf_function = 0; - return; - } - else - { - DEPRECATED_FRAME_INIT_SAVED_REGS (fi); - get_frame_extra_info (fi)->return_pc = - sh_find_callers_reg (fi, PR_REGNUM); - } + /* If the first field in the aggregate has the same length as the entire + aggregate type, the type is returned in registers. */ + if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == len) + return 0; + + /* If the size of the aggregate is 8 bytes and the first field is + of size 4 bytes its alignment is equal to long long's alignment, + so it's returned in registers. */ + if (len == 8 && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) + return 0; + + /* Otherwise use struct convention. */ + return 1; } /* Extract from an array REGBUF containing the (raw) register state @@ -840,47 +684,12 @@ static CORE_ADDR sh_extract_struct_value_address (struct regcache *regcache) { ULONGEST addr; + regcache_cooked_read_unsigned (regcache, STRUCT_RETURN_REGNUM, &addr); return addr; } static CORE_ADDR -sh_frame_saved_pc (struct frame_info *frame) -{ - return (get_frame_extra_info (frame)->return_pc); -} - -/* Discard from the stack the innermost frame, - restoring all saved registers. */ -static void -sh_pop_frame (void) -{ - struct frame_info *frame = get_current_frame (); - CORE_ADDR fp; - int regnum; - - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), - get_frame_base (frame), - get_frame_base (frame))) - generic_pop_dummy_frame (); - else - { - fp = get_frame_base (frame); - DEPRECATED_FRAME_INIT_SAVED_REGS (frame); - - /* Copy regs from where they were saved in the frame */ - for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) - if (get_frame_saved_regs (frame)[regnum]) - write_register (regnum, - read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); - - write_register (PC_REGNUM, get_frame_extra_info (frame)->return_pc); - write_register (SP_REGNUM, fp + 4); - } - flush_cached_frames (); -} - -static CORE_ADDR sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) { return sp & ~3; @@ -889,7 +698,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) /* Function: push_dummy_call (formerly push_arguments) Setup the function arguments for calling a function in the inferior. - On the Hitachi SH architecture, there are four registers (R4 to R7) + On the Renesas SH architecture, there are four registers (R4 to R7) which are dedicated for passing function arguments. Up to the first four arguments (depending on size) may go into these registers. The rest go on the stack. @@ -938,104 +747,248 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) not displace any of the other arguments passed in via registers R4 to R7. */ +/* Helper function to justify value in register according to endianess. */ +static char * +sh_justify_value_in_reg (struct value *val, int len) +{ + static char valbuf[4]; + + memset (valbuf, 0, sizeof (valbuf)); + if (len < 4) + { + /* value gets right-justified in the register or stack word */ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (valbuf + (4 - len), (char *) VALUE_CONTENTS (val), len); + else + memcpy (valbuf, (char *) VALUE_CONTENTS (val), len); + return valbuf; + } + return (char *) VALUE_CONTENTS (val); +} + +/* Helper function to eval number of bytes to allocate on stack. */ static CORE_ADDR -sh_push_dummy_call_fpu (struct gdbarch *gdbarch, +sh_stack_allocsize (int nargs, struct value **args) +{ + int stack_alloc = 0; + while (nargs-- > 0) + stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[nargs])) + 3) & ~3); + return stack_alloc; +} + +/* Helper functions for getting the float arguments right. Registers usage + depends on the ABI and the endianess. The comments should enlighten how + it's intended to work. */ + +/* This array stores which of the float arg registers are already in use. */ +static int flt_argreg_array[FLOAT_ARGLAST_REGNUM - FLOAT_ARG0_REGNUM + 1]; + +/* This function just resets the above array to "no reg used so far". */ +static void +sh_init_flt_argreg (void) +{ + memset (flt_argreg_array, 0, sizeof flt_argreg_array); +} + +/* This function returns the next register to use for float arg passing. + It returns either a valid value between FLOAT_ARG0_REGNUM and + FLOAT_ARGLAST_REGNUM if a register is available, otherwise it returns + FLOAT_ARGLAST_REGNUM + 1 to indicate that no register is available. + + Note that register number 0 in flt_argreg_array corresponds with the + real float register fr4. In contrast to FLOAT_ARG0_REGNUM (value is + 29) the parity of the register number is preserved, which is important + for the double register passing test (see the "argreg & 1" test below). */ +static int +sh_next_flt_argreg (int len) +{ + int argreg; + + /* First search for the next free register. */ + for (argreg = 0; argreg <= FLOAT_ARGLAST_REGNUM - FLOAT_ARG0_REGNUM; + ++argreg) + if (!flt_argreg_array[argreg]) + break; + + /* No register left? */ + if (argreg > FLOAT_ARGLAST_REGNUM - FLOAT_ARG0_REGNUM) + return FLOAT_ARGLAST_REGNUM + 1; + + if (len == 8) + { + /* Doubles are always starting in a even register number. */ + if (argreg & 1) + { + flt_argreg_array[argreg] = 1; + + ++argreg; + + /* No register left? */ + if (argreg > FLOAT_ARGLAST_REGNUM - FLOAT_ARG0_REGNUM) + return FLOAT_ARGLAST_REGNUM + 1; + } + /* Also mark the next register as used. */ + flt_argreg_array[argreg + 1] = 1; + } + else if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + { + /* In little endian, gcc passes floats like this: f5, f4, f7, f6, ... */ + if (!flt_argreg_array[argreg + 1]) + ++argreg; + } + flt_argreg_array[argreg] = 1; + return FLOAT_ARG0_REGNUM + argreg; +} + +/* Helper function which figures out, if a type is treated like a float type. + + The FPU ABIs have a special way how to treat types as float types. + Structures with exactly one member, which is of type float or double, are + treated exactly as the base types float or double: + + struct sf { + float f; + }; + + struct sd { + double d; + }; + + are handled the same way as just + + float f; + + double d; + + As a result, arguments of these struct types are pushed into floating point + registers exactly as floats or doubles, using the same decision algorithm. + + The same is valid if these types are used as function return types. The + above structs are returned in fr0 resp. fr0,fr1 instead of in r0, r0,r1 + or even using struct convention as it is for other structs. */ + +static int +sh_treat_as_flt_p (struct type *type) +{ + int len = TYPE_LENGTH (type); + + /* Ordinary float types are obviously treated as float. */ + if (TYPE_CODE (type) == TYPE_CODE_FLT) + return 1; + /* Otherwise non-struct types are not treated as float. */ + if (TYPE_CODE (type) != TYPE_CODE_STRUCT) + return 0; + /* Otherwise structs with more than one memeber are not treated as float. */ + if (TYPE_NFIELDS (type) != 1) + return 0; + /* Otherwise if the type of that member is float, the whole type is + treated as float. */ + if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT) + return 1; + /* Otherwise it's not treated as float. */ + return 0; +} + +static CORE_ADDR +sh_push_dummy_call_fpu (struct gdbarch *gdbarch, CORE_ADDR func_addr, - struct regcache *regcache, + struct regcache *regcache, CORE_ADDR bp_addr, int nargs, - struct value **args, + struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - int stack_offset, stack_alloc; - int argreg, flt_argreg; + int stack_offset = 0; + int argreg = ARG0_REGNUM; + int flt_argreg = 0; int argnum; struct type *type; CORE_ADDR regval; char *val; - char valbuf[4]; - int len; - int odd_sized_struct; + int len, reg_size = 0; + int pass_on_stack = 0; + int treat_as_flt; /* first force sp to a 4-byte alignment */ sp = sh_frame_align (gdbarch, sp); - /* The "struct return pointer" pseudo-argument has its own dedicated - register */ if (struct_return) - regcache_cooked_write_unsigned (regcache, - STRUCT_RETURN_REGNUM, - struct_addr); + regcache_cooked_write_unsigned (regcache, + STRUCT_RETURN_REGNUM, struct_addr); - /* Now make sure there's space on the stack */ - for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++) - stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3); - sp -= stack_alloc; /* make room on stack for args */ + /* make room on stack for args */ + sp -= sh_stack_allocsize (nargs, args); + + /* Initialize float argument mechanism. */ + sh_init_flt_argreg (); /* Now load as many as possible of the first arguments into registers, and push the rest onto the stack. There are 16 bytes in four registers available. Loop thru args from first to last. */ - - argreg = ARG0_REGNUM; - flt_argreg = FLOAT_ARG0_REGNUM; - for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) + for (argnum = 0; argnum < nargs; argnum++) { type = VALUE_TYPE (args[argnum]); len = TYPE_LENGTH (type); - memset (valbuf, 0, sizeof (valbuf)); - if (len < 4) - { - /* value gets right-justified in the register or stack word */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (valbuf + (4 - len), - (char *) VALUE_CONTENTS (args[argnum]), len); - else - memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); - val = valbuf; - } - else - val = (char *) VALUE_CONTENTS (args[argnum]); + val = sh_justify_value_in_reg (args[argnum], len); + + /* Some decisions have to be made how various types are handled. + This also differs in different ABIs. */ + pass_on_stack = 0; + + /* Find out the next register to use for a floating point value. */ + treat_as_flt = sh_treat_as_flt_p (type); + if (treat_as_flt) + flt_argreg = sh_next_flt_argreg (len); + /* In contrast to non-FPU CPUs, arguments are never split between + registers and stack. If an argument doesn't fit in the remaining + registers it's always pushed entirely on the stack. */ + else if (len > ((ARGLAST_REGNUM - argreg + 1) * 4)) + pass_on_stack = 1; - if (len > 4 && (len & 3) != 0) - odd_sized_struct = 1; /* Such structs go entirely on stack. */ - else if (len > 16) - odd_sized_struct = 1; /* So do aggregates bigger than 4 words. */ - else - odd_sized_struct = 0; while (len > 0) { - if ((TYPE_CODE (type) == TYPE_CODE_FLT - && flt_argreg > FLOAT_ARGLAST_REGNUM) - || argreg > ARGLAST_REGNUM - || odd_sized_struct) - { - /* must go on the stack */ - write_memory (sp + stack_offset, val, 4); - stack_offset += 4; + if ((treat_as_flt && flt_argreg > FLOAT_ARGLAST_REGNUM) + || (!treat_as_flt && (argreg > ARGLAST_REGNUM + || pass_on_stack))) + { + /* The data goes entirely on the stack, 4-byte aligned. */ + reg_size = (len + 3) & ~3; + write_memory (sp + stack_offset, val, reg_size); + stack_offset += reg_size; } - /* NOTE WELL!!!!! This is not an "else if" clause!!! - That's because some *&^%$ things get passed on the stack - AND in the registers! */ - if (TYPE_CODE (type) == TYPE_CODE_FLT && - flt_argreg > 0 && flt_argreg <= FLOAT_ARGLAST_REGNUM) + else if (treat_as_flt && flt_argreg <= FLOAT_ARGLAST_REGNUM) { - /* Argument goes in a single-precision fp reg. */ - regval = extract_unsigned_integer (val, register_size (gdbarch, - argreg)); + /* Argument goes in a float argument register. */ + reg_size = register_size (gdbarch, flt_argreg); + regval = extract_unsigned_integer (val, reg_size); + /* In little endian mode, float types taking two registers + (doubles on sh4, long doubles on sh2e, sh3e and sh4) must + be stored swapped in the argument registers. The below + code first writes the first 32 bits in the next but one + register, increments the val and len values accordingly + and then proceeds as normal by writing the second 32 bits + into the next register. */ + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE + && TYPE_LENGTH (type) == 2 * reg_size) + { + regcache_cooked_write_unsigned (regcache, flt_argreg + 1, + regval); + val += reg_size; + len -= reg_size; + regval = extract_unsigned_integer (val, reg_size); + } regcache_cooked_write_unsigned (regcache, flt_argreg++, regval); } - else if (argreg <= ARGLAST_REGNUM) - { + else if (!treat_as_flt && argreg <= ARGLAST_REGNUM) + { /* there's room in a register */ - regval = extract_unsigned_integer (val, register_size (gdbarch, - argreg)); + reg_size = register_size (gdbarch, argreg); + regval = extract_unsigned_integer (val, reg_size); regcache_cooked_write_unsigned (regcache, argreg++, regval); } - /* Store the value 4 bytes at a time. This means that things - larger than 4 bytes may go partly in registers and partly - on the stack. */ - len -= register_size (gdbarch, argreg); - val += register_size (gdbarch, argreg); + /* Store the value one register at a time or in one step on stack. */ + len -= reg_size; + val += reg_size; } } @@ -1049,90 +1002,63 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, } static CORE_ADDR -sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, +sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, CORE_ADDR func_addr, - struct regcache *regcache, - CORE_ADDR bp_addr, - int nargs, struct value **args, - CORE_ADDR sp, int struct_return, + struct regcache *regcache, + CORE_ADDR bp_addr, + int nargs, struct value **args, + CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - int stack_offset, stack_alloc; - int argreg; + int stack_offset = 0; + int argreg = ARG0_REGNUM; int argnum; struct type *type; CORE_ADDR regval; char *val; - char valbuf[4]; - int len; - int odd_sized_struct; + int len, reg_size; /* first force sp to a 4-byte alignment */ sp = sh_frame_align (gdbarch, sp); - /* The "struct return pointer" pseudo-argument has its own dedicated - register */ if (struct_return) regcache_cooked_write_unsigned (regcache, - STRUCT_RETURN_REGNUM, - struct_addr); + STRUCT_RETURN_REGNUM, struct_addr); - /* Now make sure there's space on the stack */ - for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++) - stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3); - sp -= stack_alloc; /* make room on stack for args */ + /* make room on stack for args */ + sp -= sh_stack_allocsize (nargs, args); /* Now load as many as possible of the first arguments into registers, and push the rest onto the stack. There are 16 bytes in four registers available. Loop thru args from first to last. */ - - argreg = ARG0_REGNUM; - for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++) + for (argnum = 0; argnum < nargs; argnum++) { type = VALUE_TYPE (args[argnum]); len = TYPE_LENGTH (type); - memset (valbuf, 0, sizeof (valbuf)); - if (len < 4) - { - /* value gets right-justified in the register or stack word */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - memcpy (valbuf + (4 - len), - (char *) VALUE_CONTENTS (args[argnum]), len); - else - memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); - val = valbuf; - } - else - val = (char *) VALUE_CONTENTS (args[argnum]); + val = sh_justify_value_in_reg (args[argnum], len); - if (len > 4 && (len & 3) != 0) - odd_sized_struct = 1; /* such structs go entirely on stack */ - else - odd_sized_struct = 0; while (len > 0) { - if (argreg > ARGLAST_REGNUM - || odd_sized_struct) - { - /* must go on the stack */ - write_memory (sp + stack_offset, val, 4); - stack_offset += 4; + if (argreg > ARGLAST_REGNUM) + { + /* The remainder of the data goes entirely on the stack, + 4-byte aligned. */ + reg_size = (len + 3) & ~3; + write_memory (sp + stack_offset, val, reg_size); + stack_offset += reg_size; } - /* NOTE WELL!!!!! This is not an "else if" clause!!! - That's because some *&^%$ things get passed on the stack - AND in the registers! */ - if (argreg <= ARGLAST_REGNUM) - { + else if (argreg <= ARGLAST_REGNUM) + { /* there's room in a register */ - regval = extract_unsigned_integer (val, register_size (gdbarch, - argreg)); + reg_size = register_size (gdbarch, argreg); + regval = extract_unsigned_integer (val, reg_size); regcache_cooked_write_unsigned (regcache, argreg++, regval); } - /* Store the value 4 bytes at a time. This means that things - larger than 4 bytes may go partly in registers and partly + /* Store the value reg_size bytes at a time. This means that things + larger than reg_size bytes may go partly in registers and partly on the stack. */ - len -= register_size (gdbarch, argreg); - val += register_size (gdbarch, argreg); + len -= reg_size; + val += reg_size; } } @@ -1156,7 +1082,7 @@ sh_default_extract_return_value (struct type *type, struct regcache *regcache, int len = TYPE_LENGTH (type); int return_register = R0_REGNUM; int offset; - + if (len <= 4) { ULONGEST c; @@ -1168,7 +1094,7 @@ sh_default_extract_return_value (struct type *type, struct regcache *regcache, { int i, regnum = R0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_read (regcache, regnum++, (char *)valbuf + i); + regcache_raw_read (regcache, regnum++, (char *) valbuf + i); } else error ("bad size for return value"); @@ -1178,12 +1104,15 @@ static void sh3e_sh4_extract_return_value (struct type *type, struct regcache *regcache, void *valbuf) { - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (sh_treat_as_flt_p (type)) { int len = TYPE_LENGTH (type); int i, regnum = FP0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_read (regcache, regnum++, (char *)valbuf + i); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + regcache_raw_read (regcache, regnum++, (char *) valbuf + len - 4 - i); + else + regcache_raw_read (regcache, regnum++, (char *) valbuf + i); } else sh_default_extract_return_value (type, regcache, valbuf); @@ -1211,7 +1140,7 @@ sh_default_store_return_value (struct type *type, struct regcache *regcache, { int i, regnum = R0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_write (regcache, regnum++, (char *)valbuf + i); + regcache_raw_write (regcache, regnum++, (char *) valbuf + i); } } @@ -1219,12 +1148,12 @@ static void sh3e_sh4_store_return_value (struct type *type, struct regcache *regcache, const void *valbuf) { - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (sh_treat_as_flt_p (type)) { int len = TYPE_LENGTH (type); int i, regnum = FP0_REGNUM; for (i = 0; i < len; i += 4) - regcache_raw_write (regcache, regnum++, (char *)valbuf + i); + regcache_raw_write (regcache, regnum++, (char *) valbuf + i); } else sh_default_store_return_value (type, regcache, valbuf); @@ -1246,24 +1175,17 @@ sh_generic_show_regs (void) (long) read_register (GBR_REGNUM), (long) read_register (VBR_REGNUM)); - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); } static void @@ -1280,27 +1202,20 @@ sh3_show_regs (void) (long) read_register (GBR_REGNUM), (long) read_register (VBR_REGNUM)); printf_filtered (" SSR=%08lx SPC=%08lx", - (long) read_register (SSR_REGNUM), + (long) read_register (SSR_REGNUM), (long) read_register (SPC_REGNUM)); - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); } @@ -1318,46 +1233,23 @@ sh2e_show_regs (void) (long) read_register (GBR_REGNUM), (long) read_register (VBR_REGNUM)); printf_filtered (" FPUL=%08lx FPSCR=%08lx", - (long) read_register (FPUL_REGNUM), - (long) read_register (FPSCR_REGNUM)); - - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + (long) read_register (FPUL_REGNUM), + (long) read_register (FPSCR_REGNUM)); + + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); - - printf_filtered (("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), - (long) read_register (FP0_REGNUM + 0), - (long) read_register (FP0_REGNUM + 1), - (long) read_register (FP0_REGNUM + 2), - (long) read_register (FP0_REGNUM + 3), - (long) read_register (FP0_REGNUM + 4), - (long) read_register (FP0_REGNUM + 5), - (long) read_register (FP0_REGNUM + 6), - (long) read_register (FP0_REGNUM + 7)); - printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), - (long) read_register (FP0_REGNUM + 8), - (long) read_register (FP0_REGNUM + 9), - (long) read_register (FP0_REGNUM + 10), - (long) read_register (FP0_REGNUM + 11), - (long) read_register (FP0_REGNUM + 12), - (long) read_register (FP0_REGNUM + 13), - (long) read_register (FP0_REGNUM + 14), - (long) read_register (FP0_REGNUM + 15)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); + + printf_filtered (("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 0), (long) read_register (FP0_REGNUM + 1), (long) read_register (FP0_REGNUM + 2), (long) read_register (FP0_REGNUM + 3), (long) read_register (FP0_REGNUM + 4), (long) read_register (FP0_REGNUM + 5), (long) read_register (FP0_REGNUM + 6), (long) read_register (FP0_REGNUM + 7)); + printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 8), (long) read_register (FP0_REGNUM + 9), (long) read_register (FP0_REGNUM + 10), (long) read_register (FP0_REGNUM + 11), (long) read_register (FP0_REGNUM + 12), (long) read_register (FP0_REGNUM + 13), (long) read_register (FP0_REGNUM + 14), (long) read_register (FP0_REGNUM + 15)); } static void @@ -1380,43 +1272,20 @@ sh3e_show_regs (void) (long) read_register (FPUL_REGNUM), (long) read_register (FPSCR_REGNUM)); - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); - - printf_filtered (("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), - (long) read_register (FP0_REGNUM + 0), - (long) read_register (FP0_REGNUM + 1), - (long) read_register (FP0_REGNUM + 2), - (long) read_register (FP0_REGNUM + 3), - (long) read_register (FP0_REGNUM + 4), - (long) read_register (FP0_REGNUM + 5), - (long) read_register (FP0_REGNUM + 6), - (long) read_register (FP0_REGNUM + 7)); - printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), - (long) read_register (FP0_REGNUM + 8), - (long) read_register (FP0_REGNUM + 9), - (long) read_register (FP0_REGNUM + 10), - (long) read_register (FP0_REGNUM + 11), - (long) read_register (FP0_REGNUM + 12), - (long) read_register (FP0_REGNUM + 13), - (long) read_register (FP0_REGNUM + 14), - (long) read_register (FP0_REGNUM + 15)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); + + printf_filtered (("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 0), (long) read_register (FP0_REGNUM + 1), (long) read_register (FP0_REGNUM + 2), (long) read_register (FP0_REGNUM + 3), (long) read_register (FP0_REGNUM + 4), (long) read_register (FP0_REGNUM + 5), (long) read_register (FP0_REGNUM + 6), (long) read_register (FP0_REGNUM + 7)); + printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 8), (long) read_register (FP0_REGNUM + 9), (long) read_register (FP0_REGNUM + 10), (long) read_register (FP0_REGNUM + 11), (long) read_register (FP0_REGNUM + 12), (long) read_register (FP0_REGNUM + 13), (long) read_register (FP0_REGNUM + 14), (long) read_register (FP0_REGNUM + 15)); } static void @@ -1437,36 +1306,26 @@ sh3_dsp_show_regs (void) (long) read_register (SSR_REGNUM), (long) read_register (SPC_REGNUM)); - printf_filtered (" DSR=%08lx", - (long) read_register (DSR_REGNUM)); - - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered (" DSR=%08lx", (long) read_register (DSR_REGNUM)); + + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); - - printf_filtered ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n", - (long) read_register (A0G_REGNUM) & 0xff, - (long) read_register (A0_REGNUM), - (long) read_register (M0_REGNUM), - (long) read_register (X0_REGNUM), - (long) read_register (Y0_REGNUM), - (long) read_register (RS_REGNUM), - (long) read_register (MOD_REGNUM)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); + + printf_filtered + ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n", + (long) read_register (A0G_REGNUM) & 0xff, + (long) read_register (A0_REGNUM), (long) read_register (M0_REGNUM), + (long) read_register (X0_REGNUM), (long) read_register (Y0_REGNUM), + (long) read_register (RS_REGNUM), (long) read_register (MOD_REGNUM)); printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n", (long) read_register (A1G_REGNUM) & 0xff, (long) read_register (A1_REGNUM), @@ -1497,28 +1356,22 @@ sh4_show_regs (void) (long) read_register (FPUL_REGNUM), (long) read_register (FPSCR_REGNUM)); - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); printf_filtered ((pr ? "DR0-DR6 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n" - : "FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), + : + "FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 0), (long) read_register (FP0_REGNUM + 1), (long) read_register (FP0_REGNUM + 2), @@ -1527,9 +1380,9 @@ sh4_show_regs (void) (long) read_register (FP0_REGNUM + 5), (long) read_register (FP0_REGNUM + 6), (long) read_register (FP0_REGNUM + 7)); - printf_filtered ((pr - ? "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n" - : "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), + printf_filtered ((pr ? + "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n" : + "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"), (long) read_register (FP0_REGNUM + 8), (long) read_register (FP0_REGNUM + 9), (long) read_register (FP0_REGNUM + 10), @@ -1541,6 +1394,36 @@ sh4_show_regs (void) } static void +sh4_nofpu_show_regs (void) +{ + printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n", + paddr (read_register (PC_REGNUM)), + (long) read_register (SR_REGNUM), + (long) read_register (PR_REGNUM), + (long) read_register (MACH_REGNUM), + (long) read_register (MACL_REGNUM)); + + printf_filtered ("GBR=%08lx VBR=%08lx", + (long) read_register (GBR_REGNUM), + (long) read_register (VBR_REGNUM)); + printf_filtered (" SSR=%08lx SPC=%08lx", + (long) read_register (SSR_REGNUM), + (long) read_register (SPC_REGNUM)); + + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); + printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); +} + +static void sh_dsp_show_regs (void) { printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n", @@ -1554,36 +1437,26 @@ sh_dsp_show_regs (void) (long) read_register (GBR_REGNUM), (long) read_register (VBR_REGNUM)); - printf_filtered (" DSR=%08lx", - (long) read_register (DSR_REGNUM)); - - printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (0), - (long) read_register (1), - (long) read_register (2), - (long) read_register (3), - (long) read_register (4), - (long) read_register (5), - (long) read_register (6), - (long) read_register (7)); + printf_filtered (" DSR=%08lx", (long) read_register (DSR_REGNUM)); + + printf_filtered + ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", + (long) read_register (0), (long) read_register (1), + (long) read_register (2), (long) read_register (3), + (long) read_register (4), (long) read_register (5), + (long) read_register (6), (long) read_register (7)); printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", - (long) read_register (8), - (long) read_register (9), - (long) read_register (10), - (long) read_register (11), - (long) read_register (12), - (long) read_register (13), - (long) read_register (14), - (long) read_register (15)); - - printf_filtered ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n", - (long) read_register (A0G_REGNUM) & 0xff, - (long) read_register (A0_REGNUM), - (long) read_register (M0_REGNUM), - (long) read_register (X0_REGNUM), - (long) read_register (Y0_REGNUM), - (long) read_register (RS_REGNUM), - (long) read_register (MOD_REGNUM)); + (long) read_register (8), (long) read_register (9), + (long) read_register (10), (long) read_register (11), + (long) read_register (12), (long) read_register (13), + (long) read_register (14), (long) read_register (15)); + + printf_filtered + ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n", + (long) read_register (A0G_REGNUM) & 0xff, + (long) read_register (A0_REGNUM), (long) read_register (M0_REGNUM), + (long) read_register (X0_REGNUM), (long) read_register (Y0_REGNUM), + (long) read_register (RS_REGNUM), (long) read_register (MOD_REGNUM)); printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n", (long) read_register (A1G_REGNUM) & 0xff, (long) read_register (A1_REGNUM), @@ -1597,7 +1470,7 @@ static void sh_show_regs_command (char *args, int from_tty) { if (sh_show_regs) - (*sh_show_regs)(); + (*sh_show_regs) (); } /* Return the GDB type object for the "standard" data type @@ -1606,8 +1479,7 @@ static struct type * sh_sh3e_register_type (struct gdbarch *gdbarch, int reg_nr) { if ((reg_nr >= FP0_REGNUM - && (reg_nr <= FP_LAST_REGNUM)) - || (reg_nr == FPUL_REGNUM)) + && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM)) return builtin_type_float; else return builtin_type_int; @@ -1626,14 +1498,11 @@ static struct type * sh_sh4_register_type (struct gdbarch *gdbarch, int reg_nr) { if ((reg_nr >= FP0_REGNUM - && (reg_nr <= FP_LAST_REGNUM)) - || (reg_nr == FPUL_REGNUM)) + && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM)) return builtin_type_float; - else if (reg_nr >= DR0_REGNUM - && reg_nr <= DR_LAST_REGNUM) + else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) return builtin_type_double; - else if (reg_nr >= FV0_REGNUM - && reg_nr <= FV_LAST_REGNUM) + else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM) return sh_sh4_build_float_register_type (3); else return builtin_type_int; @@ -1673,31 +1542,52 @@ sh_default_register_type (struct gdbarch *gdbarch, int reg_nr) static void sh_sh4_register_convert_to_virtual (int regnum, struct type *type, - char *from, char *to) + char *from, char *to) { - if (regnum >= DR0_REGNUM - && regnum <= DR_LAST_REGNUM) + if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM) { DOUBLEST val; - floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val); + floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, + from, &val); store_typed_floating (to, type, val); } else - error ("sh_register_convert_to_virtual called with non DR register number"); + error + ("sh_register_convert_to_virtual called with non DR register number"); } static void sh_sh4_register_convert_to_raw (struct type *type, int regnum, const void *from, void *to) { - if (regnum >= DR0_REGNUM - && regnum <= DR_LAST_REGNUM) + if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM) { DOUBLEST val = extract_typed_floating (from, type); - floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); + floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, + &val, to); } else - error("sh_register_convert_to_raw called with non DR register number"); + error ("sh_register_convert_to_raw called with non DR register number"); +} + +/* For vectors of 4 floating point registers. */ +static int +fv_reg_base_num (int fv_regnum) +{ + int fp_regnum; + + fp_regnum = FP0_REGNUM + (fv_regnum - FV0_REGNUM) * 4; + return fp_regnum; +} + +/* For double precision floating point registers, i.e 2 fp regs.*/ +static int +dr_reg_base_num (int dr_regnum) +{ + int fp_regnum; + + fp_regnum = FP0_REGNUM + (dr_regnum - DR0_REGNUM) * 2; + return fp_regnum; } static void @@ -1707,32 +1597,33 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int base_regnum, portion; char temp_buffer[MAX_REGISTER_SIZE]; - if (reg_nr >= DR0_REGNUM - && reg_nr <= DR_LAST_REGNUM) + if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); - /* Build the value in the provided buffer. */ + /* Build the value in the provided buffer. */ /* Read the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_raw_read (regcache, base_regnum + portion, + regcache_raw_read (regcache, base_regnum + portion, (temp_buffer - + register_size (gdbarch, base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); /* We must pay attention to the endiannes. */ sh_sh4_register_convert_to_virtual (reg_nr, - gdbarch_register_type (gdbarch, reg_nr), + gdbarch_register_type (gdbarch, + reg_nr), temp_buffer, buffer); } - else if (reg_nr >= FV0_REGNUM - && reg_nr <= FV_LAST_REGNUM) + else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM) { base_regnum = fv_reg_base_num (reg_nr); /* Read the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_raw_read (regcache, base_regnum + portion, + regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + register_size (gdbarch, base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } } @@ -1743,23 +1634,22 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int base_regnum, portion; char temp_buffer[MAX_REGISTER_SIZE]; - if (reg_nr >= DR0_REGNUM - && reg_nr <= DR_LAST_REGNUM) + if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); /* We must pay attention to the endiannes. */ - sh_sh4_register_convert_to_raw (gdbarch_register_type (gdbarch, reg_nr), reg_nr, - buffer, temp_buffer); + sh_sh4_register_convert_to_raw (gdbarch_register_type (gdbarch, reg_nr), + reg_nr, buffer, temp_buffer); /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_raw_write (regcache, base_regnum + portion, + regcache_raw_write (regcache, base_regnum + portion, (temp_buffer - + register_size (gdbarch, base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } - else if (reg_nr >= FV0_REGNUM - && reg_nr <= FV_LAST_REGNUM) + else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM) { base_regnum = fv_reg_base_num (reg_nr); @@ -1767,7 +1657,8 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 4; portion++) regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + register_size (gdbarch, base_regnum) * portion)); + + register_size (gdbarch, + base_regnum) * portion)); } } @@ -1777,12 +1668,12 @@ do_fv_register_info (struct gdbarch *gdbarch, struct ui_file *file, int fv_regnum) { int first_fp_reg_num = fv_reg_base_num (fv_regnum); - fprintf_filtered (file, "fv%d\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n", - fv_regnum - FV0_REGNUM, - (int) read_register (first_fp_reg_num), - (int) read_register (first_fp_reg_num + 1), - (int) read_register (first_fp_reg_num + 2), - (int) read_register (first_fp_reg_num + 3)); + fprintf_filtered (file, "fv%d\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n", + fv_regnum - FV0_REGNUM, + (int) read_register (first_fp_reg_num), + (int) read_register (first_fp_reg_num + 1), + (int) read_register (first_fp_reg_num + 2), + (int) read_register (first_fp_reg_num + 3)); } /* Double precision registers. */ @@ -1792,8 +1683,8 @@ do_dr_register_info (struct gdbarch *gdbarch, struct ui_file *file, { int first_fp_reg_num = dr_reg_base_num (dr_regnum); - fprintf_filtered (file, "dr%d\t0x%08x%08x\n", - dr_regnum - DR0_REGNUM, + fprintf_filtered (file, "dr%d\t0x%08x%08x\n", + dr_regnum - DR0_REGNUM, (int) read_register (first_fp_reg_num), (int) read_register (first_fp_reg_num + 1)); } @@ -1805,11 +1696,9 @@ sh_print_pseudo_register (struct gdbarch *gdbarch, struct ui_file *file, if (regnum < NUM_REGS || regnum >= NUM_REGS + NUM_PSEUDO_REGS) internal_error (__FILE__, __LINE__, "Invalid pseudo register number %d\n", regnum); - else if (regnum >= DR0_REGNUM - && regnum <= DR_LAST_REGNUM) + else if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM) do_dr_register_info (gdbarch, file, regnum); - else if (regnum >= FV0_REGNUM - && regnum <= FV_LAST_REGNUM) + else if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM) do_fv_register_info (gdbarch, file, regnum); } @@ -1817,7 +1706,7 @@ static void sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) { /* do values for FP (float) regs */ char *raw_buffer; - double flt; /* double extracted from raw hex data */ + double flt; /* double extracted from raw hex data */ int inv; int j; @@ -1828,7 +1717,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) if (!frame_register_read (get_selected_frame (), regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); - /* Get the register as a number */ + /* Get the register as a number */ flt = unpack_double (builtin_type_float, raw_buffer, &inv); /* Print the name and some spaces. */ @@ -1845,8 +1734,9 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) fprintf_filtered (file, "\t(raw 0x"); for (j = 0; j < register_size (gdbarch, regnum); j++) { - int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j - : register_size (gdbarch, regnum) - 1 - j; + int idx = (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + ? j + : register_size (gdbarch, regnum) - 1 - j); fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); } fprintf_filtered (file, ")"); @@ -1864,7 +1754,7 @@ sh_do_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) /* Get the data in raw format. */ if (!frame_register_read (get_selected_frame (), regnum, raw_buffer)) fprintf_filtered (file, "*value not available*\n"); - + val_print (gdbarch_register_type (gdbarch, regnum), raw_buffer, 0, 0, file, 'x', 1, 0, Val_pretty_default); fprintf_filtered (file, "\t"); @@ -1882,7 +1772,8 @@ sh_print_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum) else if (regnum >= 0 && regnum < NUM_REGS) { - if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT) + if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == + TYPE_CODE_FLT) sh_do_fp_register (gdbarch, file, regnum); /* FP regs */ else sh_do_register (gdbarch, file, regnum); /* All other regs */ @@ -1915,18 +1806,19 @@ sh_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, processor, so don't display anything. */ if (REGISTER_NAME (regnum) == NULL || *(REGISTER_NAME (regnum)) == '\0') - { + { regnum++; continue; } - if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT) + if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == + TYPE_CODE_FLT) { if (fpregs) { /* true for "INFO ALL-REGISTERS" command */ sh_do_fp_register (gdbarch, file, regnum); /* FP regs */ - regnum ++; + regnum++; } else regnum += (FP_LAST_REGNUM - FP0_REGNUM); /* skip FP regs */ @@ -1970,24 +1862,24 @@ sh_linux_svr4_fetch_link_map_offsets (void) lmo.r_debug_size = 8; /* 20 not actual size but all we need */ lmo.r_map_offset = 4; - lmo.r_map_size = 4; + lmo.r_map_size = 4; lmo.link_map_size = 20; /* 552 not actual size but all we need */ lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; + lmo.l_addr_size = 4; lmo.l_name_offset = 4; - lmo.l_name_size = 4; + lmo.l_name_size = 4; lmo.l_next_offset = 12; - lmo.l_next_size = 4; + lmo.l_next_size = 4; lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; + lmo.l_prev_size = 4; } - return lmp; + return lmp; } #endif /* SVR4_SHARED_LIBS */ @@ -2008,7 +1900,261 @@ sh_dsp_register_sim_regno (int nr) return nr - R0_BANK_REGNUM + SIM_SH_R0_BANK_REGNUM; return nr; } - + +static struct sh_frame_cache * +sh_alloc_frame_cache (void) +{ + struct sh_frame_cache *cache; + int i; + + cache = FRAME_OBSTACK_ZALLOC (struct sh_frame_cache); + + /* Base address. */ + cache->base = 0; + cache->saved_sp = 0; + cache->sp_offset = 0; + cache->pc = 0; + + /* Frameless until proven otherwise. */ + cache->uses_fp = 0; + + /* Saved registers. We initialize these to -1 since zero is a valid + offset (that's where fp is supposed to be stored). */ + for (i = 0; i < SH_NUM_REGS; i++) + { + cache->saved_regs[i] = -1; + } + + return cache; +} + +static struct sh_frame_cache * +sh_frame_cache (struct frame_info *next_frame, void **this_cache) +{ + struct sh_frame_cache *cache; + CORE_ADDR current_pc; + int i; + + if (*this_cache) + return *this_cache; + + cache = sh_alloc_frame_cache (); + *this_cache = cache; + + /* In principle, for normal frames, fp holds the frame pointer, + which holds the base address for the current stack frame. + However, for functions that don't need it, the frame pointer is + optional. For these "frameless" functions the frame pointer is + actually the frame pointer of the calling frame. */ + cache->base = frame_unwind_register_unsigned (next_frame, FP_REGNUM); + if (cache->base == 0) + return cache; + + cache->pc = frame_func_unwind (next_frame); + current_pc = frame_pc_unwind (next_frame); + if (cache->pc != 0) + sh_analyze_prologue (cache->pc, current_pc, cache); + + if (!cache->uses_fp) + { + /* We didn't find a valid frame, which means that CACHE->base + currently holds the frame pointer for our calling frame. If + we're at the start of a function, or somewhere half-way its + prologue, the function's frame probably hasn't been fully + setup yet. Try to reconstruct the base address for the stack + frame by looking at the stack pointer. For truly "frameless" + functions this might work too. */ + cache->base = frame_unwind_register_unsigned (next_frame, SP_REGNUM); + } + + /* Now that we have the base address for the stack frame we can + calculate the value of sp in the calling frame. */ + cache->saved_sp = cache->base + cache->sp_offset; + + /* Adjust all the saved registers such that they contain addresses + instead of offsets. */ + for (i = 0; i < SH_NUM_REGS; i++) + if (cache->saved_regs[i] != -1) + cache->saved_regs[i] = cache->saved_sp - cache->saved_regs[i] - 4; + + return cache; +} + +static void +sh_frame_prev_register (struct frame_info *next_frame, void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + + gdb_assert (regnum >= 0); + + if (regnum == SP_REGNUM && cache->saved_sp) + { + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (valuep) + { + /* Store the value. */ + store_unsigned_integer (valuep, 4, cache->saved_sp); + } + return; + } + + /* The PC of the previous frame is stored in the PR register of + the current frame. Frob regnum so that we pull the value from + the correct place. */ + if (regnum == PC_REGNUM) + regnum = PR_REGNUM; + + if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) + { + *optimizedp = 0; + *lvalp = lval_memory; + *addrp = cache->saved_regs[regnum]; + *realnump = -1; + if (valuep) + { + /* Read the value in from memory. */ + read_memory (*addrp, valuep, + register_size (current_gdbarch, regnum)); + } + return; + } + + frame_register_unwind (next_frame, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + +static void +sh_frame_this_id (struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + + /* This marks the outermost frame. */ + if (cache->base == 0) + return; + + *this_id = frame_id_build (cache->saved_sp, cache->pc); +} + +static const struct frame_unwind sh_frame_unwind = { + NORMAL_FRAME, + sh_frame_this_id, + sh_frame_prev_register +}; + +static const struct frame_unwind * +sh_frame_sniffer (struct frame_info *next_frame) +{ + return &sh_frame_unwind; +} + +static CORE_ADDR +sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_unwind_register_unsigned (next_frame, SP_REGNUM); +} + +static CORE_ADDR +sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_unwind_register_unsigned (next_frame, PC_REGNUM); +} + +static struct frame_id +sh_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + return frame_id_build (sh_unwind_sp (gdbarch, next_frame), + frame_pc_unwind (next_frame)); +} + +static CORE_ADDR +sh_frame_base_address (struct frame_info *next_frame, void **this_cache) +{ + struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + + return cache->base; +} + +static const struct frame_base sh_frame_base = { + &sh_frame_unwind, + sh_frame_base_address, + sh_frame_base_address, + sh_frame_base_address +}; + +/* The epilogue is defined here as the area at the end of a function, + either on the `ret' instruction itself or after an instruction which + destroys the function's stack frame. */ +static int +sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + CORE_ADDR func_addr = 0, func_end = 0; + + if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) + { + ULONGEST inst; + /* The sh epilogue is max. 14 bytes long. Give another 14 bytes + for a nop and some fixed data (e.g. big offsets) which are + unfortunately also treated as part of the function (which + means, they are below func_end. */ + CORE_ADDR addr = func_end - 28; + if (addr < func_addr + 4) + addr = func_addr + 4; + if (pc < addr) + return 0; + + /* First search forward until hitting an rts. */ + while (addr < func_end + && !IS_RTS (read_memory_unsigned_integer (addr, 2))) + addr += 2; + if (addr >= func_end) + return 0; + + /* At this point we should find a mov.l @r15+,r14 instruction, + either before or after the rts. If not, then the function has + probably no "normal" epilogue and we bail out here. */ + inst = read_memory_unsigned_integer (addr - 2, 2); + if (IS_RESTORE_FP (read_memory_unsigned_integer (addr - 2, 2))) + addr -= 2; + else if (!IS_RESTORE_FP (read_memory_unsigned_integer (addr + 2, 2))) + return 0; + + /* Step over possible lds.l @r15+,pr. */ + inst = read_memory_unsigned_integer (addr - 2, 2); + if (IS_LDS (inst)) + { + addr -= 2; + inst = read_memory_unsigned_integer (addr - 2, 2); + } + + /* Step over possible mov r14,r15. */ + if (IS_MOV_FP_SP (inst)) + { + addr -= 2; + inst = read_memory_unsigned_integer (addr - 2, 2); + } + + /* Now check for FP adjustments, using add #imm,r14 or add rX, r14 + instructions. */ + while (addr > func_addr + 4 + && (IS_ADD_REG_TO_FP (inst) || IS_ADD_IMM_FP (inst))) + { + addr -= 2; + inst = read_memory_unsigned_integer (addr - 2, 2); + } + + if (pc >= addr) + return 1; + } + return 0; +} + static gdbarch_init_ftype sh_gdbarch_init; static struct gdbarch * @@ -2019,33 +2165,40 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_show_regs = sh_generic_show_regs; switch (info.bfd_arch_info->mach) { - case bfd_mach_sh2e: - sh_show_regs = sh2e_show_regs; - break; - case bfd_mach_sh_dsp: - sh_show_regs = sh_dsp_show_regs; - break; - - case bfd_mach_sh3: - sh_show_regs = sh3_show_regs; - break; - - case bfd_mach_sh3e: - sh_show_regs = sh3e_show_regs; - break; - - case bfd_mach_sh3_dsp: - sh_show_regs = sh3_dsp_show_regs; - break; - - case bfd_mach_sh4: - sh_show_regs = sh4_show_regs; - break; - - case bfd_mach_sh5: - sh_show_regs = sh64_show_regs; - /* SH5 is handled entirely in sh64-tdep.c */ - return sh64_gdbarch_init (info, arches); + case bfd_mach_sh2e: + sh_show_regs = sh2e_show_regs; + break; + case bfd_mach_sh_dsp: + sh_show_regs = sh_dsp_show_regs; + break; + + case bfd_mach_sh3: + sh_show_regs = sh3_show_regs; + break; + + case bfd_mach_sh3e: + sh_show_regs = sh3e_show_regs; + break; + + case bfd_mach_sh3_dsp: + case bfd_mach_sh4al_dsp: + sh_show_regs = sh3_dsp_show_regs; + break; + + case bfd_mach_sh4: + case bfd_mach_sh4a: + sh_show_regs = sh4_show_regs; + break; + + case bfd_mach_sh4_nofpu: + case bfd_mach_sh4a_nofpu: + sh_show_regs = sh4_nofpu_show_regs; + break; + + case bfd_mach_sh5: + sh_show_regs = sh64_show_regs; + /* SH5 is handled entirely in sh64-tdep.c */ + return sh64_gdbarch_init (info, arches); } /* If there is already a candidate, use it. */ @@ -2057,10 +2210,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) provided. */ gdbarch = gdbarch_alloc (&info, NULL); - /* NOTE: cagney/2002-12-06: This can be deleted when this arch is - ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); - set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -2072,11 +2221,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, SH_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, 15); - set_gdbarch_deprecated_fp_regnum (gdbarch, 14); set_gdbarch_pc_regnum (gdbarch, 16); set_gdbarch_fp0_regnum (gdbarch, -1); set_gdbarch_num_pseudo_regs (gdbarch, 0); + set_gdbarch_register_type (gdbarch, sh_default_register_type); + + set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); + set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc); set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention); @@ -2085,160 +2237,126 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, generic_target_write_pc); + set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); + set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); + set_gdbarch_extract_struct_value_address (gdbarch, + sh_extract_struct_value_address); + set_gdbarch_skip_prologue (gdbarch, sh_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_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); + set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); + set_gdbarch_frameless_function_invocation (gdbarch, + frameless_look_for_prologue); set_gdbarch_believe_pcc_promotion (gdbarch, 1); - 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_pop_frame (gdbarch, sh_pop_frame); - 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_align (gdbarch, sh_frame_align); + set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp); + set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc); + set_gdbarch_unwind_dummy_id (gdbarch, sh_unwind_dummy_id); + frame_base_set_default (gdbarch, &sh_frame_base); + + set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p); switch (info.bfd_arch_info->mach) { case bfd_mach_sh: set_gdbarch_register_name (gdbarch, sh_sh_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; + case bfd_mach_sh2: set_gdbarch_register_name (gdbarch, sh_sh_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); - break; + break; + case bfd_mach_sh2e: /* doubles on sh2e and sh3e are actually 4 byte. */ set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_register_name (gdbarch, sh_sh2e_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); set_gdbarch_register_type (gdbarch, sh_sh3e_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); set_gdbarch_fp0_regnum (gdbarch, 25); set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, + sh3e_sh4_extract_return_value); set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; + case bfd_mach_sh_dsp: set_gdbarch_register_name (gdbarch, sh_sh_dsp_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; + case bfd_mach_sh3: set_gdbarch_register_name (gdbarch, sh_sh3_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; + case bfd_mach_sh3e: /* doubles on sh2e and sh3e are actually 4 byte. */ set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_register_name (gdbarch, sh_sh3e_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); set_gdbarch_register_type (gdbarch, sh_sh3e_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); set_gdbarch_fp0_regnum (gdbarch, 25); set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, + sh3e_sh4_extract_return_value); set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs); break; + case bfd_mach_sh3_dsp: set_gdbarch_register_name (gdbarch, sh_sh3_dsp_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; + case bfd_mach_sh4: + case bfd_mach_sh4a: set_gdbarch_register_name (gdbarch, sh_sh4_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); set_gdbarch_register_type (gdbarch, sh_sh4_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); set_gdbarch_fp0_regnum (gdbarch, 25); set_gdbarch_num_pseudo_regs (gdbarch, 12); set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write); set_gdbarch_store_return_value (gdbarch, sh3e_sh4_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, + sh3e_sh4_extract_return_value); set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_fpu); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); + break; - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs); + case bfd_mach_sh4_nofpu: + case bfd_mach_sh4a_nofpu: + set_gdbarch_register_name (gdbarch, sh_sh4_nofpu_register_name); + break; + + case bfd_mach_sh4al_dsp: + set_gdbarch_register_name (gdbarch, sh_sh4al_dsp_register_name); + set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno); break; + default: set_gdbarch_register_name (gdbarch, sh_generic_register_name); - set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info); - set_gdbarch_register_type (gdbarch, sh_default_register_type); - set_gdbarch_push_dummy_code (gdbarch, sh_push_dummy_code); - set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); - set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - - set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs); break; } /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); + frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + frame_unwind_append_sniffer (gdbarch, sh_frame_sniffer); + return gdbarch; } -extern initialize_file_ftype _initialize_sh_tdep; /* -Wmissing-prototypes */ +extern initialize_file_ftype _initialize_sh_tdep; /* -Wmissing-prototypes */ void _initialize_sh_tdep (void) { struct cmd_list_element *c; - + gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL); add_com ("regs", class_vars, sh_show_regs_command, "Print all registers"); diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h index e609b52..9c84c67 100644 --- a/gdb/sh-tdep.h +++ b/gdb/sh-tdep.h @@ -1,4 +1,4 @@ -/* Target-specific definition for a Hitachi Super-H. +/* Target-specific definition for a Renesas Super-H. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index a2e21c1..cec9fba 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -1,4 +1,4 @@ -/* Remote target glue for the Hitachi SH-3 ROM monitor. +/* Remote target glue for the Renesas SH-3 ROM monitor. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. @@ -365,11 +365,11 @@ _initialize_sh3_rom (void) init_monitor_ops (&sh3_ops); sh3_ops.to_shortname = "sh3"; - sh3_ops.to_longname = "Hitachi SH-3 rom monitor"; + sh3_ops.to_longname = "Renesas SH-3 rom monitor"; sh3_ops.to_doc = /* We can download through the parallel port too. */ - "Debug on a Hitachi eval board running the SH-3E rom monitor.\n" + "Debug on a Renesas eval board running the SH-3E rom monitor.\n" "Specify the serial device it is connected to.\n" "If you want to use the parallel port to download to it, specify that\n" "as an additional second argument."; @@ -384,11 +384,11 @@ _initialize_sh3_rom (void) init_monitor_ops (&sh3e_ops); sh3e_ops.to_shortname = "sh3e"; - sh3e_ops.to_longname = "Hitachi SH-3E rom monitor"; + sh3e_ops.to_longname = "Renesas SH-3E rom monitor"; sh3e_ops.to_doc = /* We can download through the parallel port too. */ - "Debug on a Hitachi eval board running the SH-3E rom monitor.\n" + "Debug on a Renesas eval board running the SH-3E rom monitor.\n" "Specify the serial device it is connected to.\n" "If you want to use the parallel port to download to it, specify that\n" "as an additional second argument."; diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 99372b8..ca87b8e 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1,4 +1,4 @@ -/* Target-dependent code for Hitachi Super-H, for GDB. +/* Target-dependent code for Renesas Super-H, for GDB. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -753,7 +753,7 @@ sh64_frame_chain (struct frame_info *frame) if (gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) size = 4; else - size = REGISTER_RAW_SIZE (translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode)); + size = DEPRECATED_REGISTER_RAW_SIZE (translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode)); return read_memory_integer (get_frame_base (frame) + get_frame_extra_info (frame)->f_offset, size); @@ -782,13 +782,13 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum) media_mode = pc_is_isa32 (get_frame_pc (fi)); - if (get_frame_saved_regs (fi)[pr_regnum] != 0) + if (deprecated_get_frame_saved_regs (fi)[pr_regnum] != 0) { int gdb_reg_num = translate_insn_rn (pr_regnum, media_mode); int size = ((gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) ? 4 - : REGISTER_RAW_SIZE (gdb_reg_num)); - return read_memory_integer (get_frame_saved_regs (fi)[pr_regnum], size); + : DEPRECATED_REGISTER_RAW_SIZE (gdb_reg_num)); + return read_memory_integer (deprecated_get_frame_saved_regs (fi)[pr_regnum], size); } } return read_register (pr_regnum); @@ -1027,17 +1027,17 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), get_frame_base (fi)); struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - if (get_frame_saved_regs (fi) == NULL) + if (deprecated_get_frame_saved_regs (fi) == NULL) frame_saved_regs_zalloc (fi); else - memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); + memset (deprecated_get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS); if (dummy_regs) { /* DANGER! This is ONLY going to work if the char buffer format of the saved registers is byte-for-byte identical to the CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */ - memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); + memcpy (deprecated_get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS); return; } @@ -1185,11 +1185,11 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) /* Watch out! saved_regs is only for the real registers, and doesn't include space for the pseudo registers. */ - get_frame_saved_regs (fi)[register_number]= get_frame_base (fi) - where[rn] + depth; + deprecated_get_frame_saved_regs (fi)[register_number]= get_frame_base (fi) - where[rn] + depth; } else - get_frame_saved_regs (fi)[register_number] = 0; + deprecated_get_frame_saved_regs (fi)[register_number] = 0; } if (have_fp) @@ -1205,11 +1205,11 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) if (tdep->sh_abi == SH_ABI_32) size = 4; else - size = REGISTER_RAW_SIZE (fp_regnum); - get_frame_saved_regs (fi)[sp_regnum] = read_memory_integer (get_frame_saved_regs (fi)[fp_regnum], size); + size = DEPRECATED_REGISTER_RAW_SIZE (fp_regnum); + deprecated_get_frame_saved_regs (fi)[sp_regnum] = read_memory_integer (deprecated_get_frame_saved_regs (fi)[fp_regnum], size); } else - get_frame_saved_regs (fi)[sp_regnum] = get_frame_base (fi); + deprecated_get_frame_saved_regs (fi)[sp_regnum] = get_frame_base (fi); get_frame_extra_info (fi)->f_offset = depth - where[fp_regnum]; } @@ -1293,27 +1293,27 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, memcpy (raw_buffer, (deprecated_generic_find_dummy_frame (get_frame_pc (frame), get_frame_base (frame)) + DEPRECATED_REGISTER_BYTE (regnum)), - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); return; } DEPRECATED_FRAME_INIT_SAVED_REGS (frame); - if (get_frame_saved_regs (frame) != NULL - && get_frame_saved_regs (frame)[regnum] != 0) + if (deprecated_get_frame_saved_regs (frame) != NULL + && deprecated_get_frame_saved_regs (frame)[regnum] != 0) { if (lval) /* found it saved on the stack */ *lval = lval_memory; if (regnum == SP_REGNUM) { if (raw_buffer) /* SP register treated specially */ - store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), - get_frame_saved_regs (frame)[regnum]); + store_unsigned_integer (raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum), + deprecated_get_frame_saved_regs (frame)[regnum]); } else { /* any other register */ if (addrp) - *addrp = get_frame_saved_regs (frame)[regnum]; + *addrp = deprecated_get_frame_saved_regs (frame)[regnum]; if (raw_buffer) { int size; @@ -1322,13 +1322,13 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, || live_regnum == PR_REGNUM)) size = 4; else - size = REGISTER_RAW_SIZE (live_regnum); + size = DEPRECATED_REGISTER_RAW_SIZE (live_regnum); if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) - read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer, size); + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer, size); else - read_memory (get_frame_saved_regs (frame)[regnum], + read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer - + REGISTER_RAW_SIZE (live_regnum) + + DEPRECATED_REGISTER_RAW_SIZE (live_regnum) - size, size); } @@ -1352,7 +1352,7 @@ static CORE_ADDR sh64_extract_struct_value_address (char *regbuf) { return (extract_unsigned_integer ((regbuf + DEPRECATED_REGISTER_BYTE (STRUCT_RETURN_REGNUM)), - REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM))); } static CORE_ADDR @@ -1384,7 +1384,7 @@ sh64_pop_frame (void) /* Copy regs from where they were saved in the frame */ for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) - if (get_frame_saved_regs (frame)[regnum]) + if (deprecated_get_frame_saved_regs (frame)[regnum]) { int size; if (tdep->sh_abi == SH_ABI_32 @@ -1392,10 +1392,10 @@ sh64_pop_frame (void) || regnum == PR_REGNUM)) size = 4; else - size = REGISTER_RAW_SIZE (translate_insn_rn (regnum, + size = DEPRECATED_REGISTER_RAW_SIZE (translate_insn_rn (regnum, media_mode)); write_register (regnum, - read_memory_integer (get_frame_saved_regs (frame)[regnum], + read_memory_integer (deprecated_get_frame_saved_regs (frame)[regnum], size)); } @@ -1414,7 +1414,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) /* Function: push_arguments Setup the function arguments for calling a function in the inferior. - On the Hitachi SH architecture, there are four registers (R4 to R7) + On the Renesas SH architecture, there are four registers (R4 to R7) which are dedicated for passing function arguments. Up to the first four arguments (depending on size) may go into these registers. The rest go on the stack. @@ -1526,7 +1526,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (TYPE_CODE (type) != TYPE_CODE_FLT) { - argreg_size = REGISTER_RAW_SIZE (int_argreg); + argreg_size = DEPRECATED_REGISTER_RAW_SIZE (int_argreg); if (len < argreg_size) { @@ -1702,7 +1702,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) return_register = DEFAULT_RETURN_REGNUM; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) offset = DEPRECATED_REGISTER_BYTE (return_register) + - REGISTER_RAW_SIZE (return_register) - len; + DEPRECATED_REGISTER_RAW_SIZE (return_register) - len; else offset = DEPRECATED_REGISTER_BYTE (return_register); memcpy (valbuf, (char *) regbuf + offset, len); @@ -1743,14 +1743,14 @@ sh64_store_return_value (struct type *type, char *valbuf) int return_register = DEFAULT_RETURN_REGNUM; int offset = 0; - if (len <= REGISTER_RAW_SIZE (return_register)) + if (len <= DEPRECATED_REGISTER_RAW_SIZE (return_register)) { /* Pad with zeros. */ - memset (buf, 0, REGISTER_RAW_SIZE (return_register)); + memset (buf, 0, DEPRECATED_REGISTER_RAW_SIZE (return_register)); if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) - offset = 0; /*REGISTER_RAW_SIZE (return_register) - len;*/ + offset = 0; /*DEPRECATED_REGISTER_RAW_SIZE (return_register) - len;*/ else - offset = REGISTER_RAW_SIZE (return_register) - len; + offset = DEPRECATED_REGISTER_RAW_SIZE (return_register) - len; memcpy (buf + offset, valbuf, len); deprecated_write_register_gen (return_register, buf); @@ -2092,7 +2092,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type, if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) { /* It is a no-op. */ - memcpy (to, from, REGISTER_RAW_SIZE (regnum)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regnum)); return; } @@ -2118,7 +2118,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum, if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) { /* It is a no-op. */ - memcpy (to, from, REGISTER_RAW_SIZE (regnum)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regnum)); return; } @@ -2155,10 +2155,10 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), + sh_sh64_register_convert_to_virtual (reg_nr, DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), temp_buffer, buffer); } @@ -2174,7 +2174,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= FV0_REGNUM @@ -2188,7 +2188,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 4; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } /* sh compact pseudo registers. 1-to-1 with a shmedia register */ @@ -2225,10 +2225,10 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_read (regcache, base_regnum + portion, (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), + sh_sh64_register_convert_to_virtual (reg_nr, DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), temp_buffer, buffer); } @@ -2243,7 +2243,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 4; portion++) regcache_raw_read (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr == FPSCR_C_REGNUM) @@ -2314,7 +2314,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = dr_reg_base_num (reg_nr); /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, + sh_sh64_register_convert_to_raw (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, buffer, temp_buffer); @@ -2322,7 +2322,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_write (regcache, base_regnum + portion, (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= FPP0_REGNUM @@ -2334,7 +2334,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= FV0_REGNUM @@ -2346,7 +2346,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 4; portion++) regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } /* sh compact general pseudo registers. 1-to-1 with a shmedia @@ -2385,12 +2385,12 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, for (portion = 0; portion < 2; portion++) { /* We must pay attention to the endiannes. */ - sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, + sh_sh64_register_convert_to_raw (DEPRECATED_REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, buffer, temp_buffer); regcache_raw_write (regcache, base_regnum + portion, (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -2403,7 +2403,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { regcache_raw_write (regcache, base_regnum + portion, ((char *) buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + + DEPRECATED_REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -2848,7 +2848,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* Determine the ABI */ if (info.abfd && bfd_get_arch_size (info.abfd) == 64) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 4689de6..3a2a649 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -401,8 +401,6 @@ lwp_to_thread (ptid_t lwp) /* Most target vector functions from here on actually just pass through to procfs.c, as they don't need to do anything specific for threads. */ - -/* ARGSUSED */ static void sol_thread_open (char *arg, int from_tty) { diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 7fda5e4..48fb6cb 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1,7 +1,7 @@ /* Handle SVR4 shared libraries for GDB, the GNU Debugger. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, + 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -37,6 +37,9 @@ #include "solist.h" #include "solib-svr4.h" +#include "bfd-target.h" +#include "exec.h" + #ifndef SVR4_FETCH_LINK_MAP_OFFSETS #define SVR4_FETCH_LINK_MAP_OFFSETS() svr4_fetch_link_map_offsets () #endif @@ -225,7 +228,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags) for (i = 0; i < number_of_symbols; i++) { sym = *symbol_table++; - if (STREQ (sym->name, symname) + if (strcmp (sym->name, symname) == 0 && (sym->section->flags & sect_flags) == sect_flags) { /* Bfd symbols are section relative. */ @@ -254,7 +257,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags) { sym = *symbol_table++; - if (STREQ (sym->name, symname) + if (strcmp (sym->name, symname) == 0 && (sym->section->flags & sect_flags) == sect_flags) { /* Bfd symbols are section relative. */ @@ -422,7 +425,7 @@ look_for_base (int fd, CORE_ADDR baseaddr) static CORE_ADDR elf_locate_base (void) { - sec_ptr dyninfo_sect; + struct bfd_section *dyninfo_sect; int dyninfo_sect_size; CORE_ADDR dyninfo_addr; char *buf; @@ -911,6 +914,24 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) || in_plt_section (pc, NULL)); } +/* Given an executable's ABFD and target, compute the entry-point + address. */ + +static CORE_ADDR +exec_entry_point (struct bfd *abfd, struct target_ops *targ) +{ + /* KevinB wrote ... for most targets, the address returned by + bfd_get_start_address() is the entry point for the start + function. But, for some targets, bfd_get_start_address() returns + the address of a function descriptor from which the entry point + address may be extracted. This address is extracted by + gdbarch_convert_from_func_ptr_addr(). The method + gdbarch_convert_from_func_ptr_addr() is the merely the identify + function for targets which don't use function descriptors. */ + return gdbarch_convert_from_func_ptr_addr (current_gdbarch, + bfd_get_start_address (abfd), + targ); +} /* @@ -984,6 +1005,7 @@ enable_break (void) int load_addr_found = 0; struct so_list *inferior_sos; bfd *tmp_bfd = NULL; + struct target_ops *tmp_bfd_target; int tmp_fd = -1; char *tmp_pathname = NULL; CORE_ADDR sym_addr = 0; @@ -1019,6 +1041,11 @@ enable_break (void) goto bkpt_at_symbol; } + /* Now convert the TMP_BFD into a target. That way target, as + well as BFD operations can be used. Note that closing the + target will also close the underlying bfd. */ + tmp_bfd_target = target_bfd_reopen (tmp_bfd); + /* If the entry in _DYNAMIC for the dynamic linker has already been filled in, we can read its base address from there. */ inferior_sos = svr4_current_sos (); @@ -1042,7 +1069,8 @@ enable_break (void) the current pc (which should point at the entry point for the dynamic linker) and subtracting the offset of the entry point. */ if (!load_addr_found) - load_addr = read_pc () - tmp_bfd->start_address; + load_addr = (read_pc () + - exec_entry_point (tmp_bfd, tmp_bfd_target)); /* Record the relocated start and end address of the dynamic linker text and plt section for svr4_in_dynsym_resolve_code. */ @@ -1080,8 +1108,9 @@ enable_break (void) break; } - /* We're done with the temporary bfd. */ - bfd_close (tmp_bfd); + /* We're done with both the temporary bfd and target. Remember, + closing the target closes the underlying bfd. */ + target_close (tmp_bfd_target, 0); if (sym_addr != 0) { @@ -1200,7 +1229,7 @@ svr4_relocate_main_executable (void) interp_sect = bfd_get_section_by_name (exec_bfd, ".interp"); if (interp_sect == NULL && (bfd_get_file_flags (exec_bfd) & DYNAMIC) != 0 - && bfd_get_start_address (exec_bfd) != pc) + && (exec_entry_point (exec_bfd, &exec_ops) != pc)) { struct cleanup *old_chain; struct section_offsets *new_offsets; @@ -1232,7 +1261,7 @@ svr4_relocate_main_executable (void) The same language also appears in Edition 4.0 of the System V ABI and is left unspecified in some of the earlier editions. */ - displacement = pc - bfd_get_start_address (exec_bfd); + displacement = pc - exec_entry_point (exec_bfd, &exec_ops); changed = 0; new_offsets = xcalloc (symfile_objfile->num_sections, diff --git a/gdb/solib.c b/gdb/solib.c index f77993c..baabf20 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -40,7 +40,7 @@ #include "gdbcmd.h" #include "completer.h" #include "filenames.h" /* for DOSish file names */ - +#include "exec.h" #include "solist.h" #include <readline/readline.h> @@ -275,7 +275,7 @@ solib_map_sections (void *arg) object's file by the base address to which the object was actually mapped. */ TARGET_SO_RELOCATE_SECTION_ADDRESSES (so, p); - if (STREQ (p->the_bfd_section->name, ".text")) + if (strcmp (p->the_bfd_section->name, ".text") == 0) { so->textsection = p; } diff --git a/gdb/somsolib.c b/gdb/somsolib.c index ed54ad0..b2a833c 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -42,6 +42,7 @@ #include "language.h" #include "regcache.h" #include "gdb_assert.h" +#include "exec.h" #include <fcntl.h> @@ -55,10 +56,6 @@ /* #define SOLIB_DEBUG */ -/* Defined in exec.c; used to prevent dangling pointer bug. - */ -extern struct target_ops exec_ops; - /* This lives in hppa-tdep.c. */ extern struct unwind_table_entry *find_unwind_entry (CORE_ADDR pc); @@ -937,7 +934,7 @@ som_solib_create_inferior_hook (void) /* What a crock. */ msymbol2 = lookup_minimal_symbol_solib_trampoline (DEPRECATED_SYMBOL_NAME (msymbol), - NULL, objfile); + objfile); /* Found a symbol with the right name. */ if (msymbol2) { @@ -1225,7 +1222,6 @@ som_solib_desire_dynamic_linker_symbols (void) } dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_load", - NULL, objfile); if (dld_msymbol != NULL) { @@ -1265,7 +1261,6 @@ som_solib_desire_dynamic_linker_symbols (void) } dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_unload", - NULL, objfile); if (dld_msymbol != NULL) { diff --git a/gdb/source.c b/gdb/source.c index e4e5caa..0ed3b3e 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1347,7 +1347,6 @@ line_info (char *arg, int from_tty) /* Commands to search the source file for a regexp. */ -/* ARGSUSED */ static void forward_search_command (char *regex, int from_tty) { @@ -1443,7 +1442,6 @@ forward_search_command (char *regex, int from_tty) fclose (stream); } -/* ARGSUSED */ static void reverse_search_command (char *regex, int from_tty) { diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index a4df865..a76d0e5 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -103,7 +103,7 @@ fetch_inferior_registers (int regno) deprecated_registers[DEPRECATED_REGISTER_BYTE (0)] = 0; memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (1)], - &inferior_registers.r_g1, 15 * REGISTER_RAW_SIZE (G0_REGNUM)); + &inferior_registers.r_g1, 15 * DEPRECATED_REGISTER_RAW_SIZE (G0_REGNUM)); *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)] @@ -149,7 +149,7 @@ fetch_inferior_registers (int regno) { CORE_ADDR sp = *(unsigned int *) & deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)]; target_read_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); for (i = L0_REGNUM; i <= I7_REGNUM; i++) deprecated_register_valid[i] = 1; } @@ -160,7 +160,7 @@ fetch_inferior_registers (int regno) if (deprecated_register_valid[regno]) printf_unfiltered ("register %d valid and read\n", regno); target_read_memory (sp + i - DEPRECATED_REGISTER_BYTE (L0_REGNUM), - &deprecated_registers[i], REGISTER_RAW_SIZE (regno)); + &deprecated_registers[i], DEPRECATED_REGISTER_RAW_SIZE (regno)); deprecated_register_valid[regno] = 1; } } @@ -234,7 +234,7 @@ store_inferior_registers (int regno) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM)); + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM)); } else { @@ -242,7 +242,7 @@ store_inferior_registers (int regno) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp + DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (L0_REGNUM), &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); } } @@ -254,7 +254,7 @@ store_inferior_registers (int regno) memcpy (&inferior_registers.r_g1, &deprecated_registers[DEPRECATED_REGISTER_BYTE (G1_REGNUM)], - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); + 15 * DEPRECATED_REGISTER_RAW_SIZE (G1_REGNUM)); inferior_registers.r_ps = *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)]; @@ -315,7 +315,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, /* The globals and output registers. */ memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); + 15 * DEPRECATED_REGISTER_RAW_SIZE (G1_REGNUM)); *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (DEPRECATED_NPC_REGNUM)] = gregs->r_npc; @@ -332,7 +332,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, sp = *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (SP_REGNUM)]; if (0 != target_read_memory (sp, &deprecated_registers[DEPRECATED_REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM))) + 16 * DEPRECATED_REGISTER_RAW_SIZE (L0_REGNUM))) { /* fprintf_unfiltered so user can still use gdb */ fprintf_unfiltered (gdb_stderr, diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 3a81821..c32d302 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -52,10 +52,6 @@ * Some local macros that have multi-arch and non-multi-arch versions: */ -#if 0 -// OBSOLETE /* Does the target have Floating Point registers? */ -// OBSOLETE #define SPARC_HAS_FPU (gdbarch_tdep (current_gdbarch)->has_fpu) -#endif #define SPARC_HAS_FPU 1 /* Number of bytes devoted to Floating Point registers: */ #define FP_REGISTER_BYTES (gdbarch_tdep (current_gdbarch)->fp_register_bytes) @@ -68,9 +64,6 @@ struct gdbarch_tdep { -#if 0 - // OBSOLETE int has_fpu; -#endif int fp_register_bytes; int y_regnum; int fp_max_regnum; @@ -97,15 +90,6 @@ struct gdbarch_tdep int deferred_stores = 0; /* Accumulated stores we want to do eventually. */ -#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 - - const unsigned char * sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len) { @@ -299,7 +283,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* Should we adjust for stack bias here? */ ULONGEST tmp; - frame_read_unsigned_register (fi, DEPRECATED_FP_REGNUM, &tmp); + tmp = get_frame_register_unsigned (fi, DEPRECATED_FP_REGNUM); 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); @@ -339,7 +323,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Overwrite the frame's address with the value in %i7. */ { ULONGEST tmp; - frame_read_unsigned_register (fi, I7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (fi, I7_REGNUM); deprecated_update_frame_base_hack (fi, tmp); } @@ -455,7 +439,7 @@ sparc_frame_saved_pc (struct frame_info *frame) /* The sigcontext address is contained in register O2. */ { ULONGEST tmp; - frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp); + tmp = get_frame_register_unsigned (frame, O0_REGNUM + 2); sigcontext_addr = tmp; } @@ -474,7 +458,7 @@ 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. */ ULONGEST tmp; - frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (frame, O7_REGNUM); return PC_ADJUST (tmp); } if (get_frame_extra_info (frame)->flat) @@ -815,7 +799,7 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (raw_buffer != NULL) { /* Put it back in target format. */ - store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), get_frame_pc (frame)); + store_unsigned_integer (raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum), get_frame_pc (frame)); } if (addrp != NULL) *addrp = 0; @@ -923,14 +907,14 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (raw_buffer != NULL) { /* Put it back in target format. */ - store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), addr); + store_unsigned_integer (raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum), addr); } if (addrp != NULL) *addrp = 0; return; } if (raw_buffer != NULL) - read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum)); + read_memory (addr, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (regnum)); } else { @@ -974,10 +958,10 @@ sparc_push_dummy_frame (void) /* PC, NPC, CCR, FSR, FPRS, Y, ASI */ deprecated_read_register_bytes (DEPRECATED_REGISTER_BYTE (PC_REGNUM), ®ister_temp[0], - REGISTER_RAW_SIZE (PC_REGNUM) * 7); + DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM) * 7); deprecated_read_register_bytes (DEPRECATED_REGISTER_BYTE (PSTATE_REGNUM), ®ister_temp[7 * SPARC_INTREG_SIZE], - REGISTER_RAW_SIZE (PSTATE_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (PSTATE_REGNUM)); /* FIXME: not sure what needs to be saved here. */ } else @@ -985,7 +969,7 @@ sparc_push_dummy_frame (void) /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */ deprecated_read_register_bytes (DEPRECATED_REGISTER_BYTE (Y_REGNUM), ®ister_temp[0], - REGISTER_RAW_SIZE (Y_REGNUM) * 8); + DEPRECATED_REGISTER_RAW_SIZE (Y_REGNUM) * 8); } deprecated_read_register_bytes (DEPRECATED_REGISTER_BYTE (O0_REGNUM), @@ -1308,36 +1292,36 @@ sparc_pop_frame (void) if (fsr[PS_REGNUM]) write_register (PS_REGNUM, read_memory_integer (fsr[PS_REGNUM], - REGISTER_RAW_SIZE (PS_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (PS_REGNUM))); if (fsr[Y_REGNUM]) write_register (Y_REGNUM, read_memory_integer (fsr[Y_REGNUM], - REGISTER_RAW_SIZE (Y_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (Y_REGNUM))); if (fsr[PC_REGNUM]) { /* Explicitly specified PC (and maybe NPC) -- just restore them. */ write_register (PC_REGNUM, read_memory_integer (fsr[PC_REGNUM], - REGISTER_RAW_SIZE (PC_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM))); if (fsr[DEPRECATED_NPC_REGNUM]) write_register (DEPRECATED_NPC_REGNUM, read_memory_integer (fsr[DEPRECATED_NPC_REGNUM], - REGISTER_RAW_SIZE (DEPRECATED_NPC_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (DEPRECATED_NPC_REGNUM))); } else if (get_frame_extra_info (frame)->flat) { if (get_frame_extra_info (frame)->pc_addr) pc = PC_ADJUST ((CORE_ADDR) read_memory_integer (get_frame_extra_info (frame)->pc_addr, - REGISTER_RAW_SIZE (PC_REGNUM))); + DEPRECATED_REGISTER_RAW_SIZE (PC_REGNUM))); else { /* I think this happens only in the innermost frame, if so then it is a complicated way of saying "pc = read_register (O7_REGNUM);". */ ULONGEST tmp; - frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (frame, O7_REGNUM); pc = PC_ADJUST (tmp); } @@ -1713,7 +1697,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) { from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)]; to = (char *) &fpregsetp->pr_fr.pr_regs[regi - FP0_REGNUM]; - memcpy (to, from, REGISTER_RAW_SIZE (regi)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi)); } } @@ -1722,7 +1706,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) { from = (char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (FPS_REGNUM)]; to = (char *) &fpregsetp->pr_fsr; - memcpy (to, from, REGISTER_RAW_SIZE (FPS_REGNUM)); + memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (FPS_REGNUM)); } } @@ -2032,9 +2016,9 @@ sparc_print_registers (struct gdbarch *gdbarch, { if (!print_all) { - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + if (TYPE_CODE (DEPRECATED_REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) continue; - if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) + if (TYPE_VECTOR (DEPRECATED_REGISTER_VIRTUAL_TYPE (i))) continue; } } @@ -2059,25 +2043,25 @@ sparc_print_registers (struct gdbarch *gdbarch, continue; } - memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (i)); + memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_VIRTUAL_SIZE (i)); /* If virtual format is floating, print it that way, and in raw hex. */ - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + if (TYPE_CODE (DEPRECATED_REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) { int j; - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, file, 0, 1, 0, Val_pretty_default); fprintf_filtered (file, "\t(raw 0x"); - for (j = 0; j < REGISTER_RAW_SIZE (i); j++) + for (j = 0; j < DEPRECATED_REGISTER_RAW_SIZE (i); j++) { int idx; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) idx = j; else - idx = REGISTER_RAW_SIZE (i) - 1 - j; + idx = DEPRECATED_REGISTER_RAW_SIZE (i) - 1 - j; fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); } fprintf_filtered (file, ")"); @@ -2085,14 +2069,14 @@ sparc_print_registers (struct gdbarch *gdbarch, else { /* Print the register in hex. */ - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, file, 'x', 1, 0, Val_pretty_default); /* If not a vector register, print it also according to its natural format. */ - if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) + if (TYPE_VECTOR (DEPRECATED_REGISTER_VIRTUAL_TYPE (i)) == 0) { fprintf_filtered (file, "\t"); - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, file, 0, 1, 0, Val_pretty_default); } } @@ -2122,24 +2106,6 @@ sparc_do_registers_info (int regnum, int all) 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 - #define SPARC_F0_REGNUM FP0_REGNUM /* %f0 */ #define SPARC_F1_REGNUM (FP0_REGNUM + 1)/* %f1 */ #define SPARC_O0_REGNUM O0_REGNUM /* %o0 */ @@ -2408,10 +2374,10 @@ sparc_store_return_value (struct type *type, char *valbuf) regno = O0_REGNUM; /* Add leading zeros to the value. */ - if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (regno)) + if (TYPE_LENGTH (type) < DEPRECATED_REGISTER_RAW_SIZE (regno)) { - memset (buffer, 0, REGISTER_RAW_SIZE (regno)); - memcpy (buffer + REGISTER_RAW_SIZE (regno) - TYPE_LENGTH (type), valbuf, + memset (buffer, 0, DEPRECATED_REGISTER_RAW_SIZE (regno)); + memcpy (buffer + DEPRECATED_REGISTER_RAW_SIZE (regno) - TYPE_LENGTH (type), valbuf, TYPE_LENGTH (type)); deprecated_write_register_gen (regno, buffer); } @@ -2420,17 +2386,6 @@ sparc_store_return_value (struct type *type, char *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 #define CALL_DUMMY_CALL_OFFSET \ (gdbarch_tdep (current_gdbarch)->call_dummy_call_offset) @@ -2495,45 +2450,8 @@ sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, store_unsigned_integer (dummy + (i * 4), 4, 0x01000000); } } - -#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 } - -#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. */ @@ -2549,8 +2467,6 @@ _initialize_sparc_tdep (void) { /* Hook us into the gdbarch mechanism. */ gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep); - - /* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */ } /* Compensate for stack bias. Note that we currently don't handle @@ -2722,7 +2638,7 @@ sp64_extract_return_value (struct type *type, char *regbuf, char *valbuf, int bitoffset) { int typelen = TYPE_LENGTH (type); - int regsize = REGISTER_RAW_SIZE (O0_REGNUM); + int regsize = DEPRECATED_REGISTER_RAW_SIZE (O0_REGNUM); if (TYPE_CODE (type) == TYPE_CODE_FLT && SPARC_HAS_FPU) { @@ -2780,20 +2696,6 @@ sparc64_extract_return_value (struct type *type, char *regbuf, char *valbuf) sp64_extract_return_value (type, regbuf, valbuf, 0); } -#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) { @@ -2815,24 +2717,6 @@ sparc_print_extra_frame_info (struct frame_info *fi) paddr_nz (get_frame_extra_info (fi)->fp_addr)); } -/* MULTI_ARCH support */ - -const char * -legacy_register_name (int i) -{ -#ifdef REGISTER_NAMES - static char *names[] = REGISTER_NAMES; - if (i < 0 || i >= (sizeof (names) / sizeof (*names))) - return NULL; - else - return names[i]; -#else - internal_error (__FILE__, __LINE__, - "legacy_register_name: called."); - return NULL; -#endif -} - static const char * sparc32_register_name (int regno) { @@ -2889,71 +2773,6 @@ sparc64_register_name (int regno) return register_names[regno]; } -#if 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 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 - static CORE_ADDR sparc_push_return_address (CORE_ADDR pc_unused, CORE_ADDR sp) { @@ -3187,7 +3006,7 @@ sparc_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, O0_REGNUM + argi, &addr); + get_frame_register (frame, O0_REGNUM + argi, &addr); return addr; } @@ -3306,15 +3125,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) switch (info.bfd_arch_info->mach) { case bfd_mach_sparc: -#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: -#if 0 - // OBSOLETE case bfd_mach_sparc_sparclite_le: -#endif /* 32-bit machine types: */ #ifdef SPARC32_CALL_DUMMY_ON_STACK @@ -3478,36 +3290,9 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, 72); set_gdbarch_deprecated_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); set_gdbarch_register_name (gdbarch, sparc32_register_name); -#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; -#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_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_store_return_value (gdbarch, sparc32_store_return_value); @@ -3516,9 +3301,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, sparc32_register_name); tdep->print_insn_mach = bfd_mach_sparc; tdep->fp_register_bytes = 32 * 4; -#if 0 - // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ -#endif break; case bfd_mach_sparc_v8plusa: set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); @@ -3526,33 +3308,15 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, 72); set_gdbarch_deprecated_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); set_gdbarch_register_name (gdbarch, sparc32_register_name); -#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; -#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_deprecated_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); -#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; @@ -3562,9 +3326,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_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); -#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; @@ -3586,10 +3347,6 @@ sparc_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) if (tdep == NULL) return; -#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/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c index 1e68d69..c68b96b 100644 --- a/gdb/sparc64nbsd-nat.c +++ b/gdb/sparc64nbsd-nat.c @@ -40,7 +40,7 @@ getregs_supplies (int regno) /* FIXME: PS_REGNUM for 32-bit code. */ return (regno == TSTATE_REGNUM || regno == PC_REGNUM - || regno == NPC_REGNUM + || regno == DEPRECATED_NPC_REGNUM || regno == Y_REGNUM || (regno >= G0_REGNUM && regno <= G7_REGNUM) || (regno >= O0_REGNUM && regno <= O7_REGNUM) diff --git a/gdb/sparcl-stub.c b/gdb/sparcl-stub.c deleted file mode 100644 index 6ba55a0..0000000 --- a/gdb/sparcl-stub.c +++ /dev/null @@ -1,946 +0,0 @@ -// 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 deleted file mode 100644 index 8c376c5..0000000 --- a/gdb/sparcl-tdep.c +++ /dev/null @@ -1,869 +0,0 @@ -// 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 deleted file mode 100644 index 9247131..0000000 --- a/gdb/sparclet-rom.c +++ /dev/null @@ -1,316 +0,0 @@ -// 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 deleted file mode 100644 index 88740f2..0000000 --- a/gdb/sparclet-stub.c +++ /dev/null @@ -1,1167 +0,0 @@ -// 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 diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c index f63d9e5..ef52746 100644 --- a/gdb/sparcnbsd-nat.c +++ b/gdb/sparcnbsd-nat.c @@ -39,7 +39,7 @@ getregs_supplies (int regno) { return (regno == PS_REGNUM || regno == PC_REGNUM - || regno == NPC_REGNUM + || regno == DEPRECATED_NPC_REGNUM || regno == Y_REGNUM || (regno >= G0_REGNUM && regno <= G7_REGNUM) || (regno >= O0_REGNUM && regno <= O7_REGNUM) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index e3400f8..7d04cc7 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -153,43 +153,13 @@ static void add_undefined_type (struct type *); static int read_cpp_abbrev (struct field_info *, char **, struct type *, struct objfile *); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* new functions added for cfront support */ - -// OBSOLETE static int -// OBSOLETE copy_cfront_struct_fields (struct field_info *, struct type *, -// OBSOLETE struct objfile *); - -// OBSOLETE static char *get_cfront_method_physname (char *); - -// OBSOLETE static int -// OBSOLETE read_cfront_baseclasses (struct field_info *, char **, -// OBSOLETE struct type *, struct objfile *); - -// OBSOLETE static int -// OBSOLETE read_cfront_static_fields (struct field_info *, char **, -// OBSOLETE struct type *, struct objfile *); -// OBSOLETE static int -// OBSOLETE read_cfront_member_functions (struct field_info *, char **, -// OBSOLETE struct type *, struct objfile *); - -// OBSOLETE /* end new functions added for cfront support */ -#endif /* OBSOLETE CFront */ static char *find_name_end (char *name); -static void add_live_range (struct objfile *, struct symbol *, CORE_ADDR, - CORE_ADDR); - -static int resolve_live_range (struct objfile *, struct symbol *, char *); - static int process_reference (char **string); static CORE_ADDR ref_search_value (int refnum); -static int resolve_symbol_reference (struct objfile *, struct symbol *, - char *); - void stabsread_clear_cache (void); static const char vptr_name[] = "_vptr$"; @@ -497,592 +467,6 @@ read_type_number (char **pp, int *typenums) #define VISIBILITY_PUBLIC '2' /* Stabs character for public field */ #define VISIBILITY_IGNORE '9' /* Optimized out or zero length */ -#if 0 /* OBSOLETE CFront */ -// OBSOLETE #define CFRONT_VISIBILITY_PRIVATE '2' /* Stabs character for private field */ -// OBSOLETE #define CFRONT_VISIBILITY_PUBLIC '1' /* Stabs character for public field */ - -// OBSOLETE /* This code added to support parsing of ARM/Cfront stabs strings */ - -// OBSOLETE /* Get substring from string up to char c, advance string pointer past -// OBSOLETE suibstring. */ - -// OBSOLETE static char * -// OBSOLETE get_substring (char **p, int c) -// OBSOLETE { -// OBSOLETE char *str; -// OBSOLETE str = *p; -// OBSOLETE *p = strchr (*p, c); -// OBSOLETE if (*p) -// OBSOLETE { -// OBSOLETE **p = 0; -// OBSOLETE (*p)++; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE str = 0; -// OBSOLETE return str; -// OBSOLETE } - -// OBSOLETE /* Physname gets strcat'd onto sname in order to recreate the mangled -// OBSOLETE name (see funtion gdb_mangle_name in gdbtypes.c). For cfront, make -// OBSOLETE the physname look like that of g++ - take out the initial mangling -// OBSOLETE eg: for sname="a" and fname="foo__1aFPFs_i" return "FPFs_i" */ - -// OBSOLETE static char * -// OBSOLETE get_cfront_method_physname (char *fname) -// OBSOLETE { -// OBSOLETE int len = 0; -// OBSOLETE /* FIXME would like to make this generic for g++ too, but -// OBSOLETE that is already handled in read_member_funcctions */ -// OBSOLETE char *p = fname; - -// OBSOLETE /* search ahead to find the start of the mangled suffix */ -// OBSOLETE if (*p == '_' && *(p + 1) == '_') /* compiler generated; probably a ctor/dtor */ -// OBSOLETE p += 2; -// OBSOLETE while (p && (unsigned) ((p + 1) - fname) < strlen (fname) && *(p + 1) != '_') -// OBSOLETE p = strchr (p, '_'); -// OBSOLETE if (!(p && *p == '_' && *(p + 1) == '_')) -// OBSOLETE error ("Invalid mangled function name %s", fname); -// OBSOLETE p += 2; /* advance past '__' */ - -// OBSOLETE /* struct name length and name of type should come next; advance past it */ -// OBSOLETE while (isdigit (*p)) -// OBSOLETE { -// OBSOLETE len = len * 10 + (*p - '0'); -// OBSOLETE p++; -// OBSOLETE } -// OBSOLETE p += len; - -// OBSOLETE return p; -// OBSOLETE } - -// OBSOLETE static void -// OBSOLETE msg_unknown_complaint (const char *arg1) -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, "Unsupported token in stabs string %s", arg1); -// OBSOLETE } - -// OBSOLETE /* Read base classes within cfront class definition. -// OBSOLETE eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;; -// OBSOLETE ^^^^^^^^^^^^^^^^^^ - -// OBSOLETE A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;; -// OBSOLETE ^ -// OBSOLETE */ - -// OBSOLETE static int -// OBSOLETE read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, -// OBSOLETE struct objfile *objfile) -// OBSOLETE { -// OBSOLETE int bnum = 0; -// OBSOLETE char *p; -// OBSOLETE int i; -// OBSOLETE struct nextfield *new; - -// OBSOLETE if (**pp == ';') /* no base classes; return */ -// OBSOLETE { -// OBSOLETE ++(*pp); -// OBSOLETE return 1; -// OBSOLETE } - -// OBSOLETE /* first count base classes so we can allocate space before parsing */ -// OBSOLETE for (p = *pp; p && *p && *p != ';'; p++) -// OBSOLETE { -// OBSOLETE if (*p == ' ') -// OBSOLETE bnum++; -// OBSOLETE } -// OBSOLETE bnum++; /* add one more for last one */ - -// OBSOLETE /* now parse the base classes until we get to the start of the methods -// OBSOLETE (code extracted and munged from read_baseclasses) */ -// OBSOLETE ALLOCATE_CPLUS_STRUCT_TYPE (type); -// OBSOLETE TYPE_N_BASECLASSES (type) = bnum; - -// OBSOLETE /* allocate space */ -// OBSOLETE { -// OBSOLETE int num_bytes = B_BYTES (TYPE_N_BASECLASSES (type)); -// OBSOLETE char *pointer; - -// OBSOLETE pointer = (char *) TYPE_ALLOC (type, num_bytes); -// OBSOLETE TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *) pointer; -// OBSOLETE } -// OBSOLETE B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type)); - -// OBSOLETE for (i = 0; i < TYPE_N_BASECLASSES (type); i++) -// OBSOLETE { -// OBSOLETE new = (struct nextfield *) xmalloc (sizeof (struct nextfield)); -// OBSOLETE make_cleanup (xfree, new); -// OBSOLETE memset (new, 0, sizeof (struct nextfield)); -// OBSOLETE new->next = fip->list; -// OBSOLETE fip->list = new; -// OBSOLETE FIELD_BITSIZE (new->field) = 0; /* this should be an unpacked field! */ - -// OBSOLETE STABS_CONTINUE (pp, objfile); - -// OBSOLETE /* virtual? eg: v2@Bvir */ -// OBSOLETE if (**pp == 'v') -// OBSOLETE { -// OBSOLETE SET_TYPE_FIELD_VIRTUAL (type, i); -// OBSOLETE ++(*pp); -// OBSOLETE } - -// OBSOLETE /* access? eg: 2@Bvir */ -// OBSOLETE /* Note: protected inheritance not supported in cfront */ -// OBSOLETE switch (*(*pp)++) -// OBSOLETE { -// OBSOLETE case CFRONT_VISIBILITY_PRIVATE: -// OBSOLETE new->visibility = VISIBILITY_PRIVATE; -// OBSOLETE break; -// OBSOLETE case CFRONT_VISIBILITY_PUBLIC: -// OBSOLETE new->visibility = VISIBILITY_PUBLIC; -// OBSOLETE break; -// OBSOLETE default: -// OBSOLETE /* Bad visibility format. Complain and treat it as -// OBSOLETE public. */ -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, -// OBSOLETE "Unknown visibility `%c' for baseclass", -// OBSOLETE new->visibility); -// OBSOLETE new->visibility = VISIBILITY_PUBLIC; -// OBSOLETE } -// OBSOLETE } - -// OBSOLETE /* "@" comes next - eg: @Bvir */ -// OBSOLETE if (**pp != '@') -// OBSOLETE { -// OBSOLETE msg_unknown_complaint (*pp); -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE ++(*pp); - - -// OBSOLETE /* Set the bit offset of the portion of the object corresponding -// OBSOLETE to this baseclass. Always zero in the absence of -// OBSOLETE multiple inheritance. */ -// OBSOLETE /* Unable to read bit position from stabs; -// OBSOLETE Assuming no multiple inheritance for now FIXME! */ -// OBSOLETE /* We may have read this in the structure definition; -// OBSOLETE now we should fixup the members to be the actual base classes */ -// OBSOLETE FIELD_BITPOS (new->field) = 0; - -// OBSOLETE /* Get the base class name and type */ -// OBSOLETE { -// OBSOLETE char *bname; /* base class name */ -// OBSOLETE struct symbol *bsym; /* base class */ -// OBSOLETE char *p1, *p2; -// OBSOLETE p1 = strchr (*pp, ' '); -// OBSOLETE p2 = strchr (*pp, ';'); -// OBSOLETE if (p1 < p2) -// OBSOLETE bname = get_substring (pp, ' '); -// OBSOLETE else -// OBSOLETE bname = get_substring (pp, ';'); -// OBSOLETE if (!bname || !*bname) -// OBSOLETE { -// OBSOLETE msg_unknown_complaint (*pp); -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE /* FIXME! attach base info to type */ -// OBSOLETE bsym = lookup_symbol (bname, 0, STRUCT_DOMAIN, 0, 0); /*demangled_name */ -// OBSOLETE if (bsym) -// OBSOLETE { -// OBSOLETE new->field.type = SYMBOL_TYPE (bsym); -// OBSOLETE new->field.name = type_name_no_tag (new->field.type); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, "Unable to find base type for %s", -// OBSOLETE *pp); -// OBSOLETE return 1; -// OBSOLETE } -// OBSOLETE } - -// OBSOLETE /* If more base classes to parse, loop again. -// OBSOLETE We ate the last ' ' or ';' in get_substring, -// OBSOLETE so on exit we will have skipped the trailing ';' */ -// OBSOLETE /* if invalid, return 0; add code to detect - FIXME! */ -// OBSOLETE } -// OBSOLETE return 1; -// OBSOLETE } - -// OBSOLETE /* read cfront member functions. -// OBSOLETE pp points to string starting with list of functions -// OBSOLETE eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;; -// OBSOLETE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// OBSOLETE A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;; -// OBSOLETE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// OBSOLETE */ - -// OBSOLETE static int -// OBSOLETE read_cfront_member_functions (struct field_info *fip, char **pp, -// OBSOLETE struct type *type, struct objfile *objfile) -// OBSOLETE { -// OBSOLETE /* This code extracted from read_member_functions -// OBSOLETE so as to do the similar thing for our funcs */ - -// OBSOLETE int nfn_fields = 0; -// OBSOLETE int length = 0; -// OBSOLETE /* Total number of member functions defined in this class. If the class -// OBSOLETE defines two `f' functions, and one `g' function, then this will have -// OBSOLETE the value 3. */ -// OBSOLETE int total_length = 0; -// OBSOLETE int i; -// OBSOLETE struct next_fnfield -// OBSOLETE { -// OBSOLETE struct next_fnfield *next; -// OBSOLETE struct fn_field fn_field; -// OBSOLETE } -// OBSOLETE *sublist; -// OBSOLETE struct type *look_ahead_type; -// OBSOLETE struct next_fnfieldlist *new_fnlist; -// OBSOLETE struct next_fnfield *new_sublist; -// OBSOLETE char *main_fn_name; -// OBSOLETE char *fname; -// OBSOLETE struct symbol *ref_func = 0; - -// OBSOLETE /* Process each list until we find the end of the member functions. -// OBSOLETE eg: p = "__ct__1AFv foo__1AFv ;;;" */ - -// OBSOLETE STABS_CONTINUE (pp, objfile); /* handle \\ */ - -// OBSOLETE while (**pp != ';' && (fname = get_substring (pp, ' '), fname)) -// OBSOLETE { -// OBSOLETE int is_static = 0; -// OBSOLETE int sublist_count = 0; -// OBSOLETE char *pname; -// OBSOLETE if (fname[0] == '*') /* static member */ -// OBSOLETE { -// OBSOLETE is_static = 1; -// OBSOLETE sublist_count++; -// OBSOLETE fname++; -// OBSOLETE } -// OBSOLETE ref_func = lookup_symbol (fname, 0, VAR_DOMAIN, 0, 0); /* demangled name */ -// OBSOLETE if (!ref_func) -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, -// OBSOLETE "Unable to find function symbol for %s", fname); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE sublist = NULL; -// OBSOLETE look_ahead_type = NULL; -// OBSOLETE length = 0; - -// OBSOLETE new_fnlist = (struct next_fnfieldlist *) -// OBSOLETE xmalloc (sizeof (struct next_fnfieldlist)); -// OBSOLETE make_cleanup (xfree, new_fnlist); -// OBSOLETE memset (new_fnlist, 0, sizeof (struct next_fnfieldlist)); - -// OBSOLETE /* The following is code to work around cfront generated stabs. -// OBSOLETE The stabs contains full mangled name for each field. -// OBSOLETE We try to demangle the name and extract the field name out of it. */ -// OBSOLETE { -// OBSOLETE char *dem, *dem_p, *dem_args; -// OBSOLETE int dem_len; -// OBSOLETE dem = cplus_demangle (fname, DMGL_ANSI | DMGL_PARAMS); -// OBSOLETE if (dem != NULL) -// OBSOLETE { -// OBSOLETE dem_p = strrchr (dem, ':'); -// OBSOLETE if (dem_p != 0 && *(dem_p - 1) == ':') -// OBSOLETE dem_p++; -// OBSOLETE /* get rid of args */ -// OBSOLETE dem_args = strchr (dem_p, '('); -// OBSOLETE if (dem_args == NULL) -// OBSOLETE dem_len = strlen (dem_p); -// OBSOLETE else -// OBSOLETE dem_len = dem_args - dem_p; -// OBSOLETE main_fn_name = -// OBSOLETE obsavestring (dem_p, dem_len, &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE main_fn_name = -// OBSOLETE obsavestring (fname, strlen (fname), &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE } /* end of code for cfront work around */ - -// OBSOLETE new_fnlist->fn_fieldlist.name = main_fn_name; - -// OBSOLETE /*-------------------------------------------------*/ -// OBSOLETE /* Set up the sublists -// OBSOLETE Sublists are stuff like args, static, visibility, etc. -// OBSOLETE so in ARM, we have to set that info some other way. -// OBSOLETE Multiple sublists happen if overloading -// OBSOLETE eg: foo::26=##1;:;2A.; -// OBSOLETE In g++, we'd loop here thru all the sublists... */ - -// OBSOLETE new_sublist = -// OBSOLETE (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield)); -// OBSOLETE make_cleanup (xfree, new_sublist); -// OBSOLETE memset (new_sublist, 0, sizeof (struct next_fnfield)); - -// OBSOLETE /* eat 1; from :;2A.; */ -// OBSOLETE new_sublist->fn_field.type = SYMBOL_TYPE (ref_func); /* normally takes a read_type */ -// OBSOLETE /* Make this type look like a method stub for gdb */ -// OBSOLETE TYPE_FLAGS (new_sublist->fn_field.type) |= TYPE_FLAG_STUB; -// OBSOLETE TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD; - -// OBSOLETE /* If this is just a stub, then we don't have the real name here. */ -// OBSOLETE if (TYPE_STUB (new_sublist->fn_field.type)) -// OBSOLETE { -// OBSOLETE if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type)) -// OBSOLETE TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type; -// OBSOLETE new_sublist->fn_field.is_stub = 1; -// OBSOLETE } - -// OBSOLETE /* physname used later in mangling; eg PFs_i,5 for foo__1aFPFs_i -// OBSOLETE physname gets strcat'd in order to recreate the onto mangled name */ -// OBSOLETE pname = get_cfront_method_physname (fname); -// OBSOLETE new_sublist->fn_field.physname = savestring (pname, strlen (pname)); - - -// OBSOLETE /* Set this member function's visibility fields. -// OBSOLETE Unable to distinguish access from stabs definition! -// OBSOLETE Assuming public for now. FIXME! -// OBSOLETE (for private, set new_sublist->fn_field.is_private = 1, -// OBSOLETE for public, set new_sublist->fn_field.is_protected = 1) */ - -// OBSOLETE /* Unable to distinguish const/volatile from stabs definition! -// OBSOLETE Assuming normal for now. FIXME! */ - -// OBSOLETE new_sublist->fn_field.is_const = 0; -// OBSOLETE new_sublist->fn_field.is_volatile = 0; /* volatile not implemented in cfront */ - -// OBSOLETE /* Set virtual/static function info -// OBSOLETE How to get vtable offsets ? -// OBSOLETE Assuming normal for now FIXME!! -// OBSOLETE For vtables, figure out from whence this virtual function came. -// OBSOLETE It may belong to virtual function table of -// OBSOLETE one of its baseclasses. -// OBSOLETE set: -// OBSOLETE new_sublist -> fn_field.voffset = vtable offset, -// OBSOLETE new_sublist -> fn_field.fcontext = look_ahead_type; -// OBSOLETE where look_ahead_type is type of baseclass */ -// OBSOLETE if (is_static) -// OBSOLETE new_sublist->fn_field.voffset = VOFFSET_STATIC; -// OBSOLETE else /* normal member function. */ -// OBSOLETE new_sublist->fn_field.voffset = 0; -// OBSOLETE new_sublist->fn_field.fcontext = 0; - - -// OBSOLETE /* Prepare new sublist */ -// OBSOLETE new_sublist->next = sublist; -// OBSOLETE sublist = new_sublist; -// OBSOLETE length++; - -// OBSOLETE /* In g++, we loop thu sublists - now we set from functions. */ -// OBSOLETE new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) -// OBSOLETE obstack_alloc (&objfile->type_obstack, -// OBSOLETE sizeof (struct fn_field) * length); -// OBSOLETE memset (new_fnlist->fn_fieldlist.fn_fields, 0, -// OBSOLETE sizeof (struct fn_field) * length); -// OBSOLETE for (i = length; (i--, sublist); sublist = sublist->next) -// OBSOLETE { -// OBSOLETE new_fnlist->fn_fieldlist.fn_fields[i] = sublist->fn_field; -// OBSOLETE } - -// OBSOLETE new_fnlist->fn_fieldlist.length = length; -// OBSOLETE new_fnlist->next = fip->fnlist; -// OBSOLETE fip->fnlist = new_fnlist; -// OBSOLETE nfn_fields++; -// OBSOLETE total_length += length; -// OBSOLETE STABS_CONTINUE (pp, objfile); /* handle \\ */ -// OBSOLETE } /* end of loop */ - -// OBSOLETE if (nfn_fields) -// OBSOLETE { -// OBSOLETE /* type should already have space */ -// OBSOLETE TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *) -// OBSOLETE TYPE_ALLOC (type, sizeof (struct fn_fieldlist) * nfn_fields); -// OBSOLETE memset (TYPE_FN_FIELDLISTS (type), 0, -// OBSOLETE sizeof (struct fn_fieldlist) * nfn_fields); -// OBSOLETE TYPE_NFN_FIELDS (type) = nfn_fields; -// OBSOLETE TYPE_NFN_FIELDS_TOTAL (type) = total_length; -// OBSOLETE } - -// OBSOLETE /* end of scope for reading member func */ - -// OBSOLETE /* eg: ";;" */ - -// OBSOLETE /* Skip trailing ';' and bump count of number of fields seen */ -// OBSOLETE if (**pp == ';') -// OBSOLETE (*pp)++; -// OBSOLETE else -// OBSOLETE return 0; -// OBSOLETE return 1; -// OBSOLETE } - -// OBSOLETE /* This routine fixes up partial cfront types that were created -// OBSOLETE while parsing the stabs. The main need for this function is -// OBSOLETE to add information such as methods to classes. -// OBSOLETE Examples of "p": "sA;;__ct__1AFv foo__1AFv ;;;" */ -// OBSOLETE int -// OBSOLETE resolve_cfront_continuation (struct objfile *objfile, struct symbol *sym, -// OBSOLETE char *p) -// OBSOLETE { -// OBSOLETE struct symbol *ref_sym = 0; -// OBSOLETE char *sname; -// OBSOLETE /* snarfed from read_struct_type */ -// OBSOLETE struct field_info fi; -// OBSOLETE struct type *type; -// OBSOLETE struct cleanup *back_to; - -// OBSOLETE /* Need to make sure that fi isn't gunna conflict with struct -// OBSOLETE in case struct already had some fnfs */ -// OBSOLETE fi.list = NULL; -// OBSOLETE fi.fnlist = NULL; -// OBSOLETE back_to = make_cleanup (null_cleanup, 0); - -// OBSOLETE /* We only accept structs, classes and unions at the moment. -// OBSOLETE Other continuation types include t (typedef), r (long dbl), ... -// OBSOLETE We may want to add support for them as well; -// OBSOLETE right now they are handled by duplicating the symbol information -// OBSOLETE into the type information (see define_symbol) */ -// OBSOLETE if (*p != 's' /* structs */ -// OBSOLETE && *p != 'c' /* class */ -// OBSOLETE && *p != 'u') /* union */ -// OBSOLETE return 0; /* only handle C++ types */ -// OBSOLETE p++; - -// OBSOLETE /* Get symbol typs name and validate -// OBSOLETE eg: p = "A;;__ct__1AFv foo__1AFv ;;;" */ -// OBSOLETE sname = get_substring (&p, ';'); -// OBSOLETE if (!sname || strcmp (sname, DEPRECATED_SYMBOL_NAME (sym))) -// OBSOLETE error ("Internal error: base symbol type name does not match\n"); - -// OBSOLETE /* Find symbol's internal gdb reference using demangled_name. -// OBSOLETE This is the real sym that we want; -// OBSOLETE sym was a temp hack to make debugger happy */ -// OBSOLETE ref_sym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), 0, STRUCT_DOMAIN, 0, 0); -// OBSOLETE type = SYMBOL_TYPE (ref_sym); - - -// OBSOLETE /* Now read the baseclasses, if any, read the regular C struct or C++ -// OBSOLETE class member fields, attach the fields to the type, read the C++ -// OBSOLETE member functions, attach them to the type, and then read any tilde -// OBSOLETE field (baseclass specifier for the class holding the main vtable). */ - -// OBSOLETE if (!read_cfront_baseclasses (&fi, &p, type, objfile) -// OBSOLETE /* g++ does this next, but cfront already did this: -// OBSOLETE || !read_struct_fields (&fi, &p, type, objfile) */ -// OBSOLETE || !copy_cfront_struct_fields (&fi, type, objfile) -// OBSOLETE || !read_cfront_member_functions (&fi, &p, type, objfile) -// OBSOLETE || !read_cfront_static_fields (&fi, &p, type, objfile) -// OBSOLETE || !attach_fields_to_type (&fi, type, objfile) -// OBSOLETE || !attach_fn_fields_to_type (&fi, type) -// OBSOLETE /* g++ does this next, but cfront doesn't seem to have this: -// OBSOLETE || !read_tilde_fields (&fi, &p, type, objfile) */ -// OBSOLETE ) -// OBSOLETE { -// OBSOLETE type = error_type (&p, objfile); -// OBSOLETE } - -// OBSOLETE do_cleanups (back_to); -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE /* End of code added to support parsing of ARM/Cfront stabs strings */ -#endif /* OBSOLETE CFront */ - -/* This routine fixes up symbol references/aliases to point to the original - symbol definition. Returns 0 on failure, non-zero on success. */ - -static int -resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p) -{ - int refnum; - struct symbol *ref_sym = 0; - struct alias_list *alias; - - /* If this is not a symbol reference return now. */ - if (*p != '#') - return 0; - - /* Use "#<num>" as the name; we'll fix the name later. - We stored the original symbol name as "#<id>=<name>" - so we can now search for "#<id>" to resolving the reference. - We'll fix the names later by removing the "#<id>" or "#<id>=" */ - -/*---------------------------------------------------------*/ - /* Get the reference id number, and - advance p past the names so we can parse the rest. - eg: id=2 for p : "2=", "2=z:r(0,1)" "2:r(0,1);l(#5,#6),l(#7,#4)" */ -/*---------------------------------------------------------*/ - - /* This gets reference name from string. sym may not have a name. */ - - /* Get the reference number associated with the reference id in the - gdb stab string. From that reference number, get the main/primary - symbol for this alias. */ - refnum = process_reference (&p); - ref_sym = ref_search (refnum); - if (!ref_sym) - { - lrs_general_complaint ("symbol for reference not found"); - return 0; - } - - /* Parse the stab of the referencing symbol - now that we have the referenced symbol. - Add it as a new symbol and a link back to the referenced symbol. - eg: p : "=", "=z:r(0,1)" ":r(0,1);l(#5,#6),l(#7,#4)" */ - - - /* If the stab symbol table and string contain: - RSYM 0 5 00000000 868 #15=z:r(0,1) - LBRAC 0 0 00000000 899 #5= - SLINE 0 16 00000003 923 #6= - Then the same symbols can be later referenced by: - RSYM 0 5 00000000 927 #15:r(0,1);l(#5,#6) - This is used in live range splitting to: - 1) specify that a symbol (#15) is actually just a new storage - class for a symbol (#15=z) which was previously defined. - 2) specify that the beginning and ending ranges for a symbol - (#15) are the values of the beginning (#5) and ending (#6) - symbols. */ - - /* Read number as reference id. - eg: p : "=", "=z:r(0,1)" ":r(0,1);l(#5,#6),l(#7,#4)" */ - /* FIXME! Might I want to use SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; - in case of "l(0,0)"? */ - -/*--------------------------------------------------*/ - /* Add this symbol to the reference list. */ -/*--------------------------------------------------*/ - - alias = (struct alias_list *) obstack_alloc (&objfile->type_obstack, - sizeof (struct alias_list)); - if (!alias) - { - lrs_general_complaint ("Unable to allocate alias list memory"); - return 0; - } - - alias->next = 0; - alias->sym = sym; - - if (!SYMBOL_ALIASES (ref_sym)) - { - SYMBOL_ALIASES (ref_sym) = alias; - } - else - { - struct alias_list *temp; - - /* Get to the end of the list. */ - for (temp = SYMBOL_ALIASES (ref_sym); - temp->next; - temp = temp->next) - ; - temp->next = alias; - } - - /* Want to fix up name so that other functions (eg. valops) - will correctly print the name. - Don't add_symbol_to_list so that lookup_symbol won't find it. - nope... needed for fixups. */ - DEPRECATED_SYMBOL_NAME (sym) = DEPRECATED_SYMBOL_NAME (ref_sym); - - /* Done! */ - return 1; -} - /* Structure for storing pointers to reference definitions for fast lookup during "process_later". */ @@ -1211,7 +595,6 @@ symbol_reference_defined (char **string) } } -/* ARGSUSED */ struct symbol * define_symbol (CORE_ADDR valu, char *string, int desc, int type, struct objfile *objfile) @@ -1310,41 +693,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, goto normal; /* Do *something* with it */ } } - else if (string[0] == '#') - { - /* Special GNU C extension for referencing symbols. */ - char *s; - int refnum, nlen; - - /* If STRING defines a new reference id, then add it to the - reference map. Else it must be referring to a previously - defined symbol, so add it to the alias list of the previously - defined symbol. */ - s = string; - refnum = symbol_reference_defined (&s); - if (refnum >= 0) - ref_add (refnum, sym, string, SYMBOL_VALUE (sym)); - else if (!resolve_symbol_reference (objfile, sym, string)) - return NULL; - - /* S..P contains the name of the symbol. We need to store - the correct name into DEPRECATED_SYMBOL_NAME. */ - nlen = p - s; - if (refnum >= 0) - { - if (nlen > 0) - SYMBOL_SET_NAMES (sym, s, nlen, objfile); - else - /* FIXME! Want DEPRECATED_SYMBOL_NAME (sym) = 0; - Get error if leave name 0. So give it something. */ - { - nlen = p - string; - SYMBOL_SET_NAMES (sym, string, nlen, objfile); - } - } - /* Advance STRING beyond the reference id. */ - string = s; - } else { normal: @@ -1748,17 +1096,20 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = VAR_DOMAIN; if (within_function) { - /* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same - name to represent an argument passed in a register. - GCC uses 'P' for the same case. So if we find such a symbol pair - we combine it into one 'P' symbol. For Sun cc we need to do this - regardless of DEPRECATED_REG_STRUCT_HAS_ADDR, because the compiler puts out - the 'p' symbol even if it never saves the argument onto the stack. - - On most machines, we want to preserve both symbols, so that - we can still get information about what is going on with the - stack (VAX for computing args_printed, using stack slots instead - of saved registers in backtraces, etc.). + /* Sun cc uses a pair of symbols, one 'p' and one 'r', with + the same name to represent an argument passed in a + register. GCC uses 'P' for the same case. So if we find + such a symbol pair we combine it into one 'P' symbol. + For Sun cc we need to do this regardless of + stabs_argument_has_addr, because the compiler puts out + the 'p' symbol even if it never saves the argument onto + the stack. + + On most machines, we want to preserve both symbols, so + that we can still get information about what is going on + with the stack (VAX for computing args_printed, using + stack slots instead of saved registers in backtraces, + etc.). Note that this code illegally combines main(argc) struct foo argc; { register struct foo argc; } @@ -1768,13 +1119,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (local_symbols && local_symbols->nsyms > 0 #ifndef USE_REGISTER_NOT_ARG - && DEPRECATED_REG_STRUCT_HAS_ADDR_P () - && DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation, - SYMBOL_TYPE (sym)) - && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_SET - || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_BITSTRING) + && gdbarch_stabs_argument_has_addr (current_gdbarch, + SYMBOL_TYPE (sym)) #endif ) { @@ -1782,7 +1128,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG || SYMBOL_CLASS (prev_sym) == LOC_ARG) - && STREQ (DEPRECATED_SYMBOL_NAME (prev_sym), DEPRECATED_SYMBOL_NAME (sym))) + && strcmp (DEPRECATED_SYMBOL_NAME (prev_sym), + DEPRECATED_SYMBOL_NAME (sym)) == 0) { SYMBOL_CLASS (prev_sym) = LOC_REGPARM; /* Use the type from the LOC_REGISTER; that is the type @@ -1913,15 +1260,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (synonym) p++; -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* The semantics of C++ state that "struct foo { ... }" also defines -// OBSOLETE a typedef for "foo". Unfortunately, cfront never makes the typedef -// OBSOLETE when translating C++ into C. We make the typedef here so that -// OBSOLETE "ptype foo" works as expected for cfront translated code. */ -// OBSOLETE else if ((current_subfile->language == language_cplus) -// OBSOLETE || (current_subfile->language == language_objc)) -// OBSOLETE synonym = 1; -#endif /* OBSOLETE CFront */ SYMBOL_TYPE (sym) = read_type (&p, objfile); @@ -2011,32 +1349,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, &local_symbols); break; -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* New code added to support cfront stabs strings. -// OBSOLETE Note: case 'P' already handled above */ -// OBSOLETE case 'Z': -// OBSOLETE /* Cfront type continuation coming up! -// OBSOLETE Find the original definition and add to it. -// OBSOLETE We'll have to do this for the typedef too, -// OBSOLETE since we cloned the symbol to define a type in read_type. -// OBSOLETE Stabs info examples: -// OBSOLETE __1C :Ztl -// OBSOLETE foo__1CFv :ZtF (first def foo__1CFv:F(0,3);(0,24)) -// OBSOLETE C:ZsC;;__ct__1CFv func1__1CFv func2__1CFv ... ;;; -// OBSOLETE where C is the name of the class. -// OBSOLETE Unfortunately, we can't lookup the original symbol yet 'cuz -// OBSOLETE we haven't finished reading all the symbols. -// OBSOLETE Instead, we save it for processing later */ -// OBSOLETE process_later (sym, p, resolve_cfront_continuation); -// OBSOLETE SYMBOL_TYPE (sym) = error_type (&p, objfile); /* FIXME! change later */ -// OBSOLETE SYMBOL_CLASS (sym) = LOC_CONST; -// OBSOLETE SYMBOL_VALUE (sym) = 0; -// OBSOLETE SYMBOL_DOMAIN (sym) = VAR_DOMAIN; -// OBSOLETE /* Don't add to list - we'll delete it later when -// OBSOLETE we add the continuation to the real sym */ -// OBSOLETE return sym; -// OBSOLETE /* End of new code added to support cfront stabs strings */ -#endif /* OBSOLETE CFront */ default: SYMBOL_TYPE (sym) = error_type (&p, objfile); @@ -2047,161 +1359,26 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, break; } - /* When passing structures to a function, some systems sometimes pass - the address in a register, not the structure itself. */ + /* Some systems pass variables of certain types by reference instead + of by value, i.e. they will pass the address of a structure (in a + register or on the stack) instead of the structure itself. */ - if (DEPRECATED_REG_STRUCT_HAS_ADDR_P () - && DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym)) + if (gdbarch_stabs_argument_has_addr (current_gdbarch, SYMBOL_TYPE (sym)) && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG)) { - struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym)); - - if ((TYPE_CODE (symbol_type) == TYPE_CODE_STRUCT) - || (TYPE_CODE (symbol_type) == TYPE_CODE_UNION) - || (TYPE_CODE (symbol_type) == TYPE_CODE_BITSTRING) - || (TYPE_CODE (symbol_type) == TYPE_CODE_SET)) - { - /* If DEPRECATED_REG_STRUCT_HAS_ADDR yields non-zero we have to convert - LOC_REGPARM to LOC_REGPARM_ADDR for structures and unions. */ - if (SYMBOL_CLASS (sym) == LOC_REGPARM) - SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; - /* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th - and subsequent arguments on the sparc, for example). */ - else if (SYMBOL_CLASS (sym) == LOC_ARG) - SYMBOL_CLASS (sym) = LOC_REF_ARG; - } + /* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for + variables passed in a register). */ + if (SYMBOL_CLASS (sym) == LOC_REGPARM) + SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; + /* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th + and subsequent arguments on SPARC, for example). */ + else if (SYMBOL_CLASS (sym) == LOC_ARG) + SYMBOL_CLASS (sym) = LOC_REF_ARG; } - /* Is there more to parse? For example LRS/alias information? */ - while (*p && *p == ';') - { - p++; - if (*p && p[0] == 'l' && p[1] == '(') - { - /* GNU extensions for live range splitting may be appended to - the end of the stab string. eg. "l(#1,#2);l(#3,#5)" */ - - /* Resolve the live range and add it to SYM's live range list. */ - if (!resolve_live_range (objfile, sym, p)) - return NULL; - - /* Find end of live range info. */ - p = strchr (p, ')'); - if (!*p || *p != ')') - { - lrs_general_complaint ("live range format not recognized"); - return NULL; - } - p++; - } - } return sym; } -/* Add the live range found in P to the symbol SYM in objfile OBJFILE. Returns - non-zero on success, zero otherwise. */ - -static int -resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p) -{ - int refnum; - CORE_ADDR start, end; - - /* Sanity check the beginning of the stabs string. */ - if (!*p || *p != 'l') - { - lrs_general_complaint ("live range string 1"); - return 0; - } - p++; - - if (!*p || *p != '(') - { - lrs_general_complaint ("live range string 2"); - return 0; - } - p++; - - /* Get starting value of range and advance P past the reference id. - - ?!? In theory, the process_reference should never fail, but we should - catch that case just in case the compiler scrogged the stabs. */ - refnum = process_reference (&p); - start = ref_search_value (refnum); - if (!start) - { - lrs_general_complaint ("Live range symbol not found 1"); - return 0; - } - - if (!*p || *p != ',') - { - lrs_general_complaint ("live range string 3"); - return 0; - } - p++; - - /* Get ending value of range and advance P past the reference id. - - ?!? In theory, the process_reference should never fail, but we should - catch that case just in case the compiler scrogged the stabs. */ - refnum = process_reference (&p); - end = ref_search_value (refnum); - if (!end) - { - lrs_general_complaint ("Live range symbol not found 2"); - return 0; - } - - if (!*p || *p != ')') - { - lrs_general_complaint ("live range string 4"); - return 0; - } - - /* Now that we know the bounds of the range, add it to the - symbol. */ - add_live_range (objfile, sym, start, end); - - return 1; -} - -/* Add a new live range defined by START and END to the symbol SYM - in objfile OBJFILE. */ - -static void -add_live_range (struct objfile *objfile, struct symbol *sym, CORE_ADDR start, - CORE_ADDR end) -{ - struct range_list *r, *rs; - - if (start >= end) - { - lrs_general_complaint ("end of live range follows start"); - return; - } - - /* Alloc new live range structure. */ - r = (struct range_list *) - obstack_alloc (&objfile->type_obstack, - sizeof (struct range_list)); - r->start = start; - r->end = end; - r->next = 0; - - /* Append this range to the symbol's range list. */ - if (!SYMBOL_RANGES (sym)) - SYMBOL_RANGES (sym) = r; - else - { - /* Get the last range for the symbol. */ - for (rs = SYMBOL_RANGES (sym); rs->next; rs = rs->next) - ; - rs->next = r; - } -} - - /* Skip rest of this symbol and return an error type. General notes on error recovery: error_type always skips to the @@ -2399,7 +1576,7 @@ again: if (SYMBOL_CLASS (sym) == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) - && STREQ (DEPRECATED_SYMBOL_NAME (sym), type_name)) + && strcmp (DEPRECATED_SYMBOL_NAME (sym), type_name) == 0) { obstack_free (&objfile->type_obstack, type_name); type = SYMBOL_TYPE (sym); @@ -3558,39 +2735,8 @@ static void read_one_struct_field (struct field_info *fip, char **pp, char *p, struct type *type, struct objfile *objfile) { -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* The following is code to work around cfront generated stabs. -// OBSOLETE The stabs contains full mangled name for each field. -// OBSOLETE We try to demangle the name and extract the field name out of it. -// OBSOLETE */ -// OBSOLETE if (ARM_DEMANGLING && current_subfile->language == language_cplus) -// OBSOLETE { -// OBSOLETE char save_p; -// OBSOLETE char *dem, *dem_p; -// OBSOLETE save_p = *p; -// OBSOLETE *p = '\0'; -// OBSOLETE dem = cplus_demangle (*pp, DMGL_ANSI | DMGL_PARAMS); -// OBSOLETE if (dem != NULL) -// OBSOLETE { -// OBSOLETE dem_p = strrchr (dem, ':'); -// OBSOLETE if (dem_p != 0 && *(dem_p - 1) == ':') -// OBSOLETE dem_p++; -// OBSOLETE FIELD_NAME (fip->list->field) = -// OBSOLETE obsavestring (dem_p, strlen (dem_p), &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE FIELD_NAME (fip->list->field) = -// OBSOLETE obsavestring (*pp, p - *pp, &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE *p = save_p; -// OBSOLETE } -// OBSOLETE /* end of code for cfront work around */ - -// OBSOLETE else -#endif /* OBSOLETE CFront */ - fip->list->field.name = - obsavestring (*pp, p - *pp, &objfile->type_obstack); + fip->list->field.name = + obsavestring (*pp, p - *pp, &objfile->type_obstack); *pp = p + 1; /* This means we have a visibility for a field coming. */ @@ -4041,138 +3187,6 @@ attach_fn_fields_to_type (struct field_info *fip, struct type *type) return 1; } -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* read cfront class static data. -// OBSOLETE pp points to string starting with the list of static data -// OBSOLETE eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;; -// OBSOLETE ^^^^^^^^ - -// OBSOLETE A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;; -// OBSOLETE ^ -// OBSOLETE */ - -// OBSOLETE static int -// OBSOLETE read_cfront_static_fields (struct field_info *fip, char **pp, struct type *type, -// OBSOLETE struct objfile *objfile) -// OBSOLETE { -// OBSOLETE struct nextfield *new; -// OBSOLETE struct type *stype; -// OBSOLETE char *sname; -// OBSOLETE struct symbol *ref_static = 0; - -// OBSOLETE if (**pp == ';') /* no static data; return */ -// OBSOLETE { -// OBSOLETE ++(*pp); -// OBSOLETE return 1; -// OBSOLETE } - -// OBSOLETE /* Process each field in the list until we find the terminating ";" */ - -// OBSOLETE /* eg: p = "as__1A ;;;" */ -// OBSOLETE STABS_CONTINUE (pp, objfile); /* handle \\ */ -// OBSOLETE while (**pp != ';' && (sname = get_substring (pp, ' '), sname)) -// OBSOLETE { -// OBSOLETE ref_static = lookup_symbol (sname, 0, VAR_DOMAIN, 0, 0); /*demangled_name */ -// OBSOLETE if (!ref_static) -// OBSOLETE { -// OBSOLETE complaint (&symfile_complaints, -// OBSOLETE "Unable to find symbol for static data field %s", sname); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE stype = SYMBOL_TYPE (ref_static); - -// OBSOLETE /* allocate a new fip */ -// OBSOLETE new = (struct nextfield *) xmalloc (sizeof (struct nextfield)); -// OBSOLETE make_cleanup (xfree, new); -// OBSOLETE memset (new, 0, sizeof (struct nextfield)); -// OBSOLETE new->next = fip->list; -// OBSOLETE fip->list = new; - -// OBSOLETE /* set visibility */ -// OBSOLETE /* FIXME! no way to tell visibility from stabs??? */ -// OBSOLETE new->visibility = VISIBILITY_PUBLIC; - -// OBSOLETE /* set field info into fip */ -// OBSOLETE fip->list->field.type = stype; - -// OBSOLETE /* set bitpos & bitsize */ -// OBSOLETE SET_FIELD_PHYSNAME (fip->list->field, savestring (sname, strlen (sname))); - -// OBSOLETE /* set name field */ -// OBSOLETE /* The following is code to work around cfront generated stabs. -// OBSOLETE The stabs contains full mangled name for each field. -// OBSOLETE We try to demangle the name and extract the field name out of it. -// OBSOLETE */ -// OBSOLETE if (ARM_DEMANGLING) -// OBSOLETE { -// OBSOLETE char *dem, *dem_p; -// OBSOLETE dem = cplus_demangle (sname, DMGL_ANSI | DMGL_PARAMS); -// OBSOLETE if (dem != NULL) -// OBSOLETE { -// OBSOLETE dem_p = strrchr (dem, ':'); -// OBSOLETE if (dem_p != 0 && *(dem_p - 1) == ':') -// OBSOLETE dem_p++; -// OBSOLETE fip->list->field.name = -// OBSOLETE obsavestring (dem_p, strlen (dem_p), &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE fip->list->field.name = -// OBSOLETE obsavestring (sname, strlen (sname), &objfile->type_obstack); -// OBSOLETE } -// OBSOLETE } /* end of code for cfront work around */ -// OBSOLETE } /* loop again for next static field */ -// OBSOLETE return 1; -// OBSOLETE } - -// OBSOLETE /* Copy structure fields to fip so attach_fields_to_type will work. -// OBSOLETE type has already been created with the initial instance data fields. -// OBSOLETE Now we want to be able to add the other members to the class, -// OBSOLETE so we want to add them back to the fip and reattach them again -// OBSOLETE once we have collected all the class members. */ - -// OBSOLETE static int -// OBSOLETE copy_cfront_struct_fields (struct field_info *fip, struct type *type, -// OBSOLETE struct objfile *objfile) -// OBSOLETE { -// OBSOLETE int nfields = TYPE_NFIELDS (type); -// OBSOLETE int i; -// OBSOLETE struct nextfield *new; - -// OBSOLETE /* Copy the fields into the list of fips and reset the types -// OBSOLETE to remove the old fields */ - -// OBSOLETE for (i = 0; i < nfields; i++) -// OBSOLETE { -// OBSOLETE /* allocate a new fip */ -// OBSOLETE new = (struct nextfield *) xmalloc (sizeof (struct nextfield)); -// OBSOLETE make_cleanup (xfree, new); -// OBSOLETE memset (new, 0, sizeof (struct nextfield)); -// OBSOLETE new->next = fip->list; -// OBSOLETE fip->list = new; - -// OBSOLETE /* copy field info into fip */ -// OBSOLETE new->field = TYPE_FIELD (type, i); -// OBSOLETE /* set visibility */ -// OBSOLETE if (TYPE_FIELD_PROTECTED (type, i)) -// OBSOLETE new->visibility = VISIBILITY_PROTECTED; -// OBSOLETE else if (TYPE_FIELD_PRIVATE (type, i)) -// OBSOLETE new->visibility = VISIBILITY_PRIVATE; -// OBSOLETE else -// OBSOLETE new->visibility = VISIBILITY_PUBLIC; -// OBSOLETE } -// OBSOLETE /* Now delete the fields from the type since we will be -// OBSOLETE allocing new space once we get the rest of the fields -// OBSOLETE in attach_fields_to_type. -// OBSOLETE The pointer TYPE_FIELDS(type) is left dangling but should -// OBSOLETE be freed later by objstack_free */ -// OBSOLETE TYPE_FIELDS (type) = 0; -// OBSOLETE TYPE_NFIELDS (type) = 0; - -// OBSOLETE return 1; -// OBSOLETE } -#endif /* OBSOLETE CFront */ - /* Create the vector of fields, and record how big it is. We need this info to record proper virtual function table information for this class's virtual functions. */ @@ -5194,7 +4208,7 @@ cleanup_undefined_types (void) && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE (*type)) - && STREQ (DEPRECATED_SYMBOL_NAME (sym), typename)) + && strcmp (DEPRECATED_SYMBOL_NAME (sym), typename) == 0) replace_type (*type, SYMBOL_TYPE (sym)); } } @@ -5224,7 +4238,7 @@ scan_file_globals (struct objfile *objfile) { int hash; struct minimal_symbol *msymbol; - struct symbol *sym, *prev, *rsym; + struct symbol *sym, *prev; struct objfile *resolve_objfile; /* SVR4 based linkers copy referenced global symbols from shared @@ -5276,11 +4290,8 @@ scan_file_globals (struct objfile *objfile) for (sym = global_sym_chain[hash]; sym;) { if (DEPRECATED_SYMBOL_NAME (msymbol)[0] == DEPRECATED_SYMBOL_NAME (sym)[0] && - STREQ (DEPRECATED_SYMBOL_NAME (msymbol) + 1, DEPRECATED_SYMBOL_NAME (sym) + 1)) + strcmp (DEPRECATED_SYMBOL_NAME (msymbol) + 1, DEPRECATED_SYMBOL_NAME (sym) + 1) == 0) { - - struct alias_list *aliases; - /* Splice this symbol out of the hash chain and assign the value we have to it. */ if (prev) @@ -5295,38 +4306,21 @@ scan_file_globals (struct objfile *objfile) /* Check to see whether we need to fix up a common block. */ /* Note: this code might be executed several times for the same symbol if there are multiple references. */ - - /* If symbol has aliases, do minimal symbol fixups for each. - These live aliases/references weren't added to - global_sym_chain hash but may also need to be fixed up. */ - /* FIXME: Maybe should have added aliases to the global chain, resolved symbol name, then treated aliases as normal - symbols? Still, we wouldn't want to add_to_list. */ - /* Now do the same for each alias of this symbol */ - rsym = sym; - aliases = SYMBOL_ALIASES (sym); - while (rsym) + if (sym) { - if (SYMBOL_CLASS (rsym) == LOC_BLOCK) + if (SYMBOL_CLASS (sym) == LOC_BLOCK) { - fix_common_block (rsym, + fix_common_block (sym, SYMBOL_VALUE_ADDRESS (msymbol)); } else { - SYMBOL_VALUE_ADDRESS (rsym) + SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msymbol); } - SYMBOL_SECTION (rsym) = SYMBOL_SECTION (msymbol); - if (aliases) - { - rsym = aliases->sym; - aliases = aliases->next; - } - else - rsym = NULL; + SYMBOL_SECTION (sym) = SYMBOL_SECTION (msymbol); } - if (prev) { sym = SYMBOL_VALUE_CHAIN (prev); diff --git a/gdb/stabsread.h b/gdb/stabsread.h index 91db978..531f9a1 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -194,22 +194,12 @@ extern void stabsect_build_psymtabs extern void elfstab_offset_sections (struct objfile *, struct partial_symtab *); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE extern void process_later -// OBSOLETE (struct symbol *, char *, -// OBSOLETE int (*f) (struct objfile *, struct symbol *, char *)); -#endif /* OBSOLETE CFront */ - extern int symbol_reference_defined (char **); extern void ref_add (int, struct symbol *, char *, CORE_ADDR); extern struct symbol *ref_search (int); -#if 0 /* OBSOLETE CFront */ -// OBSOLETE extern int resolve_cfront_continuation -// OBSOLETE (struct objfile *objfile, struct symbol *sym, char *p); -#endif /* OBSOLETE CFront */ extern void free_header_files (void); extern void init_header_files (void); diff --git a/gdb/stack.c b/gdb/stack.c index 9a5b4c2..82820aa 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -43,6 +43,8 @@ #include "stack.h" #include "gdb_assert.h" #include "dictionary.h" +#include "reggroups.h" +#include "regcache.h" /* Prototypes for exported functions. */ @@ -54,8 +56,6 @@ void (*selected_frame_level_changed_hook) (int); void _initialize_stack (void); -void return_command (char *, int); - /* Prototypes for local functions. */ static void down_command (char *, int); @@ -968,8 +968,8 @@ frame_info (char *addr_exp, int from_tty) printf_filtered (" source language %s.\n", language_str (s->language)); -#ifdef PRINT_EXTRA_FRAME_INFO - PRINT_EXTRA_FRAME_INFO (fi); +#ifdef DEPRECATED_PRINT_EXTRA_FRAME_INFO + DEPRECATED_PRINT_EXTRA_FRAME_INFO (fi); #endif { @@ -1021,7 +1021,7 @@ frame_info (char *addr_exp, int from_tty) } if (DEPRECATED_FRAME_INIT_SAVED_REGS_P () - && get_frame_saved_regs (fi) == NULL) + && deprecated_get_frame_saved_regs (fi) == NULL) DEPRECATED_FRAME_INIT_SAVED_REGS (fi); /* Print as much information as possible on the location of all the registers. */ @@ -1054,7 +1054,7 @@ frame_info (char *addr_exp, int from_tty) /* NOTE: cagney/2003-05-22: This is assuming that the stack pointer was packed as an unsigned integer. That may or may not be valid. */ - sp = extract_unsigned_integer (value, REGISTER_RAW_SIZE (SP_REGNUM)); + sp = extract_unsigned_integer (value, DEPRECATED_REGISTER_RAW_SIZE (SP_REGNUM)); printf_filtered (" Previous frame's sp is "); print_address_numeric (sp, 1, gdb_stdout); printf_filtered ("\n"); @@ -1079,7 +1079,8 @@ frame_info (char *addr_exp, int from_tty) count = 0; numregs = NUM_REGS + NUM_PSEUDO_REGS; for (i = 0; i < numregs; i++) - if (i != SP_REGNUM) + if (i != SP_REGNUM + && gdbarch_register_reggroup_p (current_gdbarch, i, all_reggroup)) { /* Find out the location of the saved register without fetching the corresponding value. */ @@ -1488,7 +1489,6 @@ print_frame_label_vars (struct frame_info *fi, int this_level_only, } } -/* ARGSUSED */ void locals_info (char *args, int from_tty) { @@ -1736,7 +1736,6 @@ current_frame_command (char *level_exp, int from_tty) /* Select the frame up one or COUNT stack levels from the previously selected frame, and print it briefly. */ -/* ARGSUSED */ static void up_silently_base (char *count_exp) { @@ -1773,7 +1772,6 @@ up_command (char *count_exp, int from_tty) /* Select the frame down one or COUNT stack levels from the previously selected frame, and print it briefly. */ -/* ARGSUSED */ static void down_silently_base (char *count_exp) { @@ -1802,7 +1800,6 @@ down_silently_base (char *count_exp) selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame)); } -/* ARGSUSED */ static void down_silently_command (char *count_exp, int from_tty) { @@ -1821,94 +1818,147 @@ void return_command (char *retval_exp, int from_tty) { struct symbol *thisfun; - CORE_ADDR selected_frame_addr; - CORE_ADDR selected_frame_pc; - struct frame_info *frame; struct value *return_value = NULL; + const char *query_prefix = ""; - if (deprecated_selected_frame == NULL) + /* FIXME: cagney/2003-10-20: Perform a minimal existance test on the + target. If that fails, error out. For the moment don't rely on + get_selected_frame as it's error message is the the singularly + obscure "No registers". */ + if (!target_has_registers) error ("No selected frame."); - thisfun = get_frame_function (deprecated_selected_frame); - selected_frame_addr = get_frame_base (deprecated_selected_frame); - selected_frame_pc = get_frame_pc (deprecated_selected_frame); - - /* Compute the return value (if any -- possibly getting errors here). */ + thisfun = get_frame_function (get_selected_frame ()); + /* Compute the return value. If the computation triggers an error, + let it bail. If the return type can't be handled, set + RETURN_VALUE to NULL, and QUERY_PREFIX to an informational + message. */ if (retval_exp) { struct type *return_type = NULL; + /* Compute the return value. Should the computation fail, this + call throws an error. */ return_value = parse_and_eval (retval_exp); - /* Cast return value to the return type of the function. */ + /* Cast return value to the return type of the function. Should + the cast fail, this call throws an error. */ if (thisfun != NULL) return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun)); if (return_type == NULL) return_type = builtin_type_int; return_value = value_cast (return_type, return_value); - /* Make sure we have fully evaluated it, since - it might live in the stack frame we're about to pop. */ + /* Make sure the value is fully evaluated. It may live in the + stack frame we're about to pop. */ if (VALUE_LAZY (return_value)) value_fetch_lazy (return_value); - } - - /* If interactive, require confirmation. */ - if (from_tty) - { - if (thisfun != 0) + /* Check that this architecture can handle the function's return + type. In the case of "struct convention", still do the + "return", just also warn the user. */ + if (gdbarch_return_value_p (current_gdbarch)) { - if (!query ("Make %s return now? ", SYMBOL_PRINT_NAME (thisfun))) - { - error ("Not confirmed."); - /* NOTREACHED */ - } + if (gdbarch_return_value (current_gdbarch, return_type, + NULL, NULL, NULL) + == RETURN_VALUE_STRUCT_CONVENTION) + return_value = NULL; } - else if (!query ("Make selected stack frame return now? ")) - error ("Not confirmed."); + else + { + /* NOTE: cagney/2003-10-20: The double check is to ensure + that the STORE_RETURN_VALUE call, further down, is not + applied to a struct or union return-value. It wasn't + allowed previously, so don't start allowing it now. An + ABI that uses "register convention" to return small + structures and should implement the "return_value" + architecture method. */ + if (using_struct_return (return_type, 0) + || TYPE_CODE (return_type) == TYPE_CODE_STRUCT + || TYPE_CODE (return_type) == TYPE_CODE_UNION) + return_value = NULL; + } + if (return_value == NULL) + query_prefix = "\ +The location at which to store the function's return value is unknown.\n"; } - /* FIXME: cagney/2003-01-18: Rather than pop each frame in turn, - this code should just go straight to the relevant frame and pop - 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 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. */ + /* Does an interactive user really want to do this? Include + information, such as how well GDB can handle the return value, in + the query message. */ + if (from_tty) + { + int confirmed; + if (thisfun == NULL) + confirmed = query ("%sMake selected stack frame return now? ", + query_prefix); + else + confirmed = query ("%sMake %s return now? ", query_prefix, + SYMBOL_PRINT_NAME (thisfun)); + if (!confirmed) + error ("Not confirmed"); + } - while (selected_frame_addr != get_frame_base (frame = get_current_frame ()) - || selected_frame_pc != get_frame_pc (frame)) - frame_pop (get_current_frame ()); + /* NOTE: cagney/2003-01-18: Is this silly? Rather than pop each + frame in turn, should this code just go straight to the relevant + frame and pop that? */ - /* Then pop that frame. */ + /* First discard all frames inner-to the selected frame (making the + selected frame current). */ + { + struct frame_id selected_id = get_frame_id (get_selected_frame ()); + while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ()))) + { + if (frame_id_inner (selected_id, get_frame_id (get_current_frame ()))) + /* Caught in the safety net, oops! We've gone way past the + selected frame. */ + error ("Problem while popping stack frames (corrupt stack?)"); + frame_pop (get_current_frame ()); + } + } + /* Second discard the selected frame (which is now also the current + frame). */ frame_pop (get_current_frame ()); - /* Compute the return value (if any) and store in the place - for return values. */ - - if (retval_exp) - set_return_value (return_value); - - /* If we are at the end of a call dummy now, pop the dummy frame too. */ + /* Store RETURN_VAUE in the just-returned register set. */ + if (return_value != NULL) + { + struct type *return_type = VALUE_TYPE (return_value); + if (!gdbarch_return_value_p (current_gdbarch)) + { + STORE_RETURN_VALUE (return_type, current_regcache, + VALUE_CONTENTS (return_value)); + } + else + { + gdb_assert (gdbarch_return_value (current_gdbarch, return_type, + NULL, NULL, NULL) + == RETURN_VALUE_REGISTER_CONVENTION); + gdbarch_return_value (current_gdbarch, return_type, + current_regcache, NULL /*read*/, + VALUE_CONTENTS (return_value) /*write*/); + } + } - /* FIXME: cagney/2003-01-18: This is silly. Instead of popping all - the frames except the dummy, and then, as an afterthought, - popping the dummy frame, this code should just pop through to the - dummy frame. */ - - if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (), - get_frame_base (get_current_frame ()))) + /* If we are at the end of a call dummy now, pop the dummy frame + too. */ + /* NOTE: cagney/2003-01-18: Is this silly? Instead of popping all + the frames in sequence, should this code just pop the dummy frame + directly? */ +#ifdef DEPRECATED_CALL_DUMMY_HAS_COMPLETED + /* Since all up-to-date architectures return direct to the dummy + breakpoint address, a dummy frame has, by definition, always + completed. Hence this method is no longer needed. */ + if (DEPRECATED_CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (), + get_frame_base (get_current_frame ()))) frame_pop (get_current_frame ()); +#else + if (get_frame_type (get_current_frame ()) == DUMMY_FRAME) + frame_pop (get_current_frame ()); +#endif /* If interactive, print the frame that is now current. */ - if (from_tty) frame_command ("0", 1); else diff --git a/gdb/symfile.c b/gdb/symfile.c index 586ecd1..f2656fb 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -872,7 +872,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, */ if (from_tty || info_verbose) { - printf_filtered ("Mapped symbols for %s...", name); + printf_unfiltered ("Mapped symbols for %s...", name); wrap_here (""); gdb_flush (gdb_stdout); } @@ -890,7 +890,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, pre_add_symbol_hook (name); else { - printf_filtered ("Reading symbols from %s...", name); + printf_unfiltered ("Reading symbols from %s...", name); wrap_here (""); gdb_flush (gdb_stdout); } @@ -908,7 +908,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, { if (from_tty || info_verbose) { - printf_filtered ("expanding to full symbols..."); + printf_unfiltered ("expanding to full symbols..."); wrap_here (""); gdb_flush (gdb_stdout); } @@ -947,7 +947,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, if (!have_partial_symbols () && !have_full_symbols ()) { wrap_here (""); - printf_filtered ("(no debugging symbols found)..."); + printf_unfiltered ("(no debugging symbols found)..."); wrap_here (""); } @@ -957,7 +957,7 @@ symbol_file_add_with_addrs_or_offsets (char *name, int from_tty, post_add_symbol_hook (); else { - printf_filtered ("done.\n"); + printf_unfiltered ("done.\n"); } } @@ -1223,7 +1223,7 @@ symbol_file_command (char *args, int from_tty) cleanups = make_cleanup_freeargv (argv); while (*argv != NULL) { - if (STREQ (*argv, "-mapped")) + if (strcmp (*argv, "-mapped") == 0) flags |= OBJF_MAPPED; else if (STREQ (*argv, "-readnow")) @@ -1666,7 +1666,6 @@ print_transfer_performance (struct ui_file *stream, instead a call to target_link() (in target.c) would supply the value to use. We are now discontinuing this type of ad hoc syntax. */ -/* ARGSUSED */ static void add_symbol_file_command (char *args, int from_tty) { @@ -1798,7 +1797,7 @@ add_symbol_file_command (char *args, int from_tty) statements because local_hex_string returns a local static string. */ - printf_filtered ("add symbol table from file \"%s\" at\n", filename); + printf_unfiltered ("add symbol table from file \"%s\" at\n", filename); section_addrs = alloc_section_addr_info (section_index); make_cleanup (xfree, section_addrs); for (i = 0; i < section_index; i++) @@ -1813,7 +1812,7 @@ add_symbol_file_command (char *args, int from_tty) entered on the command line. */ section_addrs->other[sec_num].name = sec; section_addrs->other[sec_num].addr = addr; - printf_filtered ("\t%s_addr = %s\n", + printf_unfiltered ("\t%s_addr = %s\n", sec, local_hex_string ((unsigned long)addr)); sec_num++; @@ -1878,7 +1877,7 @@ reread_symbols (void) if (res != 0) { /* FIXME, should use print_sys_errmsg but it's not filtered. */ - printf_filtered ("`%s' has disappeared; keeping its symbols.\n", + printf_unfiltered ("`%s' has disappeared; keeping its symbols.\n", objfile->name); continue; } @@ -1890,7 +1889,7 @@ reread_symbols (void) int num_offsets; char *obfd_filename; - printf_filtered ("`%s' has changed; re-reading symbols.\n", + printf_unfiltered ("`%s' has changed; re-reading symbols.\n", objfile->name); /* There are various functions like symbol_file_add, @@ -1970,6 +1969,7 @@ reread_symbols (void) memset (&objfile->msymbol_demangled_hash, 0, sizeof (objfile->msymbol_demangled_hash)); objfile->fundamental_types = NULL; + clear_objfile_data (objfile); if (objfile->sf != NULL) { (*objfile->sf->sym_finish) (objfile); @@ -2023,7 +2023,7 @@ reread_symbols (void) if (!have_partial_symbols () && !have_full_symbols ()) { wrap_here (""); - printf_filtered ("(no debugging symbols found)\n"); + printf_unfiltered ("(no debugging symbols found)\n"); wrap_here (""); } objfile->flags |= OBJF_SYMS; @@ -2539,7 +2539,7 @@ free_named_symtabs (char *name) again2: for (ps = partial_symtab_list; ps; ps = ps->next) { - if (STREQ (name, ps->filename)) + if (strcmp (name, ps->filename) == 0) { cashier_psymtab (ps); /* Blow it away...and its little dog, too. */ goto again2; /* Must restart, chain has been munged */ @@ -2550,7 +2550,7 @@ again2: for (s = symtab_list; s; s = s->next) { - if (STREQ (name, s->filename)) + if (strcmp (name, s->filename) == 0) break; prev = s; } @@ -3193,7 +3193,7 @@ the 'overlay manual' command."); sec2->the_bfd_section)) { if (info_verbose) - printf_filtered ("Note: section %s unmapped by overlap\n", + printf_unfiltered ("Note: section %s unmapped by overlap\n", bfd_section_name (objfile->obfd, sec2->the_bfd_section)); sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2 */ @@ -3243,7 +3243,7 @@ overlay_auto_command (char *args, int from_tty) overlay_debugging = ovly_auto; enable_overlay_breakpoints (); if (info_verbose) - printf_filtered ("Automatic overlay debugging enabled."); + printf_unfiltered ("Automatic overlay debugging enabled."); } /* Function: overlay_manual_command @@ -3256,7 +3256,7 @@ overlay_manual_command (char *args, int from_tty) overlay_debugging = ovly_on; disable_overlay_breakpoints (); if (info_verbose) - printf_filtered ("Overlay debugging enabled."); + printf_unfiltered ("Overlay debugging enabled."); } /* Function: overlay_off_command @@ -3269,7 +3269,7 @@ overlay_off_command (char *args, int from_tty) overlay_debugging = ovly_off; disable_overlay_breakpoints (); if (info_verbose) - printf_filtered ("Overlay debugging disabled."); + printf_unfiltered ("Overlay debugging disabled."); } static void diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c deleted file mode 100644 index c4b2c9a..0000000 --- a/gdb/symm-nat.c +++ /dev/null @@ -1,902 +0,0 @@ -// 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 deleted file mode 100644 index 21c8436..0000000 --- a/gdb/symm-tdep.c +++ /dev/null @@ -1,102 +0,0 @@ -// 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 794947f..f326853 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -579,7 +579,7 @@ Arguments missing: an output file name and an optional symbol file name"); immediate_quit++; ALL_SYMTABS (objfile, s) - if (symname == NULL || (STREQ (symname, s->filename))) + if (symname == NULL || strcmp (symname, s->filename) == 0) dump_symtab (objfile, s, outfile); immediate_quit--; do_cleanups (cleanups); @@ -818,7 +818,7 @@ maintenance_print_psymbols (char *args, int from_tty) immediate_quit++; ALL_PSYMTABS (objfile, ps) - if (symname == NULL || (STREQ (symname, ps->filename))) + if (symname == NULL || strcmp (symname, ps->filename) == 0) dump_psymtab (objfile, ps, outfile); immediate_quit--; do_cleanups (cleanups); @@ -965,7 +965,7 @@ maintenance_print_msymbols (char *args, int from_tty) immediate_quit++; ALL_OBJFILES (objfile) - if (symname == NULL || (STREQ (symname, objfile->name))) + if (symname == NULL || strcmp (symname, objfile->name) == 0) dump_msymbols (objfile, outfile); immediate_quit--; fprintf_filtered (outfile, "\n\n"); diff --git a/gdb/symtab.c b/gdb/symtab.c index f739457..ed024d6 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -117,8 +117,6 @@ struct symbol *lookup_symbol_aux_minsyms (const char *name, struct symtab **symtab); #endif -static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr); - /* This flag is used in hppa-tdep.c, and set in hp-symtab-read.c */ /* Signals the presence of objects compiled by HP compilers */ int hp_som_som_object_present = 0; @@ -348,7 +346,7 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id) is_full_physname_constructor = is_constructor_name (physname); is_constructor = - is_full_physname_constructor || (newname && STREQ (field_name, newname)); + is_full_physname_constructor || (newname && strcmp (field_name, newname) == 0); if (!is_destructor) is_destructor = (strncmp (physname, "__dt", 4) == 0); @@ -1743,29 +1741,6 @@ lookup_block_symbol (const struct block *block, const char *name, && (linkage_name != NULL ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) { - /* If SYM has aliases, then use any alias that is active - at the current PC. If no alias is active at the current - PC, then use the main symbol. - - ?!? Is checking the current pc correct? Is this routine - ever called to look up a symbol from another context? - - FIXME: No, it's not correct. If someone sets a - conditional breakpoint at an address, then the - breakpoint's `struct expression' should refer to the - `struct symbol' appropriate for the breakpoint's - address, which may not be the PC. - - Even if it were never called from another context, - it's totally bizarre for lookup_symbol's behavior to - depend on the value of the inferior's current PC. We - should pass in the appropriate PC as well as the - block. The interface to lookup_symbol should change - to require the caller to provide a PC. */ - - if (SYMBOL_ALIASES (sym)) - sym = find_active_alias (sym, read_pc ()); - sym_found = sym; if (SYMBOL_CLASS (sym) != LOC_ARG && SYMBOL_CLASS (sym) != LOC_LOCAL_ARG && @@ -1783,38 +1758,6 @@ lookup_block_symbol (const struct block *block, const char *name, } } -/* Given a main symbol SYM and ADDR, search through the alias - list to determine if an alias is active at ADDR and return - the active alias. - - If no alias is active, then return SYM. */ - -static struct symbol * -find_active_alias (struct symbol *sym, CORE_ADDR addr) -{ - struct range_list *r; - struct alias_list *aliases; - - /* If we have aliases, check them first. */ - aliases = SYMBOL_ALIASES (sym); - - while (aliases) - { - if (!SYMBOL_RANGES (aliases->sym)) - return aliases->sym; - for (r = SYMBOL_RANGES (aliases->sym); r; r = r->next) - { - if (r->start <= addr && r->end > addr) - return aliases->sym; - } - aliases = aliases->next; - } - - /* Nothing found, return the main symbol. */ - return sym; -} - - /* Find the symtab associated with PC and SECTION. Look through the psymtabs and read in another symtab if necessary. */ @@ -1947,7 +1890,7 @@ find_pc_symtab (CORE_ADDR pc) /* If it's worth the effort, we could be using a binary search. */ struct symtab_and_line -find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent) +find_pc_sect_line (CORE_ADDR pc, struct bfd_section *section, int notcurrent) { struct symtab *s; struct linetable *l; @@ -2044,7 +1987,7 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent) if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) { mfunsym = lookup_minimal_symbol_text (SYMBOL_LINKAGE_NAME (msymbol), - NULL, NULL); + NULL); if (mfunsym == NULL) /* I eliminated this warning since it is coming out * in the following situation: @@ -2257,7 +2200,7 @@ find_line_symtab (struct symtab *symtab, int line, int *index, int *exact_match) struct linetable *l; int ind; - if (!STREQ (symtab->filename, s->filename)) + if (strcmp (symtab->filename, s->filename) != 0) continue; l = LINETABLE (s); ind = find_line_common (l, line, &exact); diff --git a/gdb/symtab.h b/gdb/symtab.h index f288e94..40ce11e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -586,22 +586,6 @@ struct location_funcs struct axs_value * value); }; -/* Linked list of symbol's live ranges. */ - -struct range_list -{ - CORE_ADDR start; - CORE_ADDR end; - struct range_list *next; -}; - -/* Linked list of aliases for a particular main/primary symbol. */ -struct alias_list -{ - struct symbol *sym; - struct alias_list *next; -}; - /* This structure is space critical. See space comments at the top. */ struct symbol @@ -654,15 +638,6 @@ struct symbol } aux_value; - - /* Link to a list of aliases for this symbol. - Only a "primary/main symbol may have aliases. */ - struct alias_list *aliases; - - /* List of ranges where this symbol is active. This is only - used by alias symbols at the current time. */ - struct range_list *ranges; - struct symbol *hash_next; }; @@ -673,8 +648,6 @@ struct symbol #define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg #define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile -#define SYMBOL_ALIASES(symbol) (symbol)->aliases -#define SYMBOL_RANGES(symbol) (symbol)->ranges #define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value.loc.baton #define SYMBOL_LOCATION_FUNCS(symbol) (symbol)->aux_value.loc.funcs @@ -1184,11 +1157,9 @@ extern struct minimal_symbol *lookup_minimal_symbol_linkage_or_natural (const char *); extern struct minimal_symbol *lookup_minimal_symbol_text (const char *, - const char *, struct objfile *); struct minimal_symbol *lookup_minimal_symbol_solib_trampoline (const char *, - const char *, struct objfile *); diff --git a/gdb/target.c b/gdb/target.c index e738208..7e088b9 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1,7 +1,8 @@ /* Select target systems and architectures at runtime for GDB. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Cygnus Support. This file is part of GDB. @@ -35,13 +36,11 @@ #include "dcache.h" #include <signal.h> #include "regcache.h" - -extern int errno; +#include "gdb_assert.h" +#include "gdbcore.h" static void target_info (char *, int); -static void cleanup_target (struct target_ops *); - static void maybe_kill_then_create_inferior (char *, char *, char **); static void maybe_kill_then_attach (char *, int); @@ -70,12 +69,16 @@ static void target_command (char *, int); static struct target_ops *find_default_run_target (char *); -static void update_current_target (void); - static void nosupport_runtime (void); static void normal_target_post_startup_inferior (ptid_t ptid); +static LONGEST default_xfer_partial (struct target_ops *ops, + enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, + ULONGEST offset, LONGEST len); + /* Transfer LEN bytes between target address MEMADDR and GDB address MYADDR. Returns 0 for success, errno code for failure (which includes partial transfers -- if you want a more useful response to @@ -162,8 +165,6 @@ static int debug_to_thread_alive (ptid_t); static void debug_to_stop (void); -static int debug_to_query (int /*char */ , char *, char *, int *); - /* Pointer to array of target architecture structures; the size of the array; the current index into the array; the allocated size of the array. */ @@ -180,7 +181,7 @@ static struct target_ops dummy_target; /* Top of target stack. */ -struct target_stack_item *target_stack; +static struct target_ops *target_stack; /* The target structure we are currently using to talk to a process or file or whatever "inferior" we have. */ @@ -206,7 +207,6 @@ DCACHE *target_dcache; /* The user just typed 'target' without the name of a target. */ -/* ARGSUSED */ static void target_command (char *arg, int from_tty) { @@ -219,6 +219,10 @@ target_command (char *arg, int from_tty) void add_target (struct target_ops *t) { + /* Provide default values for all "must have" methods. */ + if (t->to_xfer_partial == NULL) + t->to_xfer_partial = default_xfer_partial; + if (!target_structs) { target_struct_allocsize = DEFAULT_ALLOCSIZE; @@ -233,7 +237,6 @@ add_target (struct target_ops *t) target_struct_allocsize * sizeof (*target_structs)); } target_structs[target_struct_size++] = t; -/* cleanup_target (t); */ if (targetlist == NULL) add_prefix_cmd ("target", class_run, target_command, @@ -260,7 +263,6 @@ target_load (char *arg, int from_tty) (*current_target.to_load) (arg, from_tty); } -/* ARGSUSED */ static int nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, struct target_ops *t) @@ -282,14 +284,12 @@ noprocess (void) error ("You can't do that without a process to debug."); } -/* ARGSUSED */ static int nosymbol (char *name, CORE_ADDR *addrp) { return 1; /* Symbol does not exist in target env */ } -/* ARGSUSED */ static void nosupport_runtime (void) { @@ -300,7 +300,6 @@ nosupport_runtime (void) } -/* ARGSUSED */ static void default_terminal_info (char *args, int from_tty) { @@ -348,16 +347,121 @@ maybe_kill_then_create_inferior (char *exec, char *args, char **env) target_create_inferior (exec, args, env); } -/* Clean up a target struct so it no longer has any zero pointers in it. - We default entries, at least to stubs that print error messages. */ +/* Go through the target stack from top to bottom, copying over zero + entries in current_target, then filling in still empty entries. In + effect, we are doing class inheritance through the pushed target + vectors. + + NOTE: cagney/2003-10-17: The problem with this inheritance, as it + is currently implemented, is that it discards any knowledge of + which target an inherited method originally belonged to. + Consequently, new new target methods should instead explicitly and + locally search the target stack for the target that can handle the + request. */ static void -cleanup_target (struct target_ops *t) +update_current_target (void) { + struct target_ops *t; + + /* First, reset curren'ts contents. */ + memset (¤t_target, 0, sizeof (current_target)); + +#define INHERIT(FIELD, TARGET) \ + if (!current_target.FIELD) \ + current_target.FIELD = (TARGET)->FIELD + + for (t = target_stack; t; t = t->beneath) + { + INHERIT (to_shortname, t); + INHERIT (to_longname, t); + INHERIT (to_doc, t); + INHERIT (to_open, t); + INHERIT (to_close, t); + INHERIT (to_attach, t); + INHERIT (to_post_attach, t); + INHERIT (to_detach, t); + INHERIT (to_disconnect, t); + INHERIT (to_resume, t); + INHERIT (to_wait, t); + INHERIT (to_post_wait, t); + INHERIT (to_fetch_registers, t); + INHERIT (to_store_registers, t); + INHERIT (to_prepare_to_store, t); + INHERIT (to_xfer_memory, t); + INHERIT (to_files_info, t); + INHERIT (to_insert_breakpoint, t); + INHERIT (to_remove_breakpoint, t); + INHERIT (to_can_use_hw_breakpoint, t); + INHERIT (to_insert_hw_breakpoint, t); + INHERIT (to_remove_hw_breakpoint, t); + INHERIT (to_insert_watchpoint, t); + INHERIT (to_remove_watchpoint, t); + INHERIT (to_stopped_data_address, t); + INHERIT (to_stopped_by_watchpoint, t); + INHERIT (to_have_continuable_watchpoint, t); + INHERIT (to_region_size_ok_for_hw_watchpoint, t); + INHERIT (to_terminal_init, t); + INHERIT (to_terminal_inferior, t); + INHERIT (to_terminal_ours_for_output, t); + INHERIT (to_terminal_ours, t); + INHERIT (to_terminal_save_ours, t); + INHERIT (to_terminal_info, t); + INHERIT (to_kill, t); + INHERIT (to_load, t); + INHERIT (to_lookup_symbol, t); + INHERIT (to_create_inferior, t); + INHERIT (to_post_startup_inferior, t); + INHERIT (to_acknowledge_created_inferior, t); + INHERIT (to_insert_fork_catchpoint, t); + INHERIT (to_remove_fork_catchpoint, t); + INHERIT (to_insert_vfork_catchpoint, t); + INHERIT (to_remove_vfork_catchpoint, t); + INHERIT (to_follow_fork, t); + INHERIT (to_insert_exec_catchpoint, t); + INHERIT (to_remove_exec_catchpoint, t); + INHERIT (to_reported_exec_events_per_exec_call, t); + INHERIT (to_has_exited, t); + INHERIT (to_mourn_inferior, t); + INHERIT (to_can_run, t); + INHERIT (to_notice_signals, t); + INHERIT (to_thread_alive, t); + INHERIT (to_find_new_threads, t); + INHERIT (to_pid_to_str, t); + INHERIT (to_extra_thread_info, t); + INHERIT (to_stop, t); + /* Do not inherit to_xfer_partial. */ + INHERIT (to_rcmd, t); + INHERIT (to_enable_exception_callback, t); + INHERIT (to_get_current_exception_event, t); + INHERIT (to_pid_to_exec_file, t); + INHERIT (to_stratum, t); + INHERIT (to_has_all_memory, t); + INHERIT (to_has_memory, t); + INHERIT (to_has_stack, t); + INHERIT (to_has_registers, t); + INHERIT (to_has_execution, t); + INHERIT (to_has_thread_control, t); + INHERIT (to_sections, t); + INHERIT (to_sections_end, t); + INHERIT (to_can_async_p, t); + INHERIT (to_is_async_p, t); + INHERIT (to_async, t); + INHERIT (to_async_mask_value, t); + INHERIT (to_find_memory_regions, t); + INHERIT (to_make_corefile_notes, t); + INHERIT (to_get_thread_local_address, t); + INHERIT (to_magic, t); + } +#undef INHERIT + + /* Clean up a target struct so it no longer has any zero pointers in + it. Some entries are defaulted to a method that print an error, + others are hard-wired to a standard recursive default. */ #define de_fault(field, value) \ - if (!t->field) \ - t->field = value + if (!current_target.field) \ + current_target.field = value de_fault (to_open, (void (*) (char *, int)) @@ -508,6 +612,7 @@ cleanup_target (struct target_ops *t) de_fault (to_stop, (void (*) (void)) target_ignore); + current_target.to_xfer_partial = default_xfer_partial; de_fault (to_rcmd, (void (*) (char *, struct ui_file *)) tcomplain); @@ -530,111 +635,11 @@ cleanup_target (struct target_ops *t) (void (*) (void (*) (enum inferior_event_type, void*), void*)) tcomplain); #undef de_fault -} - -/* Go through the target stack from top to bottom, copying over zero entries in - current_target. In effect, we are doing class inheritance through the - pushed target vectors. */ - -static void -update_current_target (void) -{ - struct target_stack_item *item; - struct target_ops *t; - - /* First, reset current_target */ - memset (¤t_target, 0, sizeof current_target); - - for (item = target_stack; item; item = item->next) - { - t = item->target_ops; - -#define INHERIT(FIELD, TARGET) \ - if (!current_target.FIELD) \ - current_target.FIELD = TARGET->FIELD - INHERIT (to_shortname, t); - INHERIT (to_longname, t); - INHERIT (to_doc, t); - INHERIT (to_open, t); - INHERIT (to_close, t); - INHERIT (to_attach, t); - INHERIT (to_post_attach, t); - INHERIT (to_detach, t); - INHERIT (to_disconnect, t); - INHERIT (to_resume, t); - INHERIT (to_wait, t); - INHERIT (to_post_wait, t); - INHERIT (to_fetch_registers, t); - INHERIT (to_store_registers, t); - INHERIT (to_prepare_to_store, t); - INHERIT (to_xfer_memory, t); - INHERIT (to_files_info, t); - INHERIT (to_insert_breakpoint, t); - INHERIT (to_remove_breakpoint, t); - INHERIT (to_can_use_hw_breakpoint, t); - INHERIT (to_insert_hw_breakpoint, t); - INHERIT (to_remove_hw_breakpoint, t); - INHERIT (to_insert_watchpoint, t); - INHERIT (to_remove_watchpoint, t); - INHERIT (to_stopped_data_address, t); - INHERIT (to_stopped_by_watchpoint, t); - INHERIT (to_have_continuable_watchpoint, t); - INHERIT (to_region_size_ok_for_hw_watchpoint, t); - INHERIT (to_terminal_init, t); - INHERIT (to_terminal_inferior, t); - INHERIT (to_terminal_ours_for_output, t); - INHERIT (to_terminal_ours, t); - INHERIT (to_terminal_save_ours, t); - INHERIT (to_terminal_info, t); - INHERIT (to_kill, t); - INHERIT (to_load, t); - INHERIT (to_lookup_symbol, t); - INHERIT (to_create_inferior, t); - INHERIT (to_post_startup_inferior, t); - INHERIT (to_acknowledge_created_inferior, t); - INHERIT (to_insert_fork_catchpoint, t); - INHERIT (to_remove_fork_catchpoint, t); - INHERIT (to_insert_vfork_catchpoint, t); - INHERIT (to_remove_vfork_catchpoint, t); - INHERIT (to_follow_fork, t); - INHERIT (to_insert_exec_catchpoint, t); - INHERIT (to_remove_exec_catchpoint, t); - INHERIT (to_reported_exec_events_per_exec_call, t); - INHERIT (to_has_exited, t); - INHERIT (to_mourn_inferior, t); - INHERIT (to_can_run, t); - INHERIT (to_notice_signals, t); - INHERIT (to_thread_alive, t); - INHERIT (to_find_new_threads, t); - INHERIT (to_pid_to_str, t); - INHERIT (to_extra_thread_info, t); - INHERIT (to_stop, t); - INHERIT (to_query, t); - INHERIT (to_rcmd, t); - INHERIT (to_enable_exception_callback, t); - INHERIT (to_get_current_exception_event, t); - INHERIT (to_pid_to_exec_file, t); - INHERIT (to_stratum, t); - INHERIT (to_has_all_memory, t); - INHERIT (to_has_memory, t); - INHERIT (to_has_stack, t); - INHERIT (to_has_registers, t); - INHERIT (to_has_execution, t); - INHERIT (to_has_thread_control, t); - INHERIT (to_sections, t); - INHERIT (to_sections_end, t); - INHERIT (to_can_async_p, t); - INHERIT (to_is_async_p, t); - INHERIT (to_async, t); - INHERIT (to_async_mask_value, t); - INHERIT (to_find_memory_regions, t); - INHERIT (to_make_corefile_notes, t); - INHERIT (to_get_thread_local_address, t); - INHERIT (to_magic, t); - -#undef INHERIT - } + /* Finally, position the target-stack beneath the squashed + "current_target". That way code looking for a non-inherited + target method can quickly and simply find it. */ + current_target.beneath = target_stack; } /* Push a new target type into the stack of the existing target accessors, @@ -650,7 +655,7 @@ update_current_target (void) int push_target (struct target_ops *t) { - struct target_stack_item *cur, *prev, *tmp; + struct target_ops **cur; /* Check magic number. If wrong, it probably means someone changed the struct definition, but not all the places that initialize one. */ @@ -662,51 +667,37 @@ push_target (struct target_ops *t) internal_error (__FILE__, __LINE__, "failed internal consistency check"); } - /* Find the proper stratum to install this target in. */ - - for (prev = NULL, cur = target_stack; cur; prev = cur, cur = cur->next) + /* Find the proper stratum to install this target in. */ + for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath) { - if ((int) (t->to_stratum) >= (int) (cur->target_ops->to_stratum)) + if ((int) (t->to_stratum) >= (int) (*cur)->to_stratum) break; } - /* If there's already targets at this stratum, remove them. */ - - if (cur) - while (t->to_stratum == cur->target_ops->to_stratum) - { - /* There's already something on this stratum. Close it off. */ - if (cur->target_ops->to_close) - (cur->target_ops->to_close) (0); - if (prev) - prev->next = cur->next; /* Unchain old target_ops */ - else - target_stack = cur->next; /* Unchain first on list */ - tmp = cur->next; - xfree (cur); - cur = tmp; - } + /* If there's already targets at this stratum, remove them. */ + /* FIXME: cagney/2003-10-15: I think this should be poping all + targets to CUR, and not just those at this stratum level. */ + while ((*cur) != NULL && t->to_stratum == (*cur)->to_stratum) + { + /* There's already something at this stratum level. Close it, + and un-hook it from the stack. */ + struct target_ops *tmp = (*cur); + (*cur) = (*cur)->beneath; + tmp->beneath = NULL; + target_close (tmp, 0); + } /* We have removed all targets in our stratum, now add the new one. */ - - tmp = (struct target_stack_item *) - xmalloc (sizeof (struct target_stack_item)); - tmp->next = cur; - tmp->target_ops = t; - - if (prev) - prev->next = tmp; - else - target_stack = tmp; + t->beneath = (*cur); + (*cur) = t; update_current_target (); - cleanup_target (¤t_target); /* Fill in the gaps */ - if (targetdebug) setup_target_debug (); - return prev != 0; + /* Not on top? */ + return (t != target_stack); } /* Remove a target_ops vector from the stack, wherever it may be. @@ -715,32 +706,29 @@ push_target (struct target_ops *t) int unpush_target (struct target_ops *t) { - struct target_stack_item *cur, *prev; + struct target_ops **cur; + struct target_ops *tmp; - if (t->to_close) - t->to_close (0); /* Let it clean up */ + target_close (t, 0); /* Look for the specified target. Note that we assume that a target can only occur once in the target stack. */ - for (cur = target_stack, prev = NULL; cur; prev = cur, cur = cur->next) - if (cur->target_ops == t) - break; + for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath) + { + if ((*cur) == t) + break; + } - if (!cur) + if ((*cur) == NULL) return 0; /* Didn't find target_ops, quit now */ /* Unchain the target */ - - if (!prev) - target_stack = cur->next; - else - prev->next = cur->next; - - xfree (cur); /* Release the target_stack_item */ + tmp = (*cur); + (*cur) = (*cur)->beneath; + tmp->beneath = NULL; update_current_target (); - cleanup_target (¤t_target); return 1; } @@ -748,8 +736,8 @@ unpush_target (struct target_ops *t) void pop_target (void) { - (current_target.to_close) (0); /* Let it clean up */ - if (unpush_target (target_stack->target_ops) == 1) + target_close (¤t_target, 0); /* Let it clean up */ + if (unpush_target (target_stack) == 1) return; fprintf_unfiltered (gdb_stderr, @@ -834,6 +822,21 @@ done: return nbytes_read; } +/* Find a section containing ADDR. */ +struct section_table * +target_section_by_addr (struct target_ops *target, CORE_ADDR addr) +{ + struct section_table *secp; + for (secp = target->to_sections; + secp < target->to_sections_end; + secp++) + { + if (addr >= secp->addr && addr < secp->endaddr) + return secp; + } + return NULL; +} + /* Read LEN bytes of target memory at address MEMADDR, placing the results in GDB's memory at MYADDR. Returns either 0 for success or an errno value if any error occurs. @@ -870,7 +873,6 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, int res; int done = 0; struct target_ops *t; - struct target_stack_item *item; /* Zero length requests are ok and require no work. */ if (len == 0) @@ -882,22 +884,15 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, if (!write && trust_readonly) { + struct section_table *secp; /* User-settable option, "trust-readonly-sections". If true, then memory from any SEC_READONLY bfd section may be read - directly from the bfd file. */ - - struct section_table *secp; - - for (secp = current_target.to_sections; - secp < current_target.to_sections_end; - secp++) - { - if (bfd_get_section_flags (secp->bfd, secp->the_bfd_section) - & SEC_READONLY) - if (memaddr >= secp->addr && memaddr < secp->endaddr) - return xfer_memory (memaddr, myaddr, len, 0, - attrib, ¤t_target); - } + directly from the bfd file. */ + secp = target_section_by_addr (¤t_target, memaddr); + if (secp != NULL + && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section) + & SEC_READONLY)) + return xfer_memory (memaddr, myaddr, len, 0, attrib, ¤t_target); } /* The quick case is that the top target can handle the transfer. */ @@ -907,9 +902,8 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, /* If res <= 0 then we call it again in the loop. Ah well. */ if (res <= 0) { - for (item = target_stack; item; item = item->next) + for (t = target_stack; t != NULL; t = t->beneath) { - t = item->target_ops; if (!t->to_has_memory) continue; @@ -1077,12 +1071,145 @@ target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err) return target_xfer_memory_partial (memaddr, buf, len, 1, err); } -/* ARGSUSED */ +/* More generic transfers. */ + +static LONGEST +default_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, + const void *writebuf, ULONGEST offset, LONGEST len) +{ + if (object == TARGET_OBJECT_MEMORY + && ops->to_xfer_memory != NULL) + /* If available, fall back to the target's "to_xfer_memory" + method. */ + { + int xfered = -1; + errno = 0; + if (writebuf != NULL) + { + void *buffer = xmalloc (len); + struct cleanup *cleanup = make_cleanup (xfree, buffer); + memcpy (buffer, writebuf, len); + xfered = ops->to_xfer_memory (offset, buffer, len, 1/*write*/, NULL, + ops); + do_cleanups (cleanup); + } + if (readbuf != NULL) + xfered = ops->to_xfer_memory (offset, readbuf, len, 0/*read*/, NULL, + ops); + if (xfered > 0) + return xfered; + else if (xfered == 0 && errno == 0) + /* "to_xfer_memory" uses 0, cross checked against ERRNO as one + indication of an error. */ + return 0; + else + return -1; + } + else if (ops->beneath != NULL) + return ops->beneath->to_xfer_partial (ops->beneath, object, annex, + readbuf, writebuf, offset, len); + else + return -1; +} + +/* Target vector read/write partial wrapper functions. + + NOTE: cagney/2003-10-21: I wonder if having "to_xfer_partial + (inbuf, outbuf)", instead of separate read/write methods, make life + easier. */ + +LONGEST +target_read_partial (struct target_ops *ops, + enum target_object object, + const char *annex, void *buf, + ULONGEST offset, LONGEST len) +{ + gdb_assert (ops->to_xfer_partial != NULL); + return ops->to_xfer_partial (ops, object, annex, buf, NULL, offset, len); +} + +LONGEST +target_write_partial (struct target_ops *ops, + enum target_object object, + const char *annex, const void *buf, + ULONGEST offset, LONGEST len) +{ + gdb_assert (ops->to_xfer_partial != NULL); + return ops->to_xfer_partial (ops, object, annex, NULL, buf, offset, len); +} + +/* Wrappers to perform the full transfer. */ +LONGEST +target_read (struct target_ops *ops, + enum target_object object, + const char *annex, void *buf, + ULONGEST offset, LONGEST len) +{ + LONGEST xfered = 0; + while (xfered < len) + { + LONGEST xfer = target_read_partial (ops, object, annex, + (bfd_byte *) buf + xfered, + offset + xfered, len - xfered); + /* Call an observer, notifying them of the xfer progress? */ + if (xfer <= 0) + /* Call memory_error? */ + return -1; + xfered += xfer; + QUIT; + } + return len; +} + +LONGEST +target_write (struct target_ops *ops, + enum target_object object, + const char *annex, const void *buf, + ULONGEST offset, LONGEST len) +{ + LONGEST xfered = 0; + while (xfered < len) + { + LONGEST xfer = target_write_partial (ops, object, annex, + (bfd_byte *) buf + xfered, + offset + xfered, len - xfered); + /* Call an observer, notifying them of the xfer progress? */ + if (xfer <= 0) + /* Call memory_error? */ + return -1; + xfered += xfer; + QUIT; + } + return len; +} + +/* Memory transfer methods. */ + +void +get_target_memory (struct target_ops *ops, CORE_ADDR addr, void *buf, + LONGEST len) +{ + if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len) + != len) + memory_error (EIO, addr); +} + +ULONGEST +get_target_memory_unsigned (struct target_ops *ops, + CORE_ADDR addr, int len) +{ + char buf[sizeof (ULONGEST)]; + + gdb_assert (len <= sizeof (buf)); + get_target_memory (ops, addr, buf, len); + return extract_unsigned_integer (buf, len); +} + static void target_info (char *args, int from_tty) { struct target_ops *t; - struct target_stack_item *item; int has_all_mem = 0; if (symfile_objfile != NULL) @@ -1093,10 +1220,8 @@ target_info (char *args, int from_tty) return; #endif - for (item = target_stack; item; item = item->next) + for (t = target_stack; t != NULL; t = t->beneath) { - t = item->target_ops; - if (!t->to_has_memory) continue; @@ -1391,16 +1516,7 @@ find_core_target (void) struct target_ops * find_target_beneath (struct target_ops *t) { - struct target_stack_item *cur; - - for (cur = target_stack; cur; cur = cur->next) - if (cur->target_ops == t) - break; - - if (cur == NULL || cur->next == NULL) - return NULL; - else - return cur->next->target_ops; + return t->beneath; } @@ -1500,7 +1616,6 @@ normal_target_post_startup_inferior (ptid_t ptid) } /* Error-catcher for target_find_memory_regions */ -/* ARGSUSED */ static int dummy_find_memory_regions (int (*ignore1) (), void *ignore2) { error ("No target."); @@ -1508,7 +1623,6 @@ static int dummy_find_memory_regions (int (*ignore1) (), void *ignore2) } /* Error-catcher for target_make_corefile_notes */ -/* ARGSUSED */ static char * dummy_make_corefile_notes (bfd *ignore1, int *ignore2) { error ("No target."); @@ -1530,6 +1644,7 @@ init_dummy_target (void) dummy_target.to_stratum = dummy_stratum; dummy_target.to_find_memory_regions = dummy_find_memory_regions; dummy_target.to_make_corefile_notes = dummy_make_corefile_notes; + dummy_target.to_xfer_partial = default_xfer_partial; dummy_target.to_magic = OPS_MAGIC; } @@ -1547,11 +1662,19 @@ debug_to_open (char *args, int from_tty) static void debug_to_close (int quitting) { - debug_target.to_close (quitting); - + target_close (&debug_target, quitting); fprintf_unfiltered (gdb_stdlog, "target_close (%d)\n", quitting); } +void +target_close (struct target_ops *targ, int quitting) +{ + if (targ->to_xclose != NULL) + targ->to_xclose (targ, quitting); + else if (targ->to_close != NULL) + targ->to_close (quitting); +} + static void debug_to_attach (char *args, int from_tty) { @@ -1668,11 +1791,11 @@ debug_print_register (const char * func, int regno) unsigned char buf[MAX_REGISTER_SIZE]; deprecated_read_register_gen (regno, buf); fprintf_unfiltered (gdb_stdlog, " = "); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i++) + for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i++) { fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); } - if (REGISTER_RAW_SIZE (regno) <= sizeof (LONGEST)) + if (DEPRECATED_REGISTER_RAW_SIZE (regno) <= sizeof (LONGEST)) { fprintf_unfiltered (gdb_stdlog, " 0x%s %s", paddr_nz (read_register (regno)), @@ -2164,14 +2287,21 @@ debug_to_stop (void) fprintf_unfiltered (gdb_stdlog, "target_stop ()\n"); } -static int -debug_to_query (int type, char *req, char *resp, int *siz) +static LONGEST +debug_to_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len) { - int retval; + LONGEST retval; - retval = debug_target.to_query (type, req, resp, siz); + retval = debug_target.to_xfer_partial (&debug_target, object, annex, + readbuf, writebuf, offset, len); - fprintf_unfiltered (gdb_stdlog, "target_query (%c, %s, %s, %d) = %d\n", type, req, resp, *siz, retval); + fprintf_unfiltered (gdb_stdlog, + "target_xfer_partial (%d, %s, 0x%lx, 0x%lx, 0x%s, %s) = %s\n", + (int) object, (annex ? annex : "(null)"), + (long) readbuf, (long) writebuf, paddr_nz (offset), + paddr_d (len), paddr_d (retval)); return retval; } @@ -2273,7 +2403,7 @@ setup_target_debug (void) current_target.to_thread_alive = debug_to_thread_alive; current_target.to_find_new_threads = debug_to_find_new_threads; current_target.to_stop = debug_to_stop; - current_target.to_query = debug_to_query; + current_target.to_xfer_partial = debug_to_xfer_partial; current_target.to_rcmd = debug_to_rcmd; current_target.to_enable_exception_callback = debug_to_enable_exception_callback; current_target.to_get_current_exception_event = debug_to_get_current_exception_event; diff --git a/gdb/target.h b/gdb/target.h index a3e10e8..42b9596 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1,6 +1,8 @@ /* Interface between GDB and target environments, including files and processes - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Cygnus Support. Written by John Gilmore. This file is part of GDB. @@ -26,6 +28,7 @@ struct objfile; struct ui_file; struct mem_attrib; +struct target_ops; /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -175,6 +178,89 @@ extern char *target_signal_to_name (enum target_signal); /* Given a name (SIGHUP, etc.), return its signal. */ enum target_signal target_signal_from_name (char *); +/* Request the transfer of up to LEN 8-bit bytes of the target's + OBJECT. The OFFSET, for a seekable object, specifies the starting + point. The ANNEX can be used to provide additional data-specific + information to the target. + + Return the number of bytes actually transfered, zero when no + further transfer is possible, and -1 when the transfer is not + supported. + + NOTE: cagney/2003-10-17: The current interface does not support a + "retry" mechanism. Instead it assumes that at least one byte will + be transfered on each call. + + NOTE: cagney/2003-10-17: The current interface can lead to + fragmented transfers. Lower target levels should not implement + hacks, such as enlarging the transfer, in an attempt to compensate + for this. Instead, the target stack should be extended so that it + implements supply/collect methods and a look-aside object cache. + With that available, the lowest target can safely and freely "push" + data up the stack. + + NOTE: cagney/2003-10-17: Unlike the old query and the memory + transfer mechanisms, these methods are explicitly parameterized by + the target that it should be applied to. + + NOTE: cagney/2003-10-17: Just like the old query and memory xfer + methods, these new methods perform partial transfers. The only + difference is that these new methods thought to include "partial" + in the name. The old code's failure to do this lead to much + confusion and duplication of effort as each target object attempted + to locally take responsibility for something it didn't have to + worry about. + + NOTE: cagney/2003-10-17: With a TARGET_OBJECT_KOD object, for + backward compatibility with the "target_query" method that this + replaced, when OFFSET and LEN are both zero, return the "minimum" + buffer size. See "remote.c" for further information. */ + +enum target_object +{ + /* Kernel Object Display transfer. See "kod.c" and "remote.c". */ + TARGET_OBJECT_KOD, + /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */ + TARGET_OBJECT_AVR, + /* Transfer up-to LEN bytes of memory starting at OFFSET. */ + TARGET_OBJECT_MEMORY + /* Possible future ojbects: TARGET_OJBECT_FILE, TARGET_OBJECT_PROC, + TARGET_OBJECT_AUXV, ... */ +}; + +extern LONGEST target_read_partial (struct target_ops *ops, + enum target_object object, + const char *annex, void *buf, + ULONGEST offset, LONGEST len); + +extern LONGEST target_write_partial (struct target_ops *ops, + enum target_object object, + const char *annex, const void *buf, + ULONGEST offset, LONGEST len); + +/* Wrappers to perform the full transfer. */ +extern LONGEST target_read (struct target_ops *ops, + enum target_object object, + const char *annex, void *buf, + ULONGEST offset, LONGEST len); + +extern LONGEST target_write (struct target_ops *ops, + enum target_object object, + const char *annex, const void *buf, + ULONGEST offset, LONGEST len); + +/* Wrappers to target read/write that perform memory transfers. They + throw an error if the memory transfer fails. + + NOTE: cagney/2003-10-23: The naming schema is lifted from + "frame.h". The parameter order is lifted from get_frame_memory, + which in turn lifted it from read_memory. */ + +extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr, + void *buf, LONGEST len); +extern ULONGEST get_target_memory_unsigned (struct target_ops *ops, + CORE_ADDR addr, int len); + /* If certain kinds of activity happen, target_wait should perform callbacks. */ @@ -188,12 +274,23 @@ struct thread_info; /* fwd decl for parameter list below: */ struct target_ops { + struct target_ops *beneath; /* To the target under this one. */ char *to_shortname; /* Name this target type */ char *to_longname; /* Name for printing */ char *to_doc; /* Documentation. Does not include trailing newline, and starts with a one-line descrip- tion (probably similar to to_longname). */ + /* Per-target scratch pad. */ + void *to_data; + /* The open routine takes the rest of the parameters from the + command, and (if successful) pushes a new target onto the + stack. Targets should supply this routine, if only to provide + an error message. */ void (*to_open) (char *, int); + /* Old targets with a static target vector provide "to_close". + New re-entrant targets provide "to_xclose" and that is expected + to xfree everything (including the "struct target_ops"). */ + void (*to_xclose) (struct target_ops *targ, int quitting); void (*to_close) (int); void (*to_attach) (char *, int); void (*to_post_attach) (int); @@ -229,29 +326,6 @@ struct target_ops struct mem_attrib *attrib, struct target_ops *target); -#if 0 - /* Enable this after 4.12. */ - - /* Search target memory. Start at STARTADDR and take LEN bytes of - target memory, and them with MASK, and compare to DATA. If they - match, set *ADDR_FOUND to the address we found it at, store the data - we found at LEN bytes starting at DATA_FOUND, and return. If - not, add INCREMENT to the search address and keep trying until - the search address is outside of the range [LORANGE,HIRANGE). - - If we don't find anything, set *ADDR_FOUND to (CORE_ADDR)0 and - return. */ - - void (*to_search) (int len, char *data, char *mask, - CORE_ADDR startaddr, int increment, - CORE_ADDR lorange, CORE_ADDR hirange, - CORE_ADDR * addr_found, char *data_found); - -#define target_search(len, data, mask, startaddr, increment, lorange, hirange, addr_found, data_found) \ - (*current_target.to_search) (len, data, mask, startaddr, increment, \ - lorange, hirange, addr_found, data_found) -#endif /* 0 */ - void (*to_files_info) (struct target_ops *); int (*to_insert_breakpoint) (CORE_ADDR, char *); int (*to_remove_breakpoint) (CORE_ADDR, char *); @@ -293,7 +367,6 @@ struct target_ops char *(*to_pid_to_str) (ptid_t); char *(*to_extra_thread_info) (struct thread_info *); void (*to_stop) (void); - int (*to_query) (int /*char */ , char *, char *, int *); void (*to_rcmd) (char *command, struct ui_file *output); struct symtab_and_line *(*to_enable_exception_callback) (enum exception_event_kind, @@ -333,6 +406,14 @@ struct target_ops struct objfile *objfile, CORE_ADDR offset); + /* Perform partial transfers on OBJECT. See target_read_partial + and target_write_partial for details of each variant. One, and + only one, of readbuf or writebuf must be non-NULL. */ + LONGEST (*to_xfer_partial) (struct target_ops *ops, + enum target_object object, const char *annex, + void *readbuf, const void *writebuf, + ULONGEST offset, LONGEST len); + int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -349,43 +430,21 @@ struct target_ops extern struct target_ops current_target; -/* An item on the target stack. */ - -struct target_stack_item - { - struct target_stack_item *next; - struct target_ops *target_ops; - }; - -/* The target stack. */ - -extern struct target_stack_item *target_stack; - /* Define easy words for doing these operations on our current target. */ #define target_shortname (current_target.to_shortname) #define target_longname (current_target.to_longname) -/* The open routine takes the rest of the parameters from the command, - and (if successful) pushes a new target onto the stack. - Targets should supply this routine, if only to provide an error message. */ - -#define target_open(name, from_tty) \ - do { \ - dcache_invalidate (target_dcache); \ - (*current_target.to_open) (name, from_tty); \ - } while (0) - -/* Does whatever cleanup is required for a target that we are no longer - going to be calling. Argument says whether we are quitting gdb and - should not get hung in case of errors, or whether we want a clean - termination even if it takes a while. This routine is automatically - always called just before a routine is popped off the target stack. - Closing file descriptors and freeing memory are typical things it should - do. */ +/* Does whatever cleanup is required for a target that we are no + longer going to be calling. QUITTING indicates that GDB is exiting + and should not get hung on an error (otherwise it is important to + perform clean termination, even if it takes a while). This routine + is automatically always called when popping the target off the + target stack (to_beneath is undefined). Closing file descriptors + and freeing all memory allocated memory are typical things it + should do. */ -#define target_close(quitting) \ - (*current_target.to_close) (quitting) +void target_close (struct target_ops *targ, int quitting); /* Attaches to a process on the target side. Arguments are as passed to the `attach' command by the user. This routine can be called @@ -756,16 +815,6 @@ extern void target_load (char *arg, int from_tty); #define target_stop current_target.to_stop -/* Queries the target side for some information. The first argument is a - letter specifying the type of the query, which is used to determine who - should process it. The second argument is a string that specifies which - information is desired and the third is a buffer that carries back the - response from the target side. The fourth parameter is the size of the - output buffer supplied. */ - -#define target_query(query_type, query, resp_buffer, bufffer_size) \ - (*current_target.to_query) (query_type, query, resp_buffer, bufffer_size) - /* Send the specified COMMAND to the target's monitor (shell,interpreter) for execution. The result of the query is placed in OUTBUF. */ @@ -1105,16 +1154,15 @@ struct section_table CORE_ADDR addr; /* Lowest address in section */ CORE_ADDR endaddr; /* 1+highest address in section */ - sec_ptr the_bfd_section; + struct bfd_section *the_bfd_section; bfd *bfd; /* BFD file pointer */ }; -/* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR. - Returns 0 if OK, 1 on error. */ +/* Return the "section" containing the specified address. */ +struct section_table *target_section_by_addr (struct target_ops *target, + CORE_ADDR addr); -extern int build_section_table (bfd *, struct section_table **, - struct section_table **); /* From mem-break.c */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 94971aa..94354a5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,127 @@ +2003-11-11 Nick Clifton <nickc@redhat.com> + + * gdb.base/shreloc.exp: Do not run for targets which do not + support shared objects. + +2003-11-10 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/fileio.exp: Drop tests for nointerrupts and noinferiorio. + Don't run tests if nofileio flag is given. + +2003-11-07 Elena Zannoni <ezannoni@redhat.com> + + * gdb.cp/annota3.exp: Make sure we can match 'Hardware watchpoint' + as well as 'Watchpoint'. + +2003-11-06 Elena Zannoni <ezannoni@redhat.com> + + Reported by Jim Ingham <jingham@apple.com>: + * gdb.base/annota1.exp: Match at least one occurrence of the + signal handler annotation. + +2003-11-06 Elena Zannoni <ezannoni@redhat.com> + + * gdb.cp/annota2.exp: Make sure we can match 'Hardware watchpoint' + as well as 'Watchpoint'. + +2003-11-05 Michael Chastain <mec@shout.net> + + * gdb.mi/pthreads.c (routine): Handle early return from sleep. + +2003-11-03 Kris Warkentin <kewarken@qnx.com> + + * gdb.arch/gdb1291.c: New test file. + * gdb.arch/gdb1291.exp: New test script. + * gdb.arch/gdb1431.c: New test file. + * gdb.arch/gdb1431.exp: New test script. + +2003-10-22 Michael Chastain <mec@shout.net> + + * gdb.mi/pthreads.c: Add copyright notice. + +2003-10-22 Michael Chastain <mec@shout.net> + + * gdb.threads/pthreads.c: Add copyright notice. + +2003-10-20 Michael Chastain <mec@shout.net> + + * gdb.base/gdb1056.exp: New test script. + +2003-10-13 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/killed.exp: Use gdb_run_cmd. + +2003-10-13 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/gcore.exp: Issue an UNSUPPORTED and exit if we can't + create a core file. + * gdb.threads/gcore-thread.exp: Likewise. + +2003-10-13 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/call-rt-st.c (struct bit_flags_char_t): New bitfield + type, based on char type. + (struct bit_flags_short_t): New bitfield type, based on short type. + (init_bit_flags_char): New fuction. + (init_bit_flags_short): Ditto. + (print_bit_flags_char): Ditto. + (print_bit_flags_short): Ditto. + (main): Add handling for bit_flags_char_t and bit_flags_short_t. + +2003-10-11 Michael Chastain <mec@shout.net> + + * gdb.base/call-rt-st.exp: Update copyright year. + +2003-10-10 Kei Sakamoto <sakamoto.kei@renesas.com> + + * config/hmsirom.exp: Replace "Hitachi" with "Renesas". + * gdb.disasm/sh3.s: Ditto. + +2003-10-07 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/switch-threads.exp: New test. + * gdb.threads/switch-threads.c: New source file. + +2003-10-07 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/ending-run.exp: Add sh specific case. + +2003-10-06 Andrew Cagney <cagney@redhat.com> + + * gdb.base/watchpoint.exp: Delete obsolete clear_xfail. + * gdb.disasm/mn10200.exp: Delete obsolete file. + +2003-09-29 Daniel Jacobowitz <drow@mvista.com> + + * ChangeLog: Correct an entry command.exp -> commands.exp. + * gdb.base/commands.exp (bp_deleted_in_command_test) + (temporary_breakpoint_commands): Check noargs. + +2003-09-25 David Carlton <carlton@kealia.com> + + * gdb.cp/namespace.exp: Tweak comments. Add non-quoted versions + of some print tests, where appropriate. Add tests for C::D::cd, + E::ce, F::cXfX, G::XgX. + * gdb.cp/namespace.cc: Add XgX, cXfX, ce. + +2003-09-25 Richard Earnshaw <rearnsha@arm.com> + + * lib/java.exp (java_init): Import target_alias before using it. + +2003-09-25 David Carlton <carlton@kealia.com> + + * gdb.base/corefile.exp: Delete obsolete setup_xfail. + +2003-09-23 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/selftest.exp: Accomodate more instruction reordering + weirdness. + +2003-09-17 Michael Chastain <mec@shout.net> + + * gdb.cp/gdb1355.exp: New file. + * gdb.cp/gdb1355.c: New file. + 2003-09-15 Corinna Vinschen <vinschen@redhat.com> * gdb.asm/asm-source.exp: Add sh*-*-* as supported target. @@ -5,8 +129,8 @@ 2003-09-11 David Carlton <carlton@kealia.com> - * gdb.c++/namespace.exp: Add tests for namespace types. - * gdb.c++/maint.exp (test_help): Test 'help maint cp namespace'. + * gdb.cp/namespace.exp: Add tests for namespace types. + * gdb.cp/maint.exp (test_help): Test 'help maint cp namespace'. (test_namespace): New. 2003-09-11 Elena Zannoni <ezannoni@redhat.com> @@ -1556,7 +1680,7 @@ 2002-09-14 Corinna Vinschen <vinschen@redhat.com> - * gdb.base/command.exp: Don't expect a "Program exited normally" + * gdb.base/commands.exp: Don't expect a "Program exited normally" string after running the commands execution on breakpoint tests. 2002-09-13 Corinna Vinschen <vinschen@redhat.com> diff --git a/gdb/testsuite/config/hmsirom.exp b/gdb/testsuite/config/hmsirom.exp index 8c6e7da..0c53109 100644 --- a/gdb/testsuite/config/hmsirom.exp +++ b/gdb/testsuite/config/hmsirom.exp @@ -17,6 +17,6 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu -# Support for testing against a Hitachi SH3 target rom +# Support for testing against a Renesas SH3 target rom load_lib ../config/monitor.exp diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index c3ceac3..dc8ba29 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -296,7 +296,7 @@ match_max 3000 verbose "match_max now is: [match_max]" send_gdb "backtrace\n" gdb_expect { - -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)*\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" { + -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" { pass "backtrace @ signal handler" } -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" } diff --git a/gdb/testsuite/gdb.base/call-rt-st.c b/gdb/testsuite/gdb.base/call-rt-st.c index 712f70e..09dd5bb 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.c +++ b/gdb/testsuite/gdb.base/call-rt-st.c @@ -31,6 +31,28 @@ struct small_rep_info_t { int head; }; +/* 6 bits : really fits in 8 bits and is promoted to 8 bits + */ +struct bit_flags_char_t { + unsigned char alpha :1; + unsigned char beta :1; + unsigned char gamma :1; + unsigned char delta :1; + unsigned char epsilon :1; + unsigned char omega :1; +}; + +/* 6 bits : really fits in 8 bits and is promoted to 16 bits + */ +struct bit_flags_short_t { + unsigned short alpha :1; + unsigned short beta :1; + unsigned short gamma :1; + unsigned short delta :1; + unsigned short epsilon :1; + unsigned short omega :1; +}; + /* 6 bits : really fits in 8 bits and is promoted to 32 bits */ struct bit_flags_t { @@ -107,6 +129,90 @@ void loop_count () { } /***************************************************************** + * INIT_BIT_FLAGS_CHAR : + * Initializes a bit_flags_char_t structure. Can call this function see + * the call command behavior when integer arguments do not fit into + * registers and must be placed on the stack. + * OUT struct bit_flags_char_t *bit_flags -- structure to be filled + * IN unsigned a -- 0 or 1 + * IN unsigned b -- 0 or 1 + * IN unsigned g -- 0 or 1 + * IN unsigned d -- 0 or 1 + * IN unsigned e -- 0 or 1 + * IN unsigned o -- 0 or 1 + *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_char ( +struct bit_flags_char_t *bit_flags, +unsigned a, +unsigned b, +unsigned g, +unsigned d, +unsigned e, +unsigned o) +#else +void init_bit_flags_char (bit_flags,a,b,g,d,e,o) +struct bit_flags_char_t *bit_flags; +unsigned a; +unsigned b; +unsigned g; +unsigned d; +unsigned e; +unsigned o; +#endif +{ + + bit_flags->alpha = a; + bit_flags->beta = b; + bit_flags->gamma = g; + bit_flags->delta = d; + bit_flags->epsilon = e; + bit_flags->omega = o; +} + +/***************************************************************** + * INIT_BIT_FLAGS_SHORT : + * Initializes a bit_flags_short_t structure. Can call this function see + * the call command behavior when integer arguments do not fit into + * registers and must be placed on the stack. + * OUT struct bit_flags_short_t *bit_flags -- structure to be filled + * IN unsigned a -- 0 or 1 + * IN unsigned b -- 0 or 1 + * IN unsigned g -- 0 or 1 + * IN unsigned d -- 0 or 1 + * IN unsigned e -- 0 or 1 + * IN unsigned o -- 0 or 1 + *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_short ( +struct bit_flags_short_t *bit_flags, +unsigned a, +unsigned b, +unsigned g, +unsigned d, +unsigned e, +unsigned o) +#else +void init_bit_flags_short (bit_flags,a,b,g,d,e,o) +struct bit_flags_short_t *bit_flags; +unsigned a; +unsigned b; +unsigned g; +unsigned d; +unsigned e; +unsigned o; +#endif +{ + + bit_flags->alpha = a; + bit_flags->beta = b; + bit_flags->gamma = g; + bit_flags->delta = d; + bit_flags->epsilon = e; + bit_flags->omega = o; +} + +/***************************************************************** * INIT_BIT_FLAGS : * Initializes a bit_flags_t structure. Can call this function see * the call command behavior when integer arguments do not fit into @@ -345,6 +451,50 @@ int seed; } /***************************************************************** + * PRINT_BIT_FLAGS_CHAR : + * IN struct bit_flags_char_t bit_flags + ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_char_t print_bit_flags_char (struct bit_flags_char_t bit_flags) +#else +struct bit_flags_char_t print_bit_flags_char ( bit_flags) +struct bit_flags_char_t bit_flags; +#endif +{ + + if (bit_flags.alpha) printf("alpha\n"); + if (bit_flags.beta) printf("beta\n"); + if (bit_flags.gamma) printf("gamma\n"); + if (bit_flags.delta) printf("delta\n"); + if (bit_flags.epsilon) printf("epsilon\n"); + if (bit_flags.omega) printf("omega\n"); + return bit_flags; + +} + +/***************************************************************** + * PRINT_BIT_FLAGS_SHORT : + * IN struct bit_flags_short_t bit_flags + ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_short_t print_bit_flags_short (struct bit_flags_short_t bit_flags) +#else +struct bit_flags_short_t print_bit_flags_short ( bit_flags) +struct bit_flags_short_t bit_flags; +#endif +{ + + if (bit_flags.alpha) printf("alpha\n"); + if (bit_flags.beta) printf("beta\n"); + if (bit_flags.gamma) printf("gamma\n"); + if (bit_flags.delta) printf("delta\n"); + if (bit_flags.epsilon) printf("epsilon\n"); + if (bit_flags.omega) printf("omega\n"); + return bit_flags; + +} + +/***************************************************************** * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/ @@ -553,6 +703,8 @@ int main () { /* variables for testing a small structures and a very long argument list */ struct small_rep_info_t *struct1; + struct bit_flags_char_t *cflags; + struct bit_flags_short_t *sflags; struct bit_flags_t *flags; struct bit_flags_combo_t *flags_combo; struct three_char_t *three_char; @@ -577,6 +729,8 @@ int main () { /* Allocate space for small structures */ struct1 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t)); + cflags = (struct bit_flags_char_t *)malloc(sizeof(struct bit_flags_char_t)); + sflags = (struct bit_flags_short_t *)malloc(sizeof(struct bit_flags_short_t)); flags = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t)); flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t)); three_char = (struct three_char_t *)malloc(sizeof(struct three_char_t)); @@ -590,6 +744,10 @@ int main () { */ init_one_double ( d1, 1.11111); init_two_floats ( f3, -2.345, 1.0); + init_bit_flags_char(cflags, (unsigned)1, (unsigned)0, (unsigned)1, + (unsigned)0, (unsigned)1, (unsigned)0 ); + init_bit_flags_short(sflags, (unsigned)1, (unsigned)0, (unsigned)1, + (unsigned)0, (unsigned)1, (unsigned)0 ); init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, (unsigned)0, (unsigned)1, (unsigned)0 ); init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y', @@ -605,6 +763,8 @@ int main () { */ print_one_double(*d1); print_two_floats(*f3); + print_bit_flags_char(*cflags); + print_bit_flags_short(*sflags); print_bit_flags(*flags); print_bit_flags_combo(*flags_combo); print_three_chars(*three_char); diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 0acd139..39242fd 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -114,13 +114,13 @@ if ![runto_main] then { gdb_test "break loop_count" \ - "Breakpoint.* file .*call-rt-st.c, line 106\\." \ + "Breakpoint.* file .*call-rt-st.c, line 128\\." \ "breakpoint loop_count" send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+106\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" { + -re "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" { pass "continue to loop_count"} -re ".*$gdb_prompt $" { fail "continue to loop_count"} timeout { fail "(timeout) continue to loop_count"} @@ -128,11 +128,11 @@ 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:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" { + pass "finish out from loop_count (line 777)" } - -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 "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:775\[ \t\r\n\]+775\[\t \]+loop_count.*$gdb_prompt $" { + pass "finish out from loop_count (line 775)" } -re ".*$gdb_prompt $" { fail "finish out from loop_count" @@ -191,6 +191,16 @@ if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \ ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}" } +if ![gdb_skip_stdio_test "print print_bit_flags_char(*flags)"] { + print_struct_call "print_bit_flags_char(*flags)" \ + ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\0', gamma = 1 '\\\\001', delta = 0 '\\\\0', epsilon = 1 '\\\\001', omega = 0 '\\\\0'\\}" +} + +if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] { + print_struct_call "print_bit_flags_short(*flags)" \ + ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}" +} + if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] { print_struct_call "print_bit_flags(*flags)" \ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}" diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index d35353d..93ddd7e 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -1,5 +1,5 @@ # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1997, 1998, 1999, 2000, -# 2001 Free Software Foundation, Inc. +# 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -443,6 +443,11 @@ proc deprecated_command_test {} { proc bp_deleted_in_command_test {} { global gdb_prompt + if [target_info exists noargs] { + verbose "Skipping bp_deleted_in_command_test because of noargs." + return + } + gdb_test "set args 1" "" "set args in bp_deleted_in_command_test" delete_breakpoints @@ -504,6 +509,11 @@ proc bp_deleted_in_command_test {} { proc temporary_breakpoint_commands {} { global gdb_prompt + if [target_info exists noargs] { + verbose "Skipping temporary_breakpoint_commands because of noargs." + return + } + gdb_test "set args 1" "" "set args in temporary_breakpoint_commands" delete_breakpoints diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index d059ef5..d41ea7e 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -244,7 +244,6 @@ gdb_expect { # test reinit_frame_cache gdb_load ${binfile} -setup_xfail "*-*-*" CLLbs17002 gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)" gdb_test "core" "No core file now." diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 3960f06..af32acd 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -202,6 +202,11 @@ gdb_expect { -re ".*in __wrap__?main ().*$gdb_prompt $" { pass "step out of main (status wrapper)" } + -re "__setup_argv_for_main (.*).*$gdb_prompt $" { + # On sh, another wrapper function (start_l) exists, so + # another `next' is necessary. + gdb_test "next" ".*in start_l ().*" "step out of main (on sh)" + } -re ".*$gdb_prompt $" { fail "step out of main (at end 2)" } timeout { fail "step out of main (hang or timeout on step at end 2)" diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp index 98c64db8..128cbb6 100644 --- a/gdb/testsuite/gdb.base/fileio.exp +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -1,4 +1,4 @@ -# Copyright 2002 +# Copyright 2002, 2003 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -20,16 +20,11 @@ # This file was written by Corinna Vinschen <vinschen@redhat.com> -if [target_info exists gdb,nointerrupts] { - verbose "Skipping interrupt.exp because of nointerrupts." +if [target_info exists gdb,nofileio] { + verbose "Skipping fileio.exp because of no fileio capabilities." continue } -if [target_info exists gdb,noinferiorio] { - verbose "Skipping interrupt.exp because of noinferiorio." - return -} - if $tracelevel then { strace $tracelevel } diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp index 8c0ae8e..0576638 100644 --- a/gdb/testsuite/gdb.base/gcore.exp +++ b/gdb/testsuite/gdb.base/gcore.exp @@ -1,4 +1,4 @@ -# 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 @@ -106,9 +106,25 @@ set pre_corefile_extern_array \ set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test] -gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ - "Saved corefile ${escapedfilename}" \ - "save a corefile" +gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \ + "save a corefile" \ +{ + -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { + pass "save a corefile" + global core_supported + set core_supported 1 + } + -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { + unsupported "save a corefile" + global core_supported + set core_supported 0 + } +} + +global core_supported +if {!$core_supported} { + return -1 +} # Now restart gdb and load the corefile. gdb_exit diff --git a/gdb/testsuite/gdb.base/selftest.exp b/gdb/testsuite/gdb.base/selftest.exp index 9e1d4dd..442adb9 100644 --- a/gdb/testsuite/gdb.base/selftest.exp +++ b/gdb/testsuite/gdb.base/selftest.exp @@ -342,6 +342,11 @@ proc test_with_self { executable } { send_gdb "step\n" exp_continue } + -re ".*cmdarg = .* xmalloc.*$gdb_prompt $" { + set stepped_back 1 + send_gdb "step\n" + exp_continue + } -re "dirsize = 1;.*$gdb_prompt $" { set stepped_back 1 send_gdb "step\n" diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp index ac48774..55ec1e7 100644 --- a/gdb/testsuite/gdb.base/shreloc.exp +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -23,6 +23,11 @@ # them gets relocated at load-time. Check that gdb gets the right # values for the debugging and minimal symbols. +if {[istarget *-elf*] || [istarget *-coff] || [istarget *-aout]} then { + verbose "test skipped - shared object files not supported by this target." + return 0 +} + if $tracelevel then { strace $tracelevel } diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index fd5d8f2..58b3527 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -394,7 +394,6 @@ proc test_stepping {} { clear_xfail "sparc-*-*" clear_xfail "hppa*-*-*bsd*" # It works with the generic inferior function calling code too. - # OBSOLETE clear_xfail "mn10200*-*-*" clear_xfail "mn10300*-*-*" # The following architectures define CALL_DUMMY_HAS_COMPLETED. clear_xfail "hppa*-*-*hpux*" diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index 0446eb3..f4f2433 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -193,7 +193,7 @@ gdb_expect { # send_gdb "next\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032watchpoint 3\r\nWatchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ { pass "watch triggered on a.x" } -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032watchpoint 3\r\n\.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \ { pass "watch triggered on a.x" } diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp index 431ed4f..c75a289 100644 --- a/gdb/testsuite/gdb.cp/annota3.exp +++ b/gdb/testsuite/gdb.cp/annota3.exp @@ -196,7 +196,7 @@ gdb_expect_list "set watch on a.x" "$gdb_prompt$" { # send_gdb "next\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\(\r\n\032\032frames-invalid\r\n\)+\r\n\032\032watchpoint 3\r\nWatchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\nmain \\(\\) at .*$srcfile:$decimal\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\(\r\n\032\032frames-invalid\r\n\)+\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\nmain \\(\\) at .*$srcfile:$decimal\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" { pass "watch triggered on a.x" } -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index 5bf976b..1eb24c1 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -89,6 +89,11 @@ gdb_test "up" ".*main.*" "up from marker1" # I'm including versions both with and without quotes; for tests that # shouldn't work with quotes, I'm only including one version. +# NOTE: carlton/2003-09-24: the quotes are becoming less necessary (or +# even desirable.) For tests where it should still work with quotes, +# I'm including versions both with and without quotes; for tests that +# shouldn't work with quotes, I'm only including one version. + send_gdb "print 'AAA::c'\n" gdb_expect { -re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print 'AAA::c'" } diff --git a/gdb/testsuite/gdb.disasm/mn10200.exp b/gdb/testsuite/gdb.disasm/mn10200.exp deleted file mode 100644 index a47b341..0000000 --- a/gdb/testsuite/gdb.disasm/mn10200.exp +++ /dev/null @@ -1,478 +0,0 @@ -# OBSOLETE -# OBSOLETE # Copyright 1997 Free Software Foundation, Inc. -# 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, Boston, MA 02111-1307, USA. -# OBSOLETE -# OBSOLETE # Please email any bugs, comments, and/or additions to this file to: -# OBSOLETE # bug-gdb@prep.ai.mit.edu -# OBSOLETE -# OBSOLETE # This file was written by Jeff Law. (law@cygnus.com) -# OBSOLETE -# OBSOLETE if $tracelevel then { -# OBSOLETE strace $tracelevel -# OBSOLETE } -# OBSOLETE -# OBSOLETE if ![istarget "mn10200*-*-*"] { -# OBSOLETE verbose "Tests ignored for all but mn10200 based targets." -# OBSOLETE return -# OBSOLETE } -# OBSOLETE -# OBSOLETE global exec_output -# OBSOLETE set prms_id 0 -# OBSOLETE set bug_id 0 -# OBSOLETE -# OBSOLETE set testfile "mn10200" -# OBSOLETE set srcfile ${srcdir}/${subdir}/${testfile}.s -# OBSOLETE set binfile ${objdir}/${subdir}/${testfile} -# OBSOLETE if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } { -# OBSOLETE gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc add_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/12i add_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*add d1,d2.* -# OBSOLETE .*add d2,a3.* -# OBSOLETE .*add a2,d1.* -# OBSOLETE .*add a3,a2.* -# OBSOLETE .*add 16,d1.* -# OBSOLETE .*add 256,d2.* -# OBSOLETE .*add 131071,d3.* -# OBSOLETE .*add 16,a1.* -# OBSOLETE .*add 256,a2.* -# OBSOLETE .*add 131071,a3.* -# OBSOLETE .*addc d1,d2.* -# OBSOLETE .*addnf 16,a2.* -# OBSOLETE .*$gdb_prompt $" { pass "add tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "add tests" } -# OBSOLETE timeout { fail "(timeout) add tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc bcc_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/15i bCC_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*beq 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bne 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bgt 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bge 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*ble 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*blt 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bhi 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bcc 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bls 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bcs 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bvc 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bvs 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bnc 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bns 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*bra 0x\[0-9a-f]+ <bCC_tests>.* -# OBSOLETE .*$gdb_prompt $" { pass "bCC tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "bCC tests" } -# OBSOLETE timeout { fail "(timeout) bCC tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc bccx_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/14i bCCx_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*beqx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bnex 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bgtx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bgex 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*blex 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bltx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bhix 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bccx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*blsx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bcsx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bvcx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bvsx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bncx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*bnsx 0x\[0-9a-f]+ <bCCx_tests>.* -# OBSOLETE .*$gdb_prompt $" { pass "bCCx tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "bCCx tests" } -# OBSOLETE timeout { fail "(timeout) bCCx tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc bit_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/4 bit_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*btst 64,d1.* -# OBSOLETE .*btst 8192,d2.* -# OBSOLETE .*bset d1,\\(a2\\).* -# OBSOLETE .*bclr d1,\\(a2\\).* -# OBSOLETE .*$gdb_prompt $" { pass "bit tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "bit tests" } -# OBSOLETE timeout { fail "(timeout) bit tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc cmp_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/9i cmp_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*cmp d1,d2.* -# OBSOLETE .*cmp d2,a3.* -# OBSOLETE .*cmp a3,d3.* -# OBSOLETE .*cmp a3,a2.* -# OBSOLETE .*cmp 16,d3.* -# OBSOLETE .*cmp 256,d2.* -# OBSOLETE .*cmp 131071,d1.* -# OBSOLETE .*cmp 256,a2.* -# OBSOLETE .*cmp 131071,a1.* -# OBSOLETE .*$gdb_prompt $" { pass "cmp tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "cmp tests" } -# OBSOLETE timeout { fail "(timeout) cmp tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc extend_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/5i extend_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*ext d1.* -# OBSOLETE .*extx d2.* -# OBSOLETE .*extxu d3.* -# OBSOLETE .*extxb d2.* -# OBSOLETE .*extxbu d1.* -# OBSOLETE .*$gdb_prompt $" { pass "extend tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "extend tests" } -# OBSOLETE timeout { fail "(timeout) extend tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc logical_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/11i logical_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*and d1,d2.* -# OBSOLETE .*and 127,d2.* -# OBSOLETE .*and 32767,d3.* -# OBSOLETE .*and 32767,psw.* -# OBSOLETE .*or d1,d2.* -# OBSOLETE .*or 127,d2.* -# OBSOLETE .*or 32767,d3.* -# OBSOLETE .*or 32767,psw.* -# OBSOLETE .*xor d1,d2.* -# OBSOLETE .*xor 32767,d3.* -# OBSOLETE .*not d3.* -# OBSOLETE .*$gdb_prompt $" { pass "logical tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "logical tests" } -# OBSOLETE timeout { fail "(timeout) logical tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc mov_tests_1 { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/12i mov_tests_1\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*mov d1,a2.* -# OBSOLETE .*mov a2,d1.* -# OBSOLETE .*mov d1,d2.* -# OBSOLETE .*mov a2,a1.* -# OBSOLETE .*mov psw,d3.* -# OBSOLETE .*mov d2,psw.* -# OBSOLETE .*mov mdr,d1.* -# OBSOLETE .*mov d2,mdr.* -# OBSOLETE .*mov \\(a2\\),d1.* -# OBSOLETE .*mov \\(8,a2\\),d1.* -# OBSOLETE .*mov \\(256,a2\\),d1.* -# OBSOLETE .*mov \\(131071,a2\\),d1.* -# OBSOLETE .*$gdb_prompt $" { pass "mov1 tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "mov1 tests" } -# OBSOLETE timeout { fail "(timeout) mov1 tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc mov_tests_2 { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/9 mov_tests_2\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*mov \\(d1,a1\\),d2.* -# OBSOLETE .*mov \\(0x8000.*\\),d1.* -# OBSOLETE .*mov \\(0x1ffff.*\\),d1.* -# OBSOLETE .*mov \\(8,a2\\),a1.* -# OBSOLETE .*mov \\(256,a2\\),a1.* -# OBSOLETE .*mov \\(131071,a2\\),a1.* -# OBSOLETE .*mov \\(d1,a1\\),a2.* -# OBSOLETE .*mov \\(0x8000.*\\),a1.* -# OBSOLETE .*mov \\(0x1ffff.*\\),a1.* -# OBSOLETE .*$gdb_prompt $" { pass "mov2 tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "mov2 tests" } -# OBSOLETE timeout { fail "(timeout) mov2 tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc mov_tests_3 { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/10 mov_tests_3\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*mov d1,\\(a2\\).* -# OBSOLETE .*mov d1,\\(32,a2\\).* -# OBSOLETE .*mov d1,\\(256,a2\\).* -# OBSOLETE .*mov d1,\\(131071,a2\\).* -# OBSOLETE .*mov d1,\\(d2,a2\\).* -# OBSOLETE .*mov d1,\\(0x80.*\\).* -# OBSOLETE .*mov d1,\\(0x1ffff.*\\).* -# OBSOLETE .*mov a1,\\(32,a2\\).* -# OBSOLETE .*mov a1,\\(256,a2\\).* -# OBSOLETE .*mov a1,\\(131071,a2\\).* -# OBSOLETE .*$gdb_prompt $" { pass "mov3 tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "mov3 tests" } -# OBSOLETE timeout { fail "(timeout) mov3 tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc mov_tests_4 { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/8 mov_tests_4\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*mov a1,\\(d2,a2\\).* -# OBSOLETE .*mov a1,\\(0x80.*\\).* -# OBSOLETE .*mov a1,\\(0x1ffff.*\\).* -# OBSOLETE .*mov 8,d1.* -# OBSOLETE .*mov 256,d1.* -# OBSOLETE .*mov 131071,d1.* -# OBSOLETE .*mov 256,a1.* -# OBSOLETE .*mov 131071,a1.* -# OBSOLETE .*$gdb_prompt $" { pass "mov4 tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "mov4 tests" } -# OBSOLETE timeout { fail "(timeout) mov4 tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc movb_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/12 movb_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*movb \\(8,a2\\),d1.* -# OBSOLETE .*movb \\(256,a2\\),d1.* -# OBSOLETE .*movb \\(131071,a2\\),d1.* -# OBSOLETE .*movb \\(d2,a2\\),d3.* -# OBSOLETE .*movb \\(0x1ffff.*\\),d2.* -# OBSOLETE .*movb d1,\\(a2\\).* -# OBSOLETE .*movb d1,\\(8,a2\\).* -# OBSOLETE .*movb d1,\\(256,a2\\).* -# OBSOLETE .*movb d1,\\(131071,a2\\).* -# OBSOLETE .*movb d1,\\(d2,a2\\).* -# OBSOLETE .*movb d1,\\(0x100.*\\).* -# OBSOLETE .*movb d1,\\(0x1ffff.*\\).* -# OBSOLETE .*$gdb_prompt $" { pass "movb tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "movb tests" } -# OBSOLETE timeout { fail "(timeout) movb tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc movbu_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/7 movbu_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*movbu \\(a2\\),d1.* -# OBSOLETE .*movbu \\(8,a2\\),d1.* -# OBSOLETE .*movbu \\(256,a2\\),d1.* -# OBSOLETE .*movbu \\(131071,a2\\),d1.* -# OBSOLETE .*movbu \\(d1,a1\\),d2.* -# OBSOLETE .*movbu \\(0x8000.*\\),d1.* -# OBSOLETE .*movbu \\(0x1ffff.*\\),d1.* -# OBSOLETE .*$gdb_prompt $" { pass "movbu tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "movbu tests" } -# OBSOLETE timeout { fail "(timeout) movbu tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc movx_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/6 movx_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*movx \\(8,a2\\),d1.* -# OBSOLETE .*movx \\(256,a2\\),d1.* -# OBSOLETE .*movx \\(131071,a2\\),d1.* -# OBSOLETE .*movx d1,\\(8,a2\\).* -# OBSOLETE .*movx d1,\\(256,a2\\).* -# OBSOLETE .*movx d1,\\(131071,a2\\).* -# OBSOLETE .*$gdb_prompt $" { pass "movx tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "movx tests" } -# OBSOLETE timeout { fail "(timeout) movx tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc muldiv_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/3 muldiv_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*mul d1,d2.* -# OBSOLETE .*mulu d2,d3.* -# OBSOLETE .*divu d3,d2.* -# OBSOLETE .*$gdb_prompt $" { pass "muldiv tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "muldiv tests" } -# OBSOLETE timeout { fail "(timeout) muldiv tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc misc_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/9 misc_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*jmp 0x\[0-9a-f]+ <main>.* -# OBSOLETE .*jmp 0x\[0-9a-f]+ <start>.* -# OBSOLETE .*jmp \\(a2\\).* -# OBSOLETE .*jsr 0x\[0-9a-f]+ <main>.* -# OBSOLETE .*jsr 0x\[0-9a-f]+ <start>.* -# OBSOLETE .*jsr \\(a2\\).* -# OBSOLETE .*rts.* -# OBSOLETE .*rti.* -# OBSOLETE .*nop.* -# OBSOLETE .*$gdb_prompt $" { pass "misc tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "misc tests" } -# OBSOLETE timeout { fail "(timeout) misc tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc shift_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/4i shift_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*asr d2.* -# OBSOLETE .*lsr d3.* -# OBSOLETE .*ror d1.* -# OBSOLETE .*rol d2.* -# OBSOLETE .*$gdb_prompt $" { pass "shift tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "shift tests" } -# OBSOLETE timeout { fail "(timeout) shift tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE proc sub_tests { } { -# OBSOLETE global gdb_prompt -# OBSOLETE global hex -# OBSOLETE global decimal -# OBSOLETE -# OBSOLETE send_gdb "x/9i sub_tests\n" -# OBSOLETE gdb_expect { -# OBSOLETE -re " -# OBSOLETE .*sub d1,d2.* -# OBSOLETE .*sub d2,a3.* -# OBSOLETE .*sub a3,d3.* -# OBSOLETE .*sub a3,a2.* -# OBSOLETE .*sub 32767,d2.* -# OBSOLETE .*sub 131071,d2.* -# OBSOLETE .*sub 32767,a2.* -# OBSOLETE .*sub 131071,a2.* -# OBSOLETE .*subc d1,d2.* -# OBSOLETE .*$gdb_prompt $" { pass "sub tests" } -# OBSOLETE -re "$gdb_prompt $" { fail "sub tests" } -# OBSOLETE timeout { fail "(timeout) sub tests" } -# OBSOLETE } -# OBSOLETE } -# OBSOLETE -# OBSOLETE # Start with a fresh gdb. -# OBSOLETE -# OBSOLETE gdb_exit -# OBSOLETE gdb_start -# OBSOLETE gdb_reinitialize_dir $srcdir/$subdir -# OBSOLETE gdb_load $binfile -# OBSOLETE -# OBSOLETE add_tests -# OBSOLETE bcc_tests -# OBSOLETE bccx_tests -# OBSOLETE bit_tests -# OBSOLETE cmp_tests -# OBSOLETE extend_tests -# OBSOLETE logical_tests -# OBSOLETE mov_tests_1 -# OBSOLETE mov_tests_2 -# OBSOLETE mov_tests_3 -# OBSOLETE mov_tests_4 -# OBSOLETE movb_tests -# OBSOLETE movbu_tests -# OBSOLETE movx_tests -# OBSOLETE muldiv_tests -# OBSOLETE misc_tests -# OBSOLETE shift_tests -# OBSOLETE sub_tests diff --git a/gdb/testsuite/gdb.disasm/sh3.s b/gdb/testsuite/gdb.disasm/sh3.s index 8bab256..e5969f5 100644 --- a/gdb/testsuite/gdb.disasm/sh3.s +++ b/gdb/testsuite/gdb.disasm/sh3.s @@ -1,7 +1,7 @@ .file "test.c" .data -! Hitachi SH cc1 (cygnus-2.7.1-950728) arguments: -O -fpeephole +! Renesas SH cc1 (cygnus-2.7.1-950728) arguments: -O -fpeephole ! -ffunction-cse -freg-struct-return -fdelayed-branch -fcommon -fgnu-linker gcc2_compiled.: diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c index 1ba5a15..b73b023 100644 --- a/gdb/testsuite/gdb.mi/pthreads.c +++ b/gdb/testsuite/gdb.mi/pthreads.c @@ -1,3 +1,28 @@ +/* Pthreads test program. + Copyright 1996, 2002, 2003 + Free Software Foundation, Inc. + + Written by Keith Seitz of Red Hat. + Copied from gdb.threads/pthreads.c. + Contributed by Red Hat. + + 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 <stdio.h> #include <pthread.h> @@ -17,7 +42,14 @@ static pthread_attr_t null_attr; void * routine (void *arg) { - sleep (9); + /* When gdb is running, it sets hidden breakpoints in the thread + library. The signals caused by these hidden breakpoints can + cause system calls such as 'sleep' to return early. Pay attention + to the return value from 'sleep' to get the full sleep. */ + int unslept = 9; + while (unslept > 0) + unslept = sleep (unslept); + printf ("hello thread\n"); } diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 5cb80bd..40c9ada 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -105,9 +105,25 @@ gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running" set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test] # Drop corefile -gdb_test "gcore ${objdir}/${subdir}/gcore.test" \ - "Saved corefile ${escapedfilename}" \ - "save a corefile" +gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \ + "save a corefile" \ +{ + -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { + pass "save a corefile" + global core_supported + set core_supported 1 + } + -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { + unsupported "save a corefile" + global core_supported + set core_supported 0 + } +} + +global core_supported +if {!$core_supported} { + return -1 +} # Now restart gdb and load the corefile. gdb_exit diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp index 2e61e7c..1948375 100644 --- a/gdb/testsuite/gdb.threads/killed.exp +++ b/gdb/testsuite/gdb.threads/killed.exp @@ -75,7 +75,15 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test "run" "" "run program to completion" +gdb_run_cmd +gdb_expect { + -re "$gdb_prompt $" { + pass "run program to completion" + } + timeout "$gdb_prompt $" { + fail "run program to completion (timeout)" + } +} # Try to quit. send_gdb "quit\n" diff --git a/gdb/testsuite/gdb.threads/pthreads.c b/gdb/testsuite/gdb.threads/pthreads.c index fdc0324..d82d550 100644 --- a/gdb/testsuite/gdb.threads/pthreads.c +++ b/gdb/testsuite/gdb.threads/pthreads.c @@ -1,3 +1,27 @@ +/* Pthreads test program. + Copyright 1996, 2002, 2003 + Free Software Foundation, Inc. + + Written by Fred Fish of Cygnus Support + Contributed by Cygnus Support + + 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 <stdio.h> #include <pthread.h> diff --git a/gdb/testsuite/lib/java.exp b/gdb/testsuite/lib/java.exp index bcfd27c..5c1432f 100644 --- a/gdb/testsuite/lib/java.exp +++ b/gdb/testsuite/lib/java.exp @@ -33,6 +33,7 @@ proc java_init { args } { set GCJ_UNDER_TEST $env(GCJ) } else { global tool_root_dir + global target_alias if ![is_remote host] { set file [lookfor_file $tool_root_dir gcj]; @@ -147,7 +147,7 @@ int baud_rate = -1; In mid-1996, remote_timeout was moved from remote.c to top.c and it began being used in other remote-* targets. It appears that the default was changed to 20 seconds at that time, perhaps because the - Hitachi E7000 ICE didn't always respond in a timely manner. + Renesas E7000 ICE didn't always respond in a timely manner. But if 5 seconds is a long time to sit and wait for retransmissions, 20 seconds is far worse. This demonstrates the difficulty of using @@ -669,10 +669,10 @@ execute_command (char *p, int from_tty) /* If the target is running, we allow only a limited set of commands. */ if (event_loop_p && target_can_async_p () && target_executing) - if (!strcmp (c->name, "help") - && !strcmp (c->name, "pwd") - && !strcmp (c->name, "show") - && !strcmp (c->name, "stop")) + if (strcmp (c->name, "help") != 0 + && strcmp (c->name, "pwd") != 0 + && strcmp (c->name, "show") != 0 + && strcmp (c->name, "stop") != 0) error ("Cannot execute this command while the target is running."); /* Pass null arg rather than an empty one. */ @@ -1266,7 +1266,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) #define SERVER_COMMAND_LENGTH 7 server_command = (p - linebuffer > SERVER_COMMAND_LENGTH) - && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); + && strncmp (linebuffer, "server ", SERVER_COMMAND_LENGTH) == 0; if (server_command) { /* Note that we don't set `line'. Between this and the check in @@ -1375,7 +1375,7 @@ There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" /* After the required info we print the configuration information. */ fprintf_filtered (stream, "This GDB was configured as \""); - if (!STREQ (host_name, target_name)) + if (strcmp (host_name, target_name) != 0) { fprintf_filtered (stream, "--host=%s --target=%s", host_name, target_name); } @@ -1461,7 +1461,7 @@ quit_target (void *arg) } /* UDI wants this, to kill the TIP. */ - target_close (1); + target_close (¤t_target, 1); /* Save the history information if it is appropriate to do so. */ if (write_history_p && history_filename) @@ -1478,6 +1478,7 @@ void quit_force (char *args, int from_tty) { int exit_code = 0; + struct qt_args qt; /* An optional expression may be used to cause gdb to terminate with the value of that expression. */ @@ -1488,8 +1489,11 @@ quit_force (char *args, int from_tty) exit_code = (int) value_as_long (val); } + qt.args = args; + qt.from_tty = from_tty; + /* We want to handle any quit errors and exit regardless. */ - catch_errors (quit_target, args, + catch_errors (quit_target, &qt, "Quitting: ", RETURN_MASK_ALL); exit (exit_code); @@ -1504,7 +1508,6 @@ input_from_terminal_p (void) return gdb_has_a_terminal () && (instream == stdin) & caution; } -/* ARGSUSED */ static void dont_repeat_command (char *ignored, int from_tty) { @@ -1590,7 +1593,6 @@ show_commands (char *args, int from_tty) } /* Called by do_setshow_command. */ -/* ARGSUSED */ static void set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) { @@ -1605,7 +1607,6 @@ set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) } } -/* ARGSUSED */ void set_history (char *args, int from_tty) { @@ -1613,7 +1614,6 @@ set_history (char *args, int from_tty) help_list (sethistlist, "set history ", -1, gdb_stdout); } -/* ARGSUSED */ void show_history (char *args, int from_tty) { @@ -1623,7 +1623,6 @@ show_history (char *args, int from_tty) int info_verbose = 0; /* Default verbose msgs off */ /* Called by do_setshow_command. An elaborate joke. */ -/* ARGSUSED */ void set_verbose (char *args, int from_tty, struct cmd_list_element *c) { @@ -1720,8 +1719,7 @@ init_main (void) /* Setup important stuff for command line editing. */ rl_completion_entry_function = readline_line_completion_function; - rl_completer_word_break_characters = - get_gdb_completer_word_break_characters (); + rl_completer_word_break_characters = default_word_break_characters (); rl_completer_quote_characters = get_gdb_completer_quote_characters (); rl_readline_name = "gdb"; rl_terminal_name = getenv ("TERM"); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 8ac7581..272e944 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1215,7 +1215,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym, /* check for doubles stored in two registers */ /* FIXME: how about larger types stored in 3 or more regs? */ if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT && - len > REGISTER_RAW_SIZE (reg)) + len > DEPRECATED_REGISTER_RAW_SIZE (reg)) add_register (collect, reg + 1); break; case LOC_REF_ARG: diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 68386a4..fc5886c 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,8 @@ +2003-09-27 Andrew Cagney <cagney@redhat.com> + + * tuiRegs.c: Rename REGISTER_RAW_SIZE to + DEPRECATED_REGISTER_RAW_SIZE. + 2003-09-13 Andrew Cagney <cagney@redhat.com> * tui.h (struct ui_file): Add opaque declaration. diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index e1be56a..1c2af68 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -119,7 +119,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols, if (nr_rows == 0) data->suppress_output = 1; else - /* Only the table suppresses the output and, fortunatly, a table + /* Only the table suppresses the output and, fortunately, a table is not a recursive data structure. */ gdb_assert (data->suppress_output == 0); } diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 9f0b1a4..3a0c459 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -500,7 +500,7 @@ tuiCheckRegisterValues (struct frame_info *frame) { int size; - size = REGISTER_RAW_SIZE (dataElementPtr->itemNo); + size = DEPRECATED_REGISTER_RAW_SIZE (dataElementPtr->itemNo); for (j = 0; j < size; j++) ((char *) dataElementPtr->value)[j] = rawBuf[j]; _tuiDisplayRegister ( @@ -763,7 +763,7 @@ _tuiRegValueHasChanged (TuiDataElementPtr dataElement, if (_tuiGetRegisterRawValue ( dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS) { - int size = REGISTER_RAW_SIZE (dataElement->itemNo); + int size = DEPRECATED_REGISTER_RAW_SIZE (dataElement->itemNo); for (i = 0; (i < size && !hasChanged); i++) hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]); @@ -790,7 +790,7 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) if (target_has_registers) { - frame_read_register (frame, regNum, regValue); + get_frame_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. */ diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 9b514bf..799aa4c 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -173,7 +173,6 @@ whatis_exp (char *exp, int show) do_cleanups (old_chain); } -/* ARGSUSED */ static void whatis_command (char *exp, int from_tty) { @@ -200,7 +199,6 @@ ptype_eval (struct expression *exp) /* TYPENAME is either the name of a type, or an expression. */ -/* ARGSUSED */ static void ptype_command (char *typename, int from_tty) { diff --git a/gdb/utils.c b/gdb/utils.c index 9ba67a7..701277e 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -427,7 +427,6 @@ free_current_contents (void *ptr) In such cases, we may not be certain where the first cleanup is, unless we have a do-nothing one to always use as the base. */ -/* ARGSUSED */ void null_cleanup (void *arg) { @@ -1684,7 +1683,6 @@ set_width (void) wrap_pointer = wrap_buffer; /* Start it at the beginning. */ } -/* ARGSUSED */ static void set_width_command (char *args, int from_tty, struct cmd_list_element *c) { @@ -1692,7 +1690,6 @@ set_width_command (char *args, int from_tty, struct cmd_list_element *c) set_width (); } -/* ARGSUSED */ static void set_height_command (char *args, int from_tty, struct cmd_list_element *c) { @@ -2930,3 +2927,19 @@ gnu_debuglink_crc32 (unsigned long crc, unsigned char *buf, size_t len) crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); return ~crc & 0xffffffff;; } + +ULONGEST +align_up (ULONGEST v, int n) +{ + /* Check that N is really a power of two. */ + gdb_assert (n && (n & (n-1)) == 0); + return (v + n - 1) & -n; +} + +ULONGEST +align_down (ULONGEST v, int n) +{ + /* Check that N is really a power of two. */ + gdb_assert (n && (n & (n-1)) == 0); + return (v & -n); +} diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 2b239b6..a9ca9dd 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -810,8 +810,8 @@ v850_find_callers_reg (struct frame_info *fi, int regnum) get_frame_base (fi))) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), regnum); - else if (get_frame_saved_regs (fi)[regnum] != 0) - return read_memory_unsigned_integer (get_frame_saved_regs (fi)[regnum], + else if (deprecated_get_frame_saved_regs (fi)[regnum] != 0) + return read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[regnum], v850_register_raw_size (regnum)); return read_register (regnum); @@ -900,9 +900,9 @@ v850_pop_frame (void) 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) + if (deprecated_get_frame_saved_regs (frame)[regnum] != 0) write_register (regnum, - read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum], + read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], v850_register_raw_size (regnum))); write_register (E_SP_REGNUM, get_frame_base (frame)); @@ -1074,7 +1074,7 @@ v850_extract_return_value (struct type *type, char *regbuf, char *valbuf) pointed to by R6. */ return_buffer = extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (E_V0_REGNUM), - REGISTER_RAW_SIZE (E_V0_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (E_V0_REGNUM)); read_memory (return_buffer, valbuf, TYPE_LENGTH (type)); } @@ -1117,7 +1117,7 @@ v850_frame_init_saved_regs (struct frame_info *fi) struct pifsr pifsrs[E_NUM_REGS + 1], *pifsr; CORE_ADDR func_addr, func_end; - if (!get_frame_saved_regs (fi)) + if (!deprecated_get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -1140,10 +1140,10 @@ v850_frame_init_saved_regs (struct frame_info *fi) for (pifsr = pifsrs; pifsr->framereg; pifsr++) { - get_frame_saved_regs (fi)[pifsr->reg] = pifsr->offset + get_frame_base (fi); + deprecated_get_frame_saved_regs (fi)[pifsr->reg] = pifsr->offset + get_frame_base (fi); if (pifsr->framereg == E_SP_REGNUM) - get_frame_saved_regs (fi)[pifsr->reg] += pi.frameoffset; + deprecated_get_frame_saved_regs (fi)[pifsr->reg] += pi.frameoffset; } } /* Else we're out of luck (can't debug completely stripped code). @@ -1213,7 +1213,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); for (i = 0; v850_processor_type_table[i].regnames != NULL; i++) { diff --git a/gdb/v850ice.c b/gdb/v850ice.c index bb1385a..9f516a3 100644 --- a/gdb/v850ice.c +++ b/gdb/v850ice.c @@ -371,7 +371,6 @@ v850ice_open (char *name, int from_tty) /* Clean up connection to a remote debugger. */ -/* ARGSUSED */ static void v850ice_close (int quitting) { @@ -535,7 +534,7 @@ v850ice_fetch_registers (int regno) error ("v850ice_fetch_registers (%d): bad value from ICE: %s.", regno, val); - store_unsigned_integer (val, REGISTER_RAW_SIZE (regno), regval); + store_unsigned_integer (val, DEPRECATED_REGISTER_RAW_SIZE (regno), regval); supply_register (regno, val); } @@ -561,7 +560,7 @@ v850ice_store_registers (int regno) } regval = extract_unsigned_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno)); + DEPRECATED_REGISTER_RAW_SIZE (regno)); strcpy (cmd, "reg "); if (!convert_register (regno, &cmd[4])) return; @@ -587,7 +586,6 @@ v850ice_prepare_to_store (void) We can only read/write MAX_BLOCK_SIZE bytes at a time, though, or the DLL dies. */ -/* ARGSUSED */ static int v850ice_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write, struct target_ops *target) diff --git a/gdb/valops.c b/gdb/valops.c index e4f871a..4d53dc0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -664,7 +664,7 @@ value_assign (struct value *toval, struct value *fromval) { int offset; for (reg_offset = value_reg, offset = 0; - offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval); + offset + DEPRECATED_REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval); reg_offset++); byte_offset = VALUE_OFFSET (toval) - offset; } @@ -682,7 +682,7 @@ value_assign (struct value *toval, struct value *fromval) /* Copy it in. */ for (regno = reg_offset, amount_copied = 0; amount_copied < amount_to_copy; - amount_copied += REGISTER_RAW_SIZE (regno), regno++) + amount_copied += DEPRECATED_REGISTER_RAW_SIZE (regno), regno++) frame_register_read (frame, regno, buffer + amount_copied); /* Modify what needs to be modified. */ @@ -699,7 +699,7 @@ value_assign (struct value *toval, struct value *fromval) /* Copy it out. */ for (regno = reg_offset, amount_copied = 0; amount_copied < amount_to_copy; - amount_copied += REGISTER_RAW_SIZE (regno), regno++) + amount_copied += DEPRECATED_REGISTER_RAW_SIZE (regno), regno++) put_frame_register (frame, regno, buffer + amount_copied); } @@ -2371,7 +2371,7 @@ destructor_name_p (const char *name, const struct type *type) len = strlen (dname); else len = cp - dname; - if (strlen (name + 1) != len || !STREQN (dname, name + 1, len)) + if (strlen (name + 1) != len || strncmp (dname, name + 1, len) != 0) error ("name of destructor must equal name of class"); else return 1; @@ -2498,7 +2498,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, { char *t_field_name = TYPE_FIELD_NAME (t, i); - if (t_field_name && STREQ (t_field_name, name)) + if (t_field_name && strcmp (t_field_name, name) == 0) { if (TYPE_FIELD_STATIC (t, i)) { @@ -2545,7 +2545,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, else if (cplus_demangle_opname (t_field_name, dem_opname, 0)) t_field_name = dem_opname; } - if (t_field_name && STREQ (t_field_name, name)) + if (t_field_name && strcmp (t_field_name, name) == 0) { int j = TYPE_FN_FIELDLIST_LENGTH (t, i); struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i); diff --git a/gdb/valprint.c b/gdb/valprint.c index 71e391a..0aaf8f5 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1183,14 +1183,12 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream) knows what they really did here. Radix setting is confusing, e.g. setting the input radix to "10" never changes it! */ -/* ARGSUSED */ static void set_input_radix (char *args, int from_tty, struct cmd_list_element *c) { set_input_radix_1 (from_tty, input_radix); } -/* ARGSUSED */ static void set_input_radix_1 (int from_tty, unsigned radix) { @@ -1216,7 +1214,6 @@ set_input_radix_1 (int from_tty, unsigned radix) } } -/* ARGSUSED */ static void set_output_radix (char *args, int from_tty, struct cmd_list_element *c) { @@ -1278,7 +1275,6 @@ set_radix (char *arg, int from_tty) /* Show both the input and output radices. */ -/*ARGSUSED */ static void show_radix (char *arg, int from_tty) { @@ -1300,7 +1296,6 @@ show_radix (char *arg, int from_tty) } -/*ARGSUSED */ static void set_print (char *arg, int from_tty) { @@ -1309,7 +1304,6 @@ set_print (char *arg, int from_tty) help_list (setprintlist, "set print ", -1, gdb_stdout); } -/*ARGSUSED */ static void show_print (char *args, int from_tty) { diff --git a/gdb/value.h b/gdb/value.h index 92b44a5..95d231a 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -417,9 +417,8 @@ extern struct value *value_repeat (struct value *arg1, int count); extern struct value *value_subscript (struct value *array, struct value *idx); -extern struct value *value_being_returned (struct type *valtype, - struct regcache *retbuf, - int struct_return); +extern struct value *register_value_being_returned (struct type *valtype, + struct regcache *retbuf); extern struct value *value_in (struct value *element, struct value *set); @@ -427,8 +426,6 @@ extern int value_bit_index (struct type *type, char *addr, int index); extern int using_struct_return (struct type *value_type, int gcc_p); -extern void set_return_value (struct value *val); - extern struct value *evaluate_expression (struct expression *exp); extern struct value *evaluate_type (struct expression *exp); diff --git a/gdb/values.c b/gdb/values.c index 3bde2aa..27524eb 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1202,55 +1202,48 @@ value_from_double (struct type *type, DOUBLEST num) return val; } -/* Deal with the value that is "about to be returned". */ - -/* Return the value that a function returning now - would be returning to its caller, assuming its type is VALTYPE. - RETBUF is where we look for what ought to be the contents - of the registers (in raw form). This is because it is often - desirable to restore old values to those registers - after saving the contents of interest, and then call - this function using the saved values. - struct_return is non-zero when the function in question is - using the structure return conventions on the machine in question; - 0 when it is using the value returning conventions (this often - means returning pointer to where structure is vs. returning value). */ - -/* ARGSUSED */ +/* Deal with the return-value of a function that has "just returned". + + Extract the return-value (as a "struct value") that a function, + using register convention, has just returned to its caller. Assume + that the type of the function is VALTYPE, and that the "just + returned" register state is found in RETBUF. + + The function has "just returned" because GDB halts a returning + function by setting a breakpoint at the return address (in the + caller), and not the return instruction (in the callee). + + Because, in the case of a return from an inferior function call, + GDB needs to restore the inferiors registers, RETBUF is normally a + copy of the inferior's registers. */ + struct value * -value_being_returned (struct type *valtype, struct regcache *retbuf, - int struct_return) +register_value_being_returned (struct type *valtype, struct regcache *retbuf) { - struct value *val; - CORE_ADDR addr; - - /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */ - if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) - if (struct_return) - { - addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf); - if (!addr) - error ("Function return value unknown."); - return value_at (valtype, addr, NULL); - } + struct value *val = allocate_value (valtype); - /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */ - if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) - if (struct_return) - { - char *buf = deprecated_grub_regcache_for_registers (retbuf); - addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf); - if (!addr) - error ("Function return value unknown."); - return value_at (valtype, addr, NULL); - } + /* If the function returns void, don't bother fetching the return + value. */ + if (TYPE_CODE (valtype) == TYPE_CODE_VOID) + return val; - val = allocate_value (valtype); - CHECK_TYPEDEF (valtype); - /* If the function returns void, don't bother fetching the return value. */ - if (TYPE_CODE (valtype) != TYPE_CODE_VOID) - EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val)); + if (!gdbarch_return_value_p (current_gdbarch)) + { + /* NOTE: cagney/2003-10-20: Unlike "gdbarch_return_value", the + EXTRACT_RETURN_VALUE and USE_STRUCT_CONVENTION methods do not + handle the edge case of a function returning a small + structure / union in registers. */ + CHECK_TYPEDEF (valtype); + EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val)); + return val; + } + /* This function only handles "register convention". */ + gdb_assert (gdbarch_return_value (current_gdbarch, valtype, + NULL, NULL, NULL) + == RETURN_VALUE_REGISTER_CONVENTION); + gdbarch_return_value (current_gdbarch, valtype, retbuf, + VALUE_CONTENTS_RAW (val) /*read*/, NULL /*write*/); return val; } @@ -1292,35 +1285,27 @@ using_struct_return (struct type *value_type, int gcc_p) if (code == TYPE_CODE_ERROR) error ("Function return type unknown."); - if (code == TYPE_CODE_STRUCT - || code == TYPE_CODE_UNION - || code == TYPE_CODE_ARRAY - || RETURN_VALUE_ON_STACK (value_type)) - return USE_STRUCT_CONVENTION (gcc_p, value_type); + if (!gdbarch_return_value_p (current_gdbarch)) + { + /* FIXME: cagney/2003-10-01: The below is dead. Instead an + architecture should implement "gdbarch_return_value". Using + that new function it is possible to exactly specify the ABIs + "struct return" vs "register return" conventions. */ + if (code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION + || code == TYPE_CODE_ARRAY + || RETURN_VALUE_ON_STACK (value_type)) + return USE_STRUCT_CONVENTION (gcc_p, value_type); + else + return 0; + } - return 0; + /* Probe the architecture for the return-value convention. */ + return (gdbarch_return_value (current_gdbarch, value_type, + NULL, NULL, NULL) + == RETURN_VALUE_STRUCT_CONVENTION); } -/* Store VAL so it will be returned if a function returns now. - Does not verify that VAL's type matches what the current - function wants to return. */ - -void -set_return_value (struct value *val) -{ - struct type *type = check_typedef (VALUE_TYPE (val)); - enum type_code code = TYPE_CODE (type); - - if (code == TYPE_CODE_ERROR) - error ("Function return type unknown."); - - if (code == TYPE_CODE_STRUCT - || code == TYPE_CODE_UNION) /* FIXME, implement struct return. */ - error ("GDB does not support specifying a struct or union return value."); - - STORE_RETURN_VALUE (type, current_regcache, VALUE_CONTENTS (val)); -} - void _initialize_values (void) { diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 2bbe421..5c99aa8 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -93,7 +93,7 @@ vax_frame_init_saved_regs (struct frame_info *frame) int regnum, regmask; CORE_ADDR next_addr; - if (get_frame_saved_regs (frame)) + if (deprecated_get_frame_saved_regs (frame)) return; frame_saved_regs_zalloc (frame); @@ -107,18 +107,18 @@ vax_frame_init_saved_regs (struct frame_info *frame) for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++) { if (regmask & (1 << regnum)) - get_frame_saved_regs (frame)[regnum] = next_addr += 4; + deprecated_get_frame_saved_regs (frame)[regnum] = next_addr += 4; } - get_frame_saved_regs (frame)[SP_REGNUM] = next_addr + 4; + deprecated_get_frame_saved_regs (frame)[SP_REGNUM] = next_addr + 4; if (regmask & (1 << DEPRECATED_FP_REGNUM)) - get_frame_saved_regs (frame)[SP_REGNUM] += + deprecated_get_frame_saved_regs (frame)[SP_REGNUM] += 4 + (4 * read_memory_integer (next_addr + 4, 4)); - get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 16; - get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = get_frame_base (frame) + 12; - get_frame_saved_regs (frame)[VAX_AP_REGNUM] = get_frame_base (frame) + 8; - get_frame_saved_regs (frame)[PS_REGNUM] = get_frame_base (frame) + 4; + deprecated_get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 16; + deprecated_get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = get_frame_base (frame) + 12; + deprecated_get_frame_saved_regs (frame)[VAX_AP_REGNUM] = get_frame_base (frame) + 8; + deprecated_get_frame_saved_regs (frame)[PS_REGNUM] = get_frame_base (frame) + 4; } /* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */ @@ -280,7 +280,7 @@ static CORE_ADDR vax_extract_struct_value_address (char *regbuf) { return (extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (0), - REGISTER_RAW_SIZE (0))); + DEPRECATED_REGISTER_RAW_SIZE (0))); } static const unsigned char * @@ -348,7 +348,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* Register info */ set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h index 7529e57..1a19917 100644 --- a/gdb/vax-tdep.h +++ b/gdb/vax-tdep.h @@ -22,7 +22,7 @@ #define VAX_TDEP_H /* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the + used in push_word and a few other places; DEPRECATED_REGISTER_RAW_SIZE is the real way to know how big a register is. */ #define VAX_REGISTER_SIZE 4 @@ -33,10 +33,10 @@ register state. */ #define VAX_REGISTER_BYTES (VAX_NUM_REGS * 4) -/* Largest value REGISTER_RAW_SIZE can have. */ +/* Largest value DEPRECATED_REGISTER_RAW_SIZE can have. */ #define VAX_MAX_REGISTER_RAW_SIZE 4 -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ +/* Largest value DEPRECATED_REGISTER_VIRTUAL_SIZE can have. */ #define VAX_MAX_REGISTER_VIRTUAL_SIZE 4 /* Register numbers of various important registers. diff --git a/gdb/version.in b/gdb/version.in index a514448..71700c2 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-09-17-cvs +2003-11-11-cvs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index f0d87ef..358bdf7 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -35,7 +35,6 @@ #include "completer.h" #include "regcache.h" #include "top.h" -#include "i386-tdep.h" #include <signal.h> #include <sys/types.h> #include <fcntl.h> @@ -52,6 +51,10 @@ #include "gdbcmd.h" #include <sys/param.h> #include <unistd.h> +#include "exec.h" + +#include "i386-tdep.h" +#include "i387-tdep.h" /* The ui's event loop. */ extern int (*ui_loop_hook) (int signo); @@ -182,7 +185,6 @@ static const int mappings[] = context_offset (FloatSave.DataSelector), context_offset (FloatSave.DataOffset), context_offset (FloatSave.ErrorSelector) -#ifdef HAVE_SSE_REGS /* XMM0-7 */ , context_offset (ExtendedRegisters[10*16]), context_offset (ExtendedRegisters[11*16]), @@ -194,7 +196,6 @@ static const int mappings[] = context_offset (ExtendedRegisters[17*16]), /* MXCSR */ context_offset (ExtendedRegisters[24]) -#endif }; #undef context_offset @@ -347,12 +348,15 @@ do_child_fetch_inferior_registers (int r) { char *context_offset = ((char *) ¤t_thread->context) + mappings[r]; long l; - if (r == FCS_REGNUM) + +#define I387_ST0_REGNUM I386_ST0_REGNUM + + if (r == I387_FISEG_REGNUM) { l = *((long *) context_offset) & 0xffff; supply_register (r, (char *) &l); } - else if (r == FOP_REGNUM) + else if (r == I387_FOP_REGNUM) { l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1); supply_register (r, (char *) &l); @@ -364,6 +368,8 @@ do_child_fetch_inferior_registers (int r) for (r = 0; r < NUM_REGS; r++) do_child_fetch_inferior_registers (r); } + +#undef I387_ST0_REGNUM } static void @@ -1625,7 +1631,6 @@ child_files_info (struct target_ops *ignore) attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid)); } -/* ARGSUSED */ static void child_open (char *arg, int from_tty) { diff --git a/gdb/wince.c b/gdb/wince.c index 41541dc..f15bbd4 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -833,7 +833,7 @@ wince_software_single_step (enum target_signal ignore, return; } #elif SHx -/* Hitachi SH architecture instruction encoding masks */ +/* Renesas SH architecture instruction encoding masks */ #define COND_BR_MASK 0xff00 #define UCOND_DBR_MASK 0xe000 @@ -844,7 +844,7 @@ wince_software_single_step (enum target_signal ignore, #define UCOND_DISP 0x0fff #define UCOND_REG 0x0f00 -/* Hitachi SH instruction opcodes */ +/* Renesas SH instruction opcodes */ #define BF_INSTR 0x8b00 #define BT_INSTR 0x8900 @@ -1527,7 +1527,6 @@ child_files_info (struct target_ops *ignore) target_pid_to_str (inferior_ptid)); } -/* ARGSUSED */ static void child_open (char *arg, int from_tty) { @@ -1998,7 +1997,8 @@ _initialize_wince (void) add_show_from_set (add_set_cmd ((char *) "remoteaddhost", class_support, var_boolean, (char *) &remote_add_host, - (char *) "Set whether to add this host to remote stub arguments for\n + (char *) "\ +Set whether to add this host to remote stub arguments for\n\ debugging over a network.", &setlist), &showlist); diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index a21ac13..4ed859b 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -166,7 +166,7 @@ store_regs (int tid, int regnum) void supply_fpregset (elf_fpregset_t *fpregsetp) { - x86_64_supply_fxsave ((const char *) fpregsetp, -1); + x86_64_supply_fxsave (current_regcache, -1, fpregsetp); } /* Fill register REGNUM (if it is a floating-point or SSE register) in diff --git a/gdb/x86-64-linux-tdep.c b/gdb/x86-64-linux-tdep.c index 2c49953..71a5364 100644 --- a/gdb/x86-64-linux-tdep.c +++ b/gdb/x86-64-linux-tdep.c @@ -123,7 +123,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size != 512) warning ("Wrong size XMM register set in core file."); else - x86_64_supply_fxsave (core_reg_sect, -1); + x86_64_supply_fxsave (current_regcache, -1, core_reg_sect); break; default: @@ -234,7 +234,7 @@ x86_64_linux_sigcontext_addr (struct frame_info *next_frame) /* From <asm/sigcontext.h>. */ -static int x86_64_linux_sc_reg_offset[X86_64_NUM_GREGS] = +static int x86_64_linux_sc_reg_offset[] = { 13 * 8, /* %rax */ 11 * 8, /* %rbx */ @@ -275,7 +275,7 @@ x86_64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sigcontext_addr = x86_64_linux_sigcontext_addr; tdep->sc_reg_offset = x86_64_linux_sc_reg_offset; - tdep->sc_num_regs = X86_64_NUM_GREGS; + tdep->sc_num_regs = ARRAY_SIZE (x86_64_linux_sc_reg_offset); } diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index e855503..5e6a7e1 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -32,6 +32,7 @@ #include "gdbcore.h" #include "objfiles.h" #include "regcache.h" +#include "regset.h" #include "symfile.h" #include "gdb_assert.h" @@ -757,10 +758,10 @@ x86_64_store_return_value (struct type *type, struct regcache *regcache, int len = TYPE_LENGTH (type); /* First handle long doubles. */ - if (TYPE_CODE_FLT == TYPE_CODE (type) && len == 16) + if (TYPE_CODE_FLT == TYPE_CODE (type) && len == 16) { ULONGEST fstat; - char buf[FPU_REG_RAW_SIZE]; + char buf[I386_MAX_REGISTER_SIZE]; /* Returning floating-point values is a bit tricky. Apart from storing the return value in %st(0), we have to simulate the @@ -795,8 +796,8 @@ x86_64_store_return_value (struct type *type, struct regcache *regcache, /* XXX: What about complex floating point types? */ else { - int low_size = REGISTER_RAW_SIZE (0); - int high_size = REGISTER_RAW_SIZE (1); + int low_size = register_size (current_gdbarch, X86_64_RAX_REGNUM); + int high_size = register_size (current_gdbarch, X86_64_RDX_REGNUM); if (len <= low_size) regcache_cooked_write_part (regcache, 0, 0, len, valbuf); @@ -1203,13 +1204,58 @@ x86_64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) { return sp & -(CORE_ADDR)16; } + + +/* Supply register REGNUM from the floating-point register set REGSET + to register cache REGCACHE. If REGNUM is -1, do this for all + registers in REGSET. */ + +static void +x86_64_supply_fpregset (const struct regset *regset, struct regcache *regcache, + int regnum, const void *fpregs, size_t len) +{ + const struct gdbarch_tdep *tdep = regset->descr; + + gdb_assert (len == tdep->sizeof_fpregset); + x86_64_supply_fxsave (regcache, regnum, fpregs); +} + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +static const struct regset * +x86_64_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, size_t sect_size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset) + { + if (tdep->fpregset == NULL) + { + tdep->fpregset = XMALLOC (struct regset); + tdep->fpregset->descr = tdep; + tdep->fpregset->supply_regset = x86_64_supply_fpregset; + } + + return tdep->fpregset; + } + + return i386_regset_from_core_section (gdbarch, sect_name, sect_size); +} + void x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - /* The x86-64 has 16 SSE registers. */ + /* AMD64 generally uses `fxsave' instead of `fsave' for saving its + floating-point registers. */ + tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE; + + /* AMD64 has an FPU and 16 SSE registers. */ + tdep->st0_regnum = X86_64_ST0_REGNUM; tdep->num_xmm_regs = 16; /* This is what all the fuss is about. */ @@ -1264,6 +1310,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Avoid wiring in the MMX registers for now. */ set_gdbarch_num_pseudo_regs (gdbarch, 0); + tdep->mm0_regnum = -1; set_gdbarch_unwind_dummy_id (gdbarch, x86_64_unwind_dummy_id); @@ -1275,11 +1322,15 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) frame_unwind_append_sniffer (gdbarch, x86_64_sigtramp_frame_sniffer); frame_unwind_append_sniffer (gdbarch, x86_64_frame_sniffer); frame_base_set_default (gdbarch, &x86_64_frame_base); + + /* If we have a register mapping, enable the generic core file support. */ + if (tdep->gregset_reg_offset) + set_gdbarch_regset_from_core_section (gdbarch, + x86_64_regset_from_core_section); } -#define I387_FISEG_REGNUM FISEG_REGNUM -#define I387_FOSEG_REGNUM FOSEG_REGNUM +#define I387_ST0_REGNUM X86_64_ST0_REGNUM /* The 64-bit FXSAVE format differs from the 32-bit format in the sense that the instruction pointer and data pointer are simply @@ -1288,22 +1339,25 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) bits of these pointers (instead of just the 16-bits of the segment selector). */ -/* Fill register REGNUM in GDB's register cache with the appropriate +/* Fill register REGNUM in REGCACHE with the appropriate floating-point or SSE register value from *FXSAVE. If REGNUM is -1, do this for all registers. This function masks off any of the reserved bits in *FXSAVE. */ void -x86_64_supply_fxsave (const char *fxsave, int regnum) +x86_64_supply_fxsave (struct regcache *regcache, int regnum, + const void *fxsave) { - i387_supply_fxsave (fxsave, regnum); + i387_supply_fxsave (regcache, regnum, fxsave); if (fxsave) { + const char *regs = fxsave; + if (regnum == -1 || regnum == I387_FISEG_REGNUM) - supply_register (I387_FISEG_REGNUM, fxsave + 12); + regcache_raw_supply (regcache, I387_FISEG_REGNUM, regs + 12); if (regnum == -1 || regnum == I387_FOSEG_REGNUM) - supply_register (I387_FOSEG_REGNUM, fxsave + 20); + regcache_raw_supply (regcache, I387_FOSEG_REGNUM, regs + 20); } } diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index 76bb3d3..17d2cdf 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -27,6 +27,7 @@ struct gdbarch; struct frame_info; +struct regcache; #include "i386-tdep.h" @@ -48,12 +49,13 @@ struct frame_info; void x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); -/* Fill register REGNUM in GDB's register cache with the appropriate +/* Fill register REGNUM in REGCACHE with the appropriate floating-point or SSE register value from *FXSAVE. If REGNUM is -1, do this for all registers. This function masks off any of the reserved bits in *FXSAVE. */ -void x86_64_supply_fxsave (const char *fxsave, int regnum); +extern void x86_64_supply_fxsave (struct regcache *regcache, int regnum, + const void *fxsave); /* Fill register REGNUM (if it is a floating-point or SSE register) in *FXSAVE with the value in GDB's register cache. If REGNUM is -1, do @@ -63,6 +65,9 @@ void x86_64_supply_fxsave (const char *fxsave, int regnum); void x86_64_fill_fxsave (char *fxsave, int regnum); +/* Variables exported from amd64nbsd-tdep.c. */ +extern int amd64nbsd_r_reg_offset[]; + /* Variables exported from amd64fbsd-tdep.c. */ extern CORE_ADDR amd64fbsd_sigtramp_start; extern CORE_ADDR amd64fbsd_sigtramp_end; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 05fb159..6183785 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -193,8 +193,6 @@ static void xcoff_symfile_finish (struct objfile *); static void xcoff_symfile_offsets (struct objfile *, struct section_addr_info *addrs); -static void find_linenos (bfd *, sec_ptr, void *); - static char *coff_getfilename (union internal_auxent *, struct objfile *); static void read_symbol (struct internal_syment *, int); @@ -1699,7 +1697,7 @@ gotit: * mainline code can read the whole thing for efficiency. */ static void -find_linenos (bfd *abfd, sec_ptr asect, void *vpinfo) +find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo) { struct coff_symfile_info *info; int size, count; @@ -2635,22 +2633,6 @@ scan_xcoff_symtab (struct objfile *objfile) psymtab_language, objfile); p += 1; } -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* The semantics of C++ state that "struct foo { ... }" -// OBSOLETE also defines a typedef for "foo". Unfortuantely, cfront -// OBSOLETE never makes the typedef when translating from C++ to C. -// OBSOLETE We make the typedef here so that "ptype foo" works as -// OBSOLETE expected for cfront translated code. */ -// OBSOLETE else if (psymtab_language == language_cplus) -// OBSOLETE { -// OBSOLETE /* Also a typedef with the same name. */ -// OBSOLETE add_psymbol_to_list (namestring, p - namestring, -// OBSOLETE VAR_DOMAIN, LOC_TYPEDEF, -// OBSOLETE &objfile->static_psymbols, -// OBSOLETE symbol.n_value, 0, -// OBSOLETE psymtab_language, objfile); -// OBSOLETE } -#endif /* OBSOLETE CFront */ } goto check_enum; @@ -2799,11 +2781,6 @@ scan_xcoff_symtab (struct objfile *objfile) case '9': case '-': case '#': /* for symbol identification (used in live ranges) */ -#if 0 /* OBSOLETE CFront */ -// OBSOLETE /* added to support cfront stabs strings */ -// OBSOLETE case 'Z': /* for definition continuations */ -// OBSOLETE case 'P': /* for prototypes */ -#endif /* OBSOLETE CFront */ continue; case ':': @@ -2902,7 +2879,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) /* Read the .debug section, if present. */ { - sec_ptr secp; + struct bfd_section *secp; bfd_size_type length; char *debugsec = NULL; diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 1e86294..e4bebc8 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -230,7 +230,7 @@ xstormy16_extract_return_value (struct type *type, char *regbuf, char *valbuf) pointed to by R2. */ return_buffer = extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (E_PTR_RET_REGNUM), - REGISTER_RAW_SIZE (E_PTR_RET_REGNUM)); + DEPRECATED_REGISTER_RAW_SIZE (E_PTR_RET_REGNUM)); read_memory (return_buffer, valbuf, TYPE_LENGTH (type)); } @@ -343,15 +343,15 @@ xstormy16_pop_frame (void) { /* Restore the saved regs. */ for (i = 0; i < NUM_REGS; i++) - if (get_frame_saved_regs (fi)[i]) + if (deprecated_get_frame_saved_regs (fi)[i]) { if (i == SP_REGNUM) - write_register (i, get_frame_saved_regs (fi)[i]); + write_register (i, deprecated_get_frame_saved_regs (fi)[i]); else if (i == E_PC_REGNUM) - write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i], + write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i], xstormy16_pc_size)); else - write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i], + write_register (i, read_memory_integer (deprecated_get_frame_saved_regs (fi)[i], xstormy16_reg_size)); } /* Restore the PC */ @@ -492,7 +492,7 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, if (fi) { regnum = inst & 0x000f; - get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize; + deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize; get_frame_extra_info (fi)->framesize += xstormy16_reg_size; } } @@ -548,7 +548,7 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, if (offset & 0x0800) offset -= 0x1000; - get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize + offset; + deprecated_get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize + offset; } next_addr += xstormy16_inst_size; } @@ -595,12 +595,12 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, previous value would have been pushed). */ if (get_frame_extra_info (fi)->frameless_p) { - get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - get_frame_extra_info (fi)->framesize; + deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - get_frame_extra_info (fi)->framesize; deprecated_update_frame_base_hack (fi, sp); } else { - get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - get_frame_extra_info (fi)->framesize; + deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - get_frame_extra_info (fi)->framesize; deprecated_update_frame_base_hack (fi, fp); } @@ -609,11 +609,11 @@ xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, sp, fp and framesize. We know the beginning of the frame so we can translate the register offsets to real addresses. */ for (regnum = 0; regnum < E_SP_REGNUM; ++regnum) - if (get_frame_saved_regs (fi)[regnum]) - get_frame_saved_regs (fi)[regnum] += get_frame_saved_regs (fi)[E_SP_REGNUM]; + if (deprecated_get_frame_saved_regs (fi)[regnum]) + deprecated_get_frame_saved_regs (fi)[regnum] += deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM]; /* Save address of PC on stack. */ - get_frame_saved_regs (fi)[E_PC_REGNUM] = get_frame_saved_regs (fi)[E_SP_REGNUM]; + deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM] = deprecated_get_frame_saved_regs (fi)[E_SP_REGNUM]; } return next_addr; @@ -733,7 +733,7 @@ xstormy16_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR func_addr, func_end; - if (!get_frame_saved_regs (fi)) + if (!deprecated_get_frame_saved_regs (fi)) { frame_saved_regs_zalloc (fi); @@ -765,7 +765,7 @@ xstormy16_frame_saved_pc (struct frame_info *fi) } else { - saved_pc = read_memory_unsigned_integer (get_frame_saved_regs (fi)[E_PC_REGNUM], + saved_pc = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[E_PC_REGNUM], xstormy16_pc_size); } @@ -1026,7 +1026,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* NOTE: cagney/2002-12-06: This can be deleted when this arch is ready to unwind the PC first (see frame.c:get_prev_frame()). */ - set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); + set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default); /* * Basic register fields and methods. diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c deleted file mode 100644 index d6d42e3..0000000 --- a/gdb/z8k-tdep.c +++ /dev/null @@ -1,535 +0,0 @@ -// OBSOLETE /* Target-machine dependent code for Zilog Z8000, for GDB. -// OBSOLETE -// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -// OBSOLETE 2002, 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 /* -// OBSOLETE Contributed by Steve Chamberlain -// OBSOLETE sac@cygnus.com -// OBSOLETE */ -// OBSOLETE -// OBSOLETE #include "defs.h" -// OBSOLETE #include "frame.h" -// OBSOLETE #include "symtab.h" -// OBSOLETE #include "gdbcmd.h" -// OBSOLETE #include "gdbtypes.h" -// OBSOLETE #include "dis-asm.h" -// OBSOLETE #include "gdbcore.h" -// OBSOLETE #include "regcache.h" -// OBSOLETE -// OBSOLETE #include "value.h" /* For read_register() */ -// OBSOLETE -// OBSOLETE -// OBSOLETE static int read_memory_pointer (CORE_ADDR x); -// OBSOLETE -// OBSOLETE /* Return the saved PC from this frame. -// OBSOLETE -// OBSOLETE If the frame has a memory copy of SRP_REGNUM, use that. If not, -// OBSOLETE just use the register SRP_REGNUM itself. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_frame_saved_pc (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return read_memory_pointer (frame->frame + (BIG ? 4 : 2)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE #define IS_PUSHL(x) (BIG ? ((x & 0xfff0) == 0x91e0):((x & 0xfff0) == 0x91F0)) -// OBSOLETE #define IS_PUSHW(x) (BIG ? ((x & 0xfff0) == 0x93e0):((x & 0xfff0)==0x93f0)) -// OBSOLETE #define IS_MOVE_FP(x) (BIG ? x == 0xa1ea : x == 0xa1fa) -// OBSOLETE #define IS_MOV_SP_FP(x) (BIG ? x == 0x94ea : x == 0x0d76) -// OBSOLETE #define IS_SUB2_SP(x) (x==0x1b87) -// OBSOLETE #define IS_MOVK_R5(x) (x==0x7905) -// OBSOLETE #define IS_SUB_SP(x) ((x & 0xffff) == 0x020f) -// OBSOLETE #define IS_PUSH_FP(x) (BIG ? (x == 0x93ea) : (x == 0x93fa)) -// OBSOLETE -// OBSOLETE /* work out how much local space is on the stack and -// OBSOLETE return the pc pointing to the first push */ -// OBSOLETE -// OBSOLETE static CORE_ADDR -// OBSOLETE skip_adjust (CORE_ADDR pc, int *size) -// OBSOLETE { -// OBSOLETE *size = 0; -// OBSOLETE -// OBSOLETE if (IS_PUSH_FP (read_memory_short (pc)) -// OBSOLETE && IS_MOV_SP_FP (read_memory_short (pc + 2))) -// OBSOLETE { -// OBSOLETE /* This is a function with an explict frame pointer */ -// OBSOLETE pc += 4; -// OBSOLETE *size += 2; /* remember the frame pointer */ -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* remember any stack adjustment */ -// OBSOLETE if (IS_SUB_SP (read_memory_short (pc))) -// OBSOLETE { -// OBSOLETE *size += read_memory_short (pc + 2); -// OBSOLETE pc += 4; -// OBSOLETE } -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE static CORE_ADDR examine_frame (CORE_ADDR, CORE_ADDR * regs, CORE_ADDR); -// OBSOLETE static CORE_ADDR -// OBSOLETE examine_frame (CORE_ADDR pc, CORE_ADDR *regs, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE int w = read_memory_short (pc); -// OBSOLETE int offset = 0; -// OBSOLETE int regno; -// OBSOLETE -// OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) -// OBSOLETE regs[regno] = 0; -// OBSOLETE -// OBSOLETE while (IS_PUSHW (w) || IS_PUSHL (w)) -// OBSOLETE { -// OBSOLETE /* work out which register is being pushed to where */ -// OBSOLETE if (IS_PUSHL (w)) -// OBSOLETE { -// OBSOLETE regs[w & 0xf] = offset; -// OBSOLETE regs[(w & 0xf) + 1] = offset + 2; -// OBSOLETE offset += 4; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE regs[w & 0xf] = offset; -// OBSOLETE offset += 2; -// OBSOLETE } -// OBSOLETE pc += 2; -// OBSOLETE w = read_memory_short (pc); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if (IS_MOVE_FP (w)) -// OBSOLETE { -// OBSOLETE /* We know the fp */ -// OBSOLETE -// OBSOLETE } -// OBSOLETE else if (IS_SUB_SP (w)) -// OBSOLETE { -// OBSOLETE /* Subtracting a value from the sp, so were in a function -// OBSOLETE which needs stack space for locals, but has no fp. We fake up -// OBSOLETE the values as if we had an fp */ -// OBSOLETE regs[FP_REGNUM] = sp; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* This one didn't have an fp, we'll fake it up */ -// OBSOLETE regs[SP_REGNUM] = sp; -// OBSOLETE } -// OBSOLETE /* stack pointer contains address of next frame */ -// OBSOLETE /* regs[fp_regnum()] = fp; */ -// OBSOLETE regs[SP_REGNUM] = sp; -// OBSOLETE return pc; -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_skip_prologue (CORE_ADDR start_pc) -// OBSOLETE { -// OBSOLETE CORE_ADDR dummy[NUM_REGS]; -// OBSOLETE -// OBSOLETE return examine_frame (start_pc, dummy, 0); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_addr_bits_remove (CORE_ADDR addr) -// OBSOLETE { -// OBSOLETE return (addr & PTR_MASK); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static int -// OBSOLETE read_memory_pointer (CORE_ADDR x) -// OBSOLETE { -// OBSOLETE return read_memory_integer (ADDR_BITS_REMOVE (x), BIG ? 4 : 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE z8k_frame_chain (struct frame_info *thisframe) -// OBSOLETE { -// OBSOLETE if (!inside_entry_file (get_frame_pc (thisframe))) -// OBSOLETE { -// OBSOLETE return read_memory_pointer (thisframe->frame); -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_frame_init_saved_regs (struct frame_info *frame_info) -// OBSOLETE { -// OBSOLETE CORE_ADDR pc; -// OBSOLETE int w; -// OBSOLETE -// OBSOLETE frame_saved_regs_zalloc (frame_info); -// OBSOLETE pc = get_pc_function_start (get_frame_pc (frame_info)); -// OBSOLETE -// OBSOLETE /* wander down the instruction stream */ -// OBSOLETE examine_frame (pc, frame_info->saved_regs, frame_info->frame); -// OBSOLETE -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_push_dummy_frame (void) -// OBSOLETE { -// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); -// OBSOLETE } -// OBSOLETE -// OBSOLETE int -// OBSOLETE gdb_print_insn_z8k (bfd_vma memaddr, disassemble_info *info) -// OBSOLETE { -// OBSOLETE if (BIG) -// OBSOLETE return print_insn_z8001 (memaddr, info); -// OBSOLETE else -// OBSOLETE return print_insn_z8002 (memaddr, info); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or -// OBSOLETE is not the address of a valid instruction, the address of the next -// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word -// OBSOLETE of the instruction. */ -// OBSOLETE -// OBSOLETE CORE_ADDR -// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, short *pword1) -// OBSOLETE { -// OBSOLETE char buf[2]; -// OBSOLETE if (addr < lim + 8) -// OBSOLETE { -// OBSOLETE read_memory (addr, buf, 2); -// OBSOLETE *pword1 = extract_signed_integer (buf, 2); -// OBSOLETE -// OBSOLETE return addr + 2; -// OBSOLETE } -// OBSOLETE return 0; -// OBSOLETE } -// OBSOLETE -// OBSOLETE #if 0 -// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, -// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. -// OBSOLETE This includes special registers such as pc and fp saved in special -// OBSOLETE ways in the stack frame. sp is even more special: -// OBSOLETE the address we return for it IS the sp for the next frame. -// OBSOLETE -// OBSOLETE We cache the result of doing this in the frame_cache_obstack, since -// OBSOLETE it is fairly expensive. */ -// OBSOLETE -// OBSOLETE void -// OBSOLETE frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp) -// OBSOLETE { -// OBSOLETE int locals; -// OBSOLETE CORE_ADDR pc; -// OBSOLETE CORE_ADDR adr; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE memset (fsrp, 0, sizeof *fsrp); -// OBSOLETE -// OBSOLETE pc = skip_adjust (get_pc_function_start (get_frame_pc (fip)), &locals); -// OBSOLETE -// OBSOLETE { -// OBSOLETE adr = get_frame_base (fip) - locals; -// OBSOLETE for (i = 0; i < 8; i++) -// OBSOLETE { -// OBSOLETE int word = read_memory_short (pc); -// OBSOLETE -// OBSOLETE pc += 2; -// OBSOLETE if (IS_PUSHL (word)) -// OBSOLETE { -// OBSOLETE fsrp->regs[word & 0xf] = adr; -// OBSOLETE fsrp->regs[(word & 0xf) + 1] = adr - 2; -// OBSOLETE adr -= 4; -// OBSOLETE } -// OBSOLETE else if (IS_PUSHW (word)) -// OBSOLETE { -// OBSOLETE fsrp->regs[word & 0xf] = adr; -// OBSOLETE adr -= 2; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE break; -// OBSOLETE } -// OBSOLETE -// OBSOLETE } -// OBSOLETE -// OBSOLETE fsrp->regs[PC_REGNUM] = fip->frame + 4; -// OBSOLETE fsrp->regs[FP_REGNUM] = fip->frame; -// OBSOLETE -// OBSOLETE } -// OBSOLETE #endif -// OBSOLETE -// OBSOLETE int -// OBSOLETE z8k_saved_pc_after_call (struct frame_info *frame) -// OBSOLETE { -// OBSOLETE return ADDR_BITS_REMOVE -// OBSOLETE (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE void -// OBSOLETE extract_return_value (struct type *type, char *regbuf, char *valbuf) -// OBSOLETE { -// OBSOLETE int b; -// OBSOLETE int len = TYPE_LENGTH (type); -// OBSOLETE -// OBSOLETE for (b = 0; b < len; b += 2) -// OBSOLETE { -// OBSOLETE int todo = len - b; -// OBSOLETE -// OBSOLETE if (todo > 2) -// OBSOLETE todo = 2; -// OBSOLETE memcpy (valbuf + b, regbuf + b, todo); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE write_return_value (struct type *type, char *valbuf) -// OBSOLETE { -// OBSOLETE int reg; -// OBSOLETE int len; -// OBSOLETE -// OBSOLETE for (len = 0; len < TYPE_LENGTH (type); len += 2) -// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (len / 2 + 2), -// OBSOLETE valbuf + len, 2); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -// OBSOLETE { -// OBSOLETE write_register (2, addr); -// OBSOLETE } -// OBSOLETE -// OBSOLETE -// OBSOLETE static void -// OBSOLETE z8k_print_register_hook (int regno) -// OBSOLETE { -// OBSOLETE if ((regno & 1) == 0 && regno < 16) -// OBSOLETE { -// OBSOLETE unsigned char l[4]; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, l + 0); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 1, l + 2); -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]); -// OBSOLETE } -// OBSOLETE -// OBSOLETE if ((regno & 3) == 0 && regno < 16) -// OBSOLETE { -// OBSOLETE unsigned char l[8]; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, l + 0); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 1, l + 2); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 2, l + 4); -// OBSOLETE frame_register_read (deprecated_selected_frame, regno + 3, l + 6); -// OBSOLETE -// OBSOLETE printf_unfiltered ("\t"); -// OBSOLETE printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x", -// OBSOLETE l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]); -// OBSOLETE } -// OBSOLETE if (regno == 15) -// OBSOLETE { -// OBSOLETE unsigned short rval; -// OBSOLETE int i; -// OBSOLETE -// OBSOLETE frame_register_read (deprecated_selected_frame, regno, (char *) (&rval)); -// OBSOLETE -// OBSOLETE printf_unfiltered ("\n"); -// OBSOLETE for (i = 0; i < 10; i += 2) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("(sp+%d=%04x)", i, -// OBSOLETE (unsigned int)read_memory_short (rval + i)); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE z8k_print_registers_info (struct gdbarch *gdbarch, -// OBSOLETE struct ui_file *file, -// OBSOLETE struct frame_info *frame, -// OBSOLETE int regnum, int print_all) -// OBSOLETE { -// OBSOLETE int i; -// OBSOLETE const int numregs = NUM_REGS + NUM_PSEUDO_REGS; -// OBSOLETE char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); -// OBSOLETE char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); -// OBSOLETE -// OBSOLETE for (i = 0; i < numregs; i++) -// OBSOLETE { -// OBSOLETE /* Decide between printing all regs, non-float / vector regs, or -// OBSOLETE specific reg. */ -// OBSOLETE if (regnum == -1) -// OBSOLETE { -// OBSOLETE if (!print_all) -// OBSOLETE { -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE continue; -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE if (i != regnum) -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If the register name is empty, it is undefined for this -// OBSOLETE processor, so don't display anything. */ -// OBSOLETE if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') -// OBSOLETE continue; -// OBSOLETE -// OBSOLETE fputs_filtered (REGISTER_NAME (i), file); -// OBSOLETE print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); -// OBSOLETE -// OBSOLETE /* Get the data in raw format. */ -// OBSOLETE if (! frame_register_read (frame, i, raw_buffer)) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "*value not available*\n"); -// OBSOLETE continue; -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. -// OBSOLETE The function frame_register_read() should have returned the -// OBSOLETE pre-cooked register so no conversion is necessary. */ -// OBSOLETE /* Convert raw data to virtual format if necessary. */ -// OBSOLETE if (REGISTER_CONVERTIBLE (i)) -// OBSOLETE { -// OBSOLETE REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), -// OBSOLETE raw_buffer, virtual_buffer); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE memcpy (virtual_buffer, raw_buffer, -// OBSOLETE REGISTER_VIRTUAL_SIZE (i)); -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* If virtual format is floating, print it that way, and in raw -// OBSOLETE hex. */ -// OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) -// OBSOLETE { -// OBSOLETE int j; -// OBSOLETE -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\t(raw 0x"); -// OBSOLETE for (j = 0; j < REGISTER_RAW_SIZE (i); j++) -// OBSOLETE { -// OBSOLETE int idx; -// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) -// OBSOLETE idx = j; -// OBSOLETE else -// OBSOLETE idx = REGISTER_RAW_SIZE (i) - 1 - j; -// OBSOLETE fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); -// OBSOLETE } -// OBSOLETE fprintf_filtered (file, ")"); -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE /* Print the register in hex. */ -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 'x', 1, 0, Val_pretty_default); -// OBSOLETE /* If not a vector register, print it also according to its -// OBSOLETE natural format. */ -// OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) -// OBSOLETE { -// OBSOLETE fprintf_filtered (file, "\t"); -// OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, -// OBSOLETE file, 0, 1, 0, Val_pretty_default); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE /* Some z8k specific info. */ -// OBSOLETE z8k_print_register_hook (i); -// OBSOLETE -// OBSOLETE fprintf_filtered (file, "\n"); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_do_registers_info (int regnum, int all) -// OBSOLETE { -// OBSOLETE z8k_print_registers_info (current_gdbarch, gdb_stdout, -// OBSOLETE deprecated_selected_frame, regnum, all); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_pop_frame (void) -// OBSOLETE { -// OBSOLETE } -// OBSOLETE -// OBSOLETE struct cmd_list_element *setmemorylist; -// OBSOLETE -// OBSOLETE void -// OBSOLETE z8k_set_pointer_size (int newsize) -// OBSOLETE { -// OBSOLETE static int oldsize = 0; -// OBSOLETE -// OBSOLETE if (oldsize != newsize) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("pointer size set to %d bits\n", newsize); -// OBSOLETE oldsize = newsize; -// OBSOLETE if (newsize == 32) -// OBSOLETE { -// OBSOLETE BIG = 1; -// OBSOLETE } -// OBSOLETE else -// OBSOLETE { -// OBSOLETE BIG = 0; -// OBSOLETE } -// OBSOLETE /* FIXME: This code should be using the GDBARCH framework to -// OBSOLETE handle changed type sizes. If this problem is ever fixed -// OBSOLETE (the direct reference to _initialize_gdbtypes() below -// OBSOLETE eliminated) then Makefile.in should be updated so that -// OBSOLETE z8k-tdep.c is again compiled with -Werror. */ -// OBSOLETE _initialize_gdbtypes (); -// OBSOLETE } -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE segmented_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE z8k_set_pointer_size (32); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE unsegmented_command (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE z8k_set_pointer_size (16); -// OBSOLETE } -// OBSOLETE -// OBSOLETE static void -// OBSOLETE set_memory (char *args, int from_tty) -// OBSOLETE { -// OBSOLETE printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n"); -// OBSOLETE help_list (setmemorylist, "set memory ", -1, gdb_stdout); -// OBSOLETE } -// OBSOLETE -// OBSOLETE void -// OBSOLETE _initialize_z8ktdep (void) -// OBSOLETE { -// OBSOLETE tm_print_insn = gdb_print_insn_z8k; -// OBSOLETE -// OBSOLETE add_prefix_cmd ("memory", no_class, set_memory, -// OBSOLETE "set the memory model", &setmemorylist, "set memory ", 0, -// OBSOLETE &setlist); -// OBSOLETE add_cmd ("segmented", class_support, segmented_command, -// OBSOLETE "Set segmented memory model.", &setmemorylist); -// OBSOLETE add_cmd ("unsegmented", class_support, unsegmented_command, -// OBSOLETE "Set unsegmented memory model.", &setmemorylist); -// OBSOLETE -// OBSOLETE } |