diff options
author | David Carlton <carlton@bactrian.org> | 2002-11-15 19:19:28 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2002-11-15 19:19:28 +0000 |
commit | fb8abdb0ebe68c5fb20228d81bebbf45782c052c (patch) | |
tree | 621da7c283d7d3bd0e9ca87bfdb53e5fcfcb72ac /gdb | |
parent | 1e04139942197a796f7ab9dadeeaac2e78a301d4 (diff) | |
download | gdb-fb8abdb0ebe68c5fb20228d81bebbf45782c052c.zip gdb-fb8abdb0ebe68c5fb20228d81bebbf45782c052c.tar.gz gdb-fb8abdb0ebe68c5fb20228d81bebbf45782c052c.tar.bz2 |
2002-11-15 David Carlton <carlton@math.stanford.edu>
* Merge from mainline; tag is carlton_dictionary-20021115-merge.
Diffstat (limited to 'gdb')
208 files changed, 5897 insertions, 4959 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2b1233c..d71c088 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,887 @@ +2002-11-15 David Carlton <carlton@math.stanford.edu> + + * Merge from mainline; tag is carlton_dictionary-20021115-merge. + +2002-11-14 Andrew Cagney <ac131313@redhat.com> + + * frame.h: Move the most relevant interface functions to the start + of the file. + +2002-11-14 Andrew Cagney <ac131313@redhat.com> + + * regcache.h (deprecated_registers): Rename registers. + * a68v-nat.c, alpha-nat.c, arch-utils.c, core-sol2.c: Update. + * hp300ux-nat.c, hppab-nat.c, hppah-nat.c: Update. + * hppam3-nat.c, hpux-thread.c, i386gnu-nat.c: Update. + * ia64-aix-nat.c, ia64-linux-nat.c, ia64-tdep.c: Update. + * irix4-nat.c, irix5-nat.c, lynx-nat.c, m68k-tdep.c: Update. + * m68knbsd-nat.c, mips-linux-tdep.c, mipsm3-nat.c: Update. + * mipsv4-nat.c, ns32knbsd-nat.c, ppc-bdm.c: Update. + * ppc-sysv-tdep.c, ptx4-nat.c, regcache.c, remote-es.c: Update. + * remote-sds.c, remote-vx68.c, remote-vxmips.c: Update. + * remote-vxsparc.c, rs6000-tdep.c, sol-thread.c: Update. + * sparc-nat.c, sparc-tdep.c, sun3-nat.c, symm-nat.c: Update. + * v850ice.c: Update. + +Wed Nov 13 19:51:05 2002 Andrew Cagney <cagney@redhat.com> + + * utils.c (gdb_realpath): Add comment mentioning realpath with a + NULL buffer. + +2002-11-13 Andrew Cagney <cagney@redhat.com> + + * regcache.h (deprecated_read_register_bytes): Rename + read_register_bytes. + (deprecated_write_register_bytes): Rename write_register_bytes. + * alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update. + * dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update. + * m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update. + * ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update. + * remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update. + * sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update. + * xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update. + * config/nm-m3.h, config/h8500/tm-h8500.h: Update. + * config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update. + * config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update. + * config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update. + * config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update. + * config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update. + * config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update. + +2002-11-13 Jim Blandy <jimb@redhat.com> + + * findvar.c (read_var_value): Doc fix. + +2002-11-13 Andrew Cagney <cagney@redhat.com> + + * regcache.c (struct regcache): Replace passthough_p with + readonly_p. + (regcache_xmalloc): Initialize readonly_p. + (build_regcache): Initialize readonly_p. + (regcache_save): New function. + (regcache_restore): New function. + (regcache_cpy): Re-implement using regcache_save and + regcache_restore. + (regcache_raw_read): Update. + (regcache_cooked_read): When a read-only cache, checked for cached + pseudo register values. + (regcache_raw_write): Assert that the cache is not read-only. + Remove code handling a non-passthrough cache. + * regcache.h (regcache_save): Declare. + (regcache_restore): Declare. + +2002-11-13 Andrew Cagney <cagney@redhat.com> + + * regcache.c (struct regcache_descr): Add fields + sizeof_cooked_registers and sizeof_cooked_register_valid_p. + (init_legacy_regcache_descr): Compute the size of a cooked + register cache and then assign that to sizeof_raw_registers. Set + sizeof_raw_register_valid_p to sizeof_cooked_register_valid_p + (init_legacy_regcache_descr): Ditto. + +2002-11-13 Andrew Cagney <cagney@redhat.com> + + * regcache.c (register_buffer): Move to near start of file, update + description. + (regcache_raw_read): Use. + (regcache_raw_write): Use. + (struct regcache): Rename raw_registers to registers and + raw_register_valid_p to register_valid_p. + (regcache_xmalloc): Update. + (regcache_xfree): Update. + (register_buffer): Update. + (regcache_cpy): Update. + (regcache_cpy_no_passthrough): Update. + (regcache_valid_p): Update. + (deprecated_grub_regcache_for_registers): Update. + (deprecated_grub_regcache_for_register_valid): Update. + (set_register_cached): Update. + (regcache_raw_write): Update. + +2002-11-13 Pierre Muller <muller@ics.u-strasbg.fr> + + * p-exp.y (name_not_typename): Use copy_name to + set current_type variable for fields of THIS. + +2002-11-12 Daniel Jacobowitz <drow@mvista.com> + + * gnu-nat.c (init_gnu_ops): Remove NULL initializations. + * monitor.c (init_base_monitor_ops): Likewise. + * ppc-bdm.c (init_bdm_ppc_ops): Likewise. + * remote-array.c (init_array_ops): Likewise. + * remote-e7000.c (init_e7000_ops): Likewise. + * remote-es.c (init_es1800_ops): Likewise. + (init_es1800_child_ops): Likewise. + * remote-rdp.c (init_remote_rdp_ops): Likewise. + * remote-sim.c (init_gdbsim_ops): Likewise. + * remote-st.c (init_st2000_ops): Likewise. + * sol-thread.c (init_sol_core_ops): Likewise. + (init_sol_thread_ops): Likewise. + * v850ice.c (init_850ice_ops): Likewise. + * win32-nat.c (init_child_ops): Likewise. + * wince.c (init_child_ops): Likewise. + +2002-11-12 Andrew Cagney <ac131313@redhat.com> + + * utils.c (gdb_realpath): Make rp a constant pointer. + +2002-11-12 Andrew Cagney <ac131313@redhat.com> + + * utils.c (gdb_realpath): Rewrite. Try, in order: realpath() with + a constant buffer; cannonicalize_file_name(); realpath() with a + pathconf() defined buffer, xstrdup(). + +2002-11-12 Andrew Cagney <ac131313@redhat.com> + + * config/djgpp/fnchange.lst: Fix typo, hang1.c to hang1.C; hang2.c + to hang2.C; hang3.c to hang3.C. + +2002-11-11 Elena Zannoni <ezannoni@redhat.com> + + * findvar.c (read_var_value): Reenable TLS code. + +2002-11-11 Elena Zannoni <ezannoni@redhat.com> + Jim Blandy <jimb@redhat.com> + + * gdb_thread_db.h (enum): Add TD_NOTALLOC. + * target.c (update_current_target): Add + to_get_thread_local_address. + * target.h (to_get_thread_local_address): Export. + (target_get_thread_local_address): Define. + (target_get_thread_local_address_p): Define. + * thread-db.c: Include solib-svr4.h. + (td_thr_tls_get_addr_p): Define. + (thread_db_load): Get a pointer to td_thr_tls_get_addr. + (thread_db_get_thread_local_address): New function. + (init_thread_db_ops): Initialize to_get_thread_local_address. + * configure.in: Add test for TD_NOTALLOC in thread_db.h. + * configure: Regenerate. + * config.in: Regenerate. + +2002-11-11 David Carlton <carlton@math.stanford.edu> + + * linespec.c (set_flags): New function. + (decode_line_1): Move code into set_flags. + +2002-11-11 David Carlton <carlton@math.stanford.edu> + + * linespec.c (decode_line_1): Move chunks of code to separate + functions. + (initialize_defaults): New function. + (decode_indirect): New function. + +2002-11-11 Andrew Cagney <ac131313@redhat.com> + + * blockframe.c (sigtramp_saved_pc): Fix tipo. void_func_ptr + instead of void_code_ptr. + (sigtramp_saved_pc): Ditto. + + * x86-64-tdep.c (i386_fp_regnum_p): Copy i386-tdep.c's + i386_fp_regnum_p. + +2002-11-10 Daniel Jacobowitz <drow@mvista.com> + + * gdbtypes.h (struct main_type): Move artificial flag out of + loc. New member of ``struct field'' named static_kind. Reduce + overloaded meaning of bitsize. + (FIELD_ARTIFICIAL, SET_FIELD_PHYSNAME, SET_FIELD_PHYSADDR) + (TYPE_FIELD_STATIC, TYPE_FIELD_STATIC_HAS_ADDR): Likewise. + (FIELD_STATIC_KIND, TYPE_FIELD_STATIC_KIND): New macros. + + * ada-lang.c (fill_in_ada_prototype): Initialize static_kind for + new fields. + (template_to_fixed_record_type, template_to_static_fixed_type) + (to_record_with_fixed_variant_part): Likewise. + * coffread.c (coff_read_struct_type, coff_read_enum_type): Likewise. + * dwarf2read.c (dwarf2_add_field, read_enumeration): Likewise. + * dwarfread.c (struct_type, enum_type): Likewise. + * hpread.c (hpread_read_enum_type) + (hpread_read_function_type, hpread_read_doc_function_type) + (hpread_read_struct_type): Likewise. + * mdebugread.c (parse_symbol): Likewise. + +2002-11-10 Andrew Cagney <ac131313@redhat.com> + + * breakpoint.h (deprecated_frame_in_dummy): Rename frame_in_dummy. + * stack.c (print_frame_info_base): Update. + (print_frame_info_base, frame_info): Update. + * sparc-tdep.c (sparc_init_extra_frame_info): Update. + (sparc_frame_saved_pc): Update. + * ada-lang.c (find_printable_frame): Update. + * breakpoint.c (deprecated_frame_in_dummy): Update. + +2002-11-09 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-nat.c (ORIG_EAX): Define to -1 if not already + defined. + (regmap): Extend to cover all registers. + (PT_READ_U, PT_WRITE_U, PTRACE_XFER_TYPE, + OLD_CANNOT_FETCH_REGISTERS, OLD_CANNOT_STORE_REGISTERS): Remove + definitions. + (fetch_register, sore_register): Simplify. + (old_fetch_inferior_registers, old_store_inferior_registers): + Remove functions. + (cannot_fetch_register, cannot_store_register): Change + implementation to use regmap array to decide which registers + cannot be fetched/stored. This removes $orig_eax from the + registers that cannot be fetched/stored. + (fetch_inferior_registers): Call fetch_register directly instead + of calling old_fetch_inferior_registers. + (store_inferior_registers): Call store_register directly instead + of calling old_store_inferior_registers. + (i386_linux_dr_get): Replace PT_READ_U with PTRACE_PEEKUSER. + (i386_linux_dr_set): Replace PT_WRITE_U with PTRACE_POKEUSER. + * config/i386/nm-linux.h (U_REGS_OFFSET): Remove definition. + +2002-11-09 Klee Dienes <kdienes@apple.com> + + * i387-tdep.c (i387_supply_register): When called with NULL as a + buffer, mark the register as not provided (to mirror the behavior + of supply_register). + (i387_supply_fxsave): Ditto. + (i387_supply_fsave): Ditto (inherits the behavior from + i387_supply_register). + +2002-11-09 Klee Dienes <kdienes@apple.com> + + * blockframe.c (sigtramp_saved_pc): Use + builtin_type_void_code_ptr, not builtin_type_void_data_ptr (we are + extracting the PC). Use TYPE_LENGTH (builtin_type_void_code_ptr) + instead of (TARGET_PTR_BIT / TARGET_CHAR_BIT). + +2002-11-09 Andrew Cagney <ac131313@redhat.com> + + * frame.c (get_prev_frame): Test prev_p to identify a previously + unwound frame. Initialize prev_p. + * frame.h (struct frame_info): Add field prev_p. Expand prev/next + comment. + +2002-11-09 Andrew Cagney <ac131313@redhat.com> + + * frame.c (get_prev_frame): Cleanups. Eliminate redundant tests + for a NULL NEXT_FRAME. Simplify fromleaf initialization. Add + more comments. Zap dead code. + +2002-11-09 Mark Kettenis <kettenis@gnu.org> + + * infcmd.c (print_vector_info, print_float_info): Move code that + checks whether the target has any registers and whether there is a + selected frame up, such that it is also used if a target provides + multi-arch definitions of these functions. + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * Makefile.in (DESTDIR): Define. + (install-only, install-gdbtk, uninstall-gdbtk): Add $(DESTDIR) + prefix. + + * config/djgpp/fnchange.lst: 8.3 proof i386obsd-nat.c and + i386obsd-tdep.c. Rename to "gdb.cxx", paths containing "gdb.c++". + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * i386-linux-tdep.c: Include "reggroups.h". + (i386_linux_register_reggroup_p): New function. + (i386_linux_init_abi): Set register_reggroup_p to + i386_linux_register_reggroup_p. + * i386-tdep.h (i386_register_reggroup_p): Declare. + * i386-tdep.c: Include "reggroups.h". + (i386_init_reggroups): New function. + (i386_add_reggroups): New function. + (i386_register_reggroup_p): New function. + (i386_sse_reggroup, i386_mmx_reggroup): New variables. + (_initialize_i386_tdep): Call i386_init_reggroups. + (i386_gdbarch_init): Set register_reggroup_p and add in the i386 + specific reggroups. + +2002-11-09 Mark Kettenis <kettenis@gnu.org> + + * infptrace.c (child_xfer_memory): Make use of the new PT_IO + request that's available in *BSD. + + * i386-tdep.h (IS_FPU_CTRL_REGNUM): Remove. + + * i387-tdep.c (i387_fill_fxsave): Use FOOFF_REGNUM instead of + FDOFF_REGNUM. + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * frame.c (set_unwind_by_pc): Use dummy_frame_register_unwind. + * dummy-frame.c (find_dummy_frame): Rename + generic_find_dummy_frame, make static. Return the dummy frame + instead of the regcache. + (generic_find_dummy_frame): Re-implement using find_dummy_frame, + (cached_find_dummy_frame): New function. Use find_dummy_frame. + (dummy_frame_register_unwind): Rename + generic_call_dummy_register_unwind. Use cached_find_dummy_frame. + * dummy-frame.h (dummy_frame_register_unwind): Rename + generic_call_dummy_register_unwind. + +2002-11-08 Mark Kettenis <kettenis@gnu.org> + + * config/i386/tm-i386v42mp.h: Remove file. Move its contents, + except the inclusion of "i386/tm-i386.h", to... + * config/i386/nm-i386v42mp.h: ...here. + * config/i386/i386v42mp.mt (TM_FILE): Set to tm-i386.h. + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * Makefile.in (frame.o): Update dependencies. + * blockframe.c (current_frame, frame_obstack_alloc) + (frame_saved_regs_zalloc, get_current_frame) + (set_current_frame, create_new_frame) + (set_unwind_by_pc, get_next_frame) + (flush_cached_frames, reinit_frame_cache) + (frame_saved_regs_register_unwind) + (deprecated_generic_get_saved_register) + (get_prev_frame, get_frame_pc, get_frame_saved_regs) + (_initialize_blockframe): Move frame code from here... + * frame.c: ...to here. Include "gdb_obstack.h", "gdbcore.h", + "annotate.h" and "dummy-frame.h". + (_initialize_frame): New function. + +2002-11-08 Jim Blandy <jimb@redhat.com> + + * dwarf2read.c (read_func_scope): Restore list_in_scope properly + when we finish a function a context. + * buildsym.h (outermost_context_p): New macro. + (Bug analyzed by David Edelsohn.) + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * blockframe.c: Include "dummy-frame.h". + (struct dummy_frame, dummy_frame_stack) + (generic_find_dummy_frame, deprecated_generic_find_dummy_frame) + (generic_pc_in_call_dummy, deprecated_read_register_dummy) + (generic_push_dummy_frame, generic_save_dummy_frame_tos) + (generic_save_call_dummy_addr, generic_pop_current_frame) + (generic_pop_dummy_frame, generic_fix_call_dummy) + (generic_fix_call_dummy, generic_call_dummy_register_unwind): Move + dummy frame code from here... + * dummy-frame.c: ...to here. New file. + * dummy-frame.h: New file. + (generic_call_dummy_register_unwind): Declare. + (generic_find_dummy_frame): Declare. + * Makefile.in (SFILES): Add dummy-frame.c. + (dummy-frame.o): Specify dependencies. + (dummy_frame_h): Define. + (COMMON_OBS): Add dummy-frame.o. + (blockframe.o): Update dependencies. + +2002-11-08 Jim Blandy <jimb@redhat.com> + + * dwarf2read.c (read_func_scope): Restore local_symbols and + param_symbols after we finish the function context. (Based on a + patch from David Edelsohn.) + +2002-11-08 David Carlton <carlton@math.stanford.edu> + + * linespec.c (symbol_found): New function. + (minsym_found): New function. + (decode_line_1): Separate out some code into separate functions. + +2002-11-08 Joel Brobecker <brobecker@gnat.com> + + * i386-tdep.c (i386_frameless_signal_p): Make non static for + the benefit of the interix target. + * i386-tdep.h (i386_frameless_signal_p): Declare. + +2002-11-08 Andrew Cagney <ac131313@redhat.com> + + * i386-tdep.h (i386_linux_orig_eax_regnum_p): Delete stray + declaration that snuck in from change below. + +2002-11-06 Andrew Cagney <cagney@redhat.com> + + * i386-tdep.c (i386_mmx_regnum_p): Rename mmx_regnum_p. Update + all callers. + (i386_fp_regnum_p): New function. Use instead of FP_REGNUM_P. + (i386_fpc_regnum_p): New function. Use instead of FPC_REGNUM_P. + (i386_sse_regnum_p): New function. Use instead of SSE_REGNUM_P. + (i386_mxcsr_regnum_p): new function. Use instead of + MXCSR_REGNUM_P. + * i386-tdep.h (SSE_REGNUM_P): Delete macro. + (i386_sse_regnum_p): Declare. + (i386_mxcsr_regnum_p): Declare. + (FP_REGNUM_P, FPC_REGNUM_P): Delete macros. + (i386_fp_regnum_p, i386_fpc_regnum_p): Declare. + (IS_FP_REGNUM): Update definition. + (IS_FPU_CTRL_REGNUM): Update definition.. + (IS_SSE_REGNUM): Update definition.. + * i386v-nat.c (register_u_addr): Update. + * go32-nat.c (fetch_register): Update. + (store_register): Update. + +2002-11-07 Joel Brobecker <brobecker@gnat.com> + + Preparation work to convert the hppa targets to multiarch partial. + + * hppa-tdep.c: Add new functions replacing macro bodies from + config/pa/tm-hppa.h. These function will be used to initialize + the gdbarch structure. Import some comments from tm-hppa.h, + and place them where appropriate, to avoid loosing them when + we cleanup this file. + (hppa_reg_struct_has_addr): New function. + (hppa_inner_than): New function. + (hppa_stack_align): New function. + (hppa_pc_requires_run_before_use): New function. + (hppa_instruction_nullified): New function. + (hppa_register_byte): New function. + (hppa_register_virtual_type): New function. + (hppa_store_struct_return): New function. + (hppa_cannot_store_register): New function. + (hppa_frame_args_address): New function. + (hppa_frame_locals_address): New function. + (hppa_smash_text_address): New function. + (hppa_coerce_float_to_double): New function. Requires the inclusion + of "language.h". + + * Makefile.in (hppa-tdep.o): Add dependency on language.h. + + * tm-hppa.h (REG_STRUCT_HAS_ADDR): Change the definition of this + gdbarch-eligible macro to a call to the new associated function + created in hppa-tdep.c. + (INNER_THAN): Likewise. + (STACK_ALIGN): Likewise. + (PC_REQUIRES_RUN_BEFORE_USE): Likewise. + (INSTRUCTION_NULLIFIED): Likewise. + (REGISTER_BYTE): Likewise. + (REGISTER_VIRTUAL_TYPE): Likewise. + (STORE_STRUCT_RETURN): Likewise. + (CANNOT_STORE_REGISTER): Likewise. + (FRAME_ARGS_ADDRESS): Likewise. + (FRAME_LOCALS_ADDRESS): Likewise. + (SMASH_TEXT_ADDRESS): Likewise. + (COERCE_FLOAT_TO_DOUBLE): Likewise. + (ABOUT_TO_RETURN): Delete, as no longer used. + +2002-11-07 Fernando Nasser <fnasser@redhat.com> + + * printcmd.c (disassemble_command): Remove obsolete function. + (_initialize_printcmd): Do not create disassemble command here. + * cli/cli-cmds.c (disassemble_command): New function. Implements + disassemble command. + (init_cli_cmds): Create disassemble command here instead. + +2002-11-07 Andrew Cagney <ac131313@redhat.com> + + * MAINTAINERS: Add Daniel Jacobowitz to global maintainers list. + +2002-11-07 Andrew Cagney <ac131313@redhat.com> + + * regcache.h (regcache_cooked_read_using_offset_hack) + (regcache_cooked_write_using_offset_hack): Delete declarations. + (register_changed): Delete declaration. + * regcache.c (regcache_cooked_read_using_offset_hack) + (regcache_cooked_write_using_offset_hack): Delete functions. + (cooked_xfer_using_offset_hack): Delete function. + (register_changed): Delete function. + +2002-11-07 Jim Blandy <jimb@redhat.com> + + * macroscope.c: #include "complaints.h". + (sal_macro_scope): Cope with filenames that appear in the symtabs, + but not in the macro table. + * Makefile.in (macroscope.o): Record dependency. + +2002-11-07 Joel Brobecker <brobecker@gnat.com> + + * PROBLEMS: Document gdb/816 (unable to read core file on alpha-osf). + +2002-11-07 Andrew Cagney <ac131313@redhat.com> + + * regcache.c (deprecated_registers_fetched): Update. + * regcache.h (deprecated_registers_fetched): Rename + registers_fetched. + * remote-vxsparc.c (vx_read_register): Update. + * remote-vxmips.c (vx_read_register): Update. + * remote-vx68.c (vx_read_register): Update. + * irix5-nat.c (fetch_core_registers): Update. + * mipsm3-nat.c (fetch_inferior_registers): Update. + * sun3-nat.c (fetch_inferior_registers): Update. + * symm-nat.c (fetch_inferior_registers): Update. + * ns32knbsd-nat.c (fetch_inferior_registers): Update. + (fetch_core_registers): Update. + (fetch_kcore_registers): Update. + * mips-nat.c (fetch_inferior_registers): Update. + * corelow.c (get_core_registers): Update. + * a68v-nat.c (fetch_inferior_registers): Update. + +2002-11-06 Joel Brobecker <brobecker@gnat.com> + + Put in place the framework necessary for multiarching the hppa targets. + * hppa-tdep.c (hppa_gdbarch_init): New function. + (hppa_dump_tdep): New function. + (_initialize_hppa_tdep): Register the hppa gdbarch init function and + tdep structure dumper. + * config/pa/tm-hppa.h (GDB_MULTI_ARCH): New macro, defined to 0 + until the multi-arching conversion has partially been completed. + +2002-11-06 Andrew Cagney <ac131313@redhat.com> + + * valops.c (value_assign): Merge lval_register case into + lval_reg_frame_relative. Use frame_register and + regcache_cooked_write instead of get_saved_register and + write_register_bytes. After flushing the register cache, try to + re-select the selected frame. + +2002-11-06 Andrew Cagney <ac131313@redhat.com> + + * regcache.h (deprecated_register_valid): Rename register_valid. + * regcache.c: Update. + * ia64-aix-nat.c: Update. + * i386gnu-nat.c: Update. + * alpha-nat.c: Update. + * sparc-nat.c: Update. + * lynx-nat.c: Update. + * remote-mips.c: Update. + +2002-11-06 Joel Brobecker <brobecker@gnat.com> + + * hppa-tdep.c (_initialize_hppa_tdep): Move function body + to end of file, to be more consistent with the pratice followed + by other targets. + +2002-11-06 Andrew Cagney <ac131313@redhat.com> + + * infcmd.c: Include "reggroups.h" and <ctype.h>. + (print_float_info): Print registers in float_reggroup. + (print_vector_info): Print registers in vector_reggroup. + (default_print_registers_info): When all, print registers in + all_reggroup. Otherwize, print registers in general_reggroup. + (registers_info): Rewrite. Add support for register groups. + Eliminate a goto. + +2002-11-06 Elena Zannoni <ezannoni@redhat.com> + + * symtab.c (methods_info): Delete. It has been ifdeffed out for + ages. + (symtab_symbol_info): Remove eons old ifdeffed out code. + (_initialize_symtab): Remove prehistoric disabled 'info methods' + command. + +2002-11-06 Theodore A. Roth <troth@openavr.org> + + * c-exp.y: Add missing semi-colons. + * f-exp.y: Add missing semi-colons. + * m2-exp.y: Add missing semi-colons. + * p-exp.y: Add missing semi-colons. + Add empty action to start rule to avoid a type clash error when + building with bison >= 1.50. + +2002-11-06 Jim Blandy <jimb@redhat.com> + + * macrotab.h (struct macro_source_file): Doc fix. + +2002-11-05 Jeff Johnston <jjohnstn@redhat.com> + + * varobj.c (child_exists, cplus_number_of_children): Change + STREQ macro references to strcmp. + (cplus_name_of_child): Change code to handle the fact that + fields are not necessarily contiguous with regards to their + access control. This is a fix for PR gdb/792. + +2002-11-05 Andrew Cagney <ac131313@redhat.com> + + * gdbarch.sh (GET_SAVED_REGISTER): Change to a predicate function. + * gdbarch.h, gdbarch.c: Regnerate. + * frame.h (frame_register): Declare. + * frame.c (frame_register): New function. + (get_saved_register): Test GET_SAVED_REGISTER_P before calling + GET_SAVED_REGISTER, otherwize call + generic_unwind_get_saved_register. + (frame_register_read): Use frame_register instead of + get_saved_register. + +2002-11-05 Elena Zannoni <ezannoni@redhat.com> + + From Jim Ingham <jingham@apple.com>: + * event-top.c (gdb_disable_readline): New function. + (_initialize_event_loop): Move comment. + +2002-11-05 Elena Zannoni <ezannoni@redhat.com> + + * event-loop.c (start_event_loop): Add comment. + Update copyright. + +2002-11-05 Andrew Cagney <ac131313@redhat.com> + + * infcmd.c (default_print_registers_info): Do not call + PRINT_REGISTER_HOOK. + +2002-11-05 Andrew Cagney <ac131313@redhat.com> + + * sparc-tdep.c (sparc_print_register_hook): Make static. + (sparc_print_registers_info): New function. + (sparc_do_registers_info): New function. + (sparclet_print_registers_info): New function. + (sparclet_do_registers_info): New function. + (do_sparc_print_registers_info): New function. + (sparc_print_registers): New static function, clone of infcmd.c's + default_print_registers_info. + * config/sparc/tm-sparclet.h (PRINT_REGISTER_HOOK): Delete macro. + (sparclet_do_registers_info): Declare. + (DEPRECATED_DO_REGISTERS_INFO): Re-define. + * config/sparc/tm-sparc.h (DEPRECATED_DO_REGISTERS_INFO): + Re-define. + (sparc_do_registers_info): Declare. + (PRINT_REGISTER_HOOK): Delete macro. + (sparc_print_register_hook): Delete declaration. + +2002-11-05 David Carlton <carlton@math.stanford.edu> + + * symtab.c (lookup_symbol_aux): Move chunks of code into separate + functions. + (lookup_symbol_aux_local): New function. + (lookup_symbol_aux_symtabs): New function. + (lookup_symbol_aux_psymtabs): New function. + +2002-11-05 David Carlton <carlton@math.stanford.edu> + + * symtab.c (lookup_symbol_aux): In minsym sections, don't use the + previous values of 'objfile' and 'block'. + +2002-11-05 Pierre Muller <muller@ics.u-strasbg.fr> + + * values.c (value_change_enclosing_type): Set + enclosing_type field correctly also for the case where + more memory needs to be allocated. + +2002-11-03 Mark Kettenis <kettenis@gnu.org> + + * i387-tdep.c (i387_print_float_info): Call fputs_filtered instead + of puts_filtered. + + * i387-tdep.c (i387_print_float_info): Replace calls to + register_read and deprecated_read_register_gen with calls to + frame_register_read, and make the necessary adjustments to the + surrounding code. + +2002-11-02 Andrew Cagney <ac131313@redhat.com> + + * gdbarch.sh (register_reggroup_p): Allow default value. + * gdbarch.h, gdbarch.c: Regenerate. + +2002-11-02 Andrew Cagney <ac131313@redhat.com> + + * regcache.h: Add coment indicating replacements for deprecated + functions. + +2002-11-02 Andrew Cagney <cagney@redhat.com> + + * reggroups.h, reggroups.c: New files. + * regcache.c: Include "reggroups.h". + (enum regcache_dump_what): Add `regcache_dump_groups'. + (regcache_dump): Contract size of the "Type" column. When + specified, dump the register's groups. + (maintenance_print_register_groups): New function. + (_initialize_regcache): Add command `maint print register-groups'. + * Makefile.in (COMMON_OBS): Add reggroups.o + (SFILES): Add reggroups.c. + (reggroups_h): Define. + (regcache.o, gdbarch.o): Update dependencies. + (reggroups.o): Specify dependencies. + * gdbarch.sh (register_reggroup_p): Add pure multi-arch method. + Add opaque declaration for `struct reggroup' in generated .h file. + Include "reggroups.h" in generated .c file. + gdbarch.h, gdbarch.c: Re-generate. + +2002-11-02 Andrew Cagney <cagney@redhat.com> + + * regcache.h (deprecated_read_register_gen): Rename + read_register_gen. + (deprecated_write_register_gen): Rename write_register_gen. + * i387-tdep.c: Update. + * x86-64-linux-nat.c: Update + * wince.c: Update. + * thread-db.c: Update. + * win32-nat.c: Update. + * mips-tdep.c: Update. + * d10v-tdep.c: Update. + * cris-tdep.c: Update. + * remote-sim.c: Update. + * remote-rdi.c: Update. + * remote-rdp.c: Update. + * frame.c: Update. + * target.c: Update. + * blockframe.c: Update. + * x86-64-tdep.c: Update. + * xstormy16-tdep.c: Update. + * sh-tdep.c: Update. + * s390-tdep.c: Update. + * rs6000-tdep.c: Update. + * sparc-tdep.c: Update. + * i386-tdep.c: Update. + * dwarf2cfi.c: Update. + * regcache.c: Update. + +2002-11-01 Joel Brobecker <brobecker@gnat.com> + + New interix-specific files: + * config/i386/nm-interix.h: New file. + * config/i386/interix.mh: New file. + * config/i386/interix.mt: New file. + * i386-interix-nat.c: New file. + * i386-interix-tdep.c: New file. + +2002-11-01 Andrew Cagney <cagney@redhat.com> + + * frame.h (deprecated_generic_get_saved_register): Rename + generic_get_saved_register. + * blockframe.c (deprecated_generic_get_saved_register): Update. + * xstormy16-tdep.c (xstormy16_get_saved_register): Update. + (xstormy16_frame_saved_register): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_get_saved_register): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * config/m32r/tm-m32r.h (GET_SAVED_REGISTER): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + +2002-10-31 Daniel Jacobowitz <drow@mvista.com> + + * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step. + +2002-10-31 Daniel Jacobowitz <drow@mvista.com> + + * i386-linux-tdep.c (i386_linux_pc_in_sigtramp): Check for + trampolines in sigaction. + +2002-10-31 Andrew Cagney <cagney@redhat.com> + + * h8300-tdep.c: Include "gdb_assert.h". + (h8300_print_register): Add gdbarch, file and frame parameters. + Use frame_read_unsigned_register to read the register's value. + Use fprintf_filtered to display output. + (h8300_print_registers_info): Replace h8300_do_registers_info. + (h8300_gdbarch_init): Set print_registers_info. + +2002-10-31 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_read_unsigned_register): New function. + (frame_read_signed_register): New function. + * frame.h (frame_read_unsigned_register): Declare. + (frame_read_signed_register): Declare. + +2002-10-31 Andrew Cagney <cagney@redhat.com> + + * h8500-tdep.c (h8500_print_registers_info): New static function, + clone of infcmd.c's default_print_registers_info. + (h8500_do_registers_info): New funtion. + (h8500_print_register_hook): Rename print_register_hook, make + static. + + * config/h8500/tm-h8500.h: Update copyright. + (DEPRECATED_DO_REGISTERS_INFO): Define. + (h8500_do_registers_info: Declare. + (PRINT_REGISTER_HOOK): Delete macro. + (print_register_hook): Delete function. + +2002-10-31 Andrew Cagney <cagney@redhat.com> + + * z8k-tdep.c (z8k_print_register_hook): Make static. + (z8k_print_registers_info): New static function, clone of + infcmd.c's default_print_registers_info. + (z8k_do_registers_info): New function. Wrap + z8k_print_registers_info. + * config/z8k/tm-z8k.h: Update copyright. + (PRINT_REGISTER_HOOK): Delete macro. + (z8k_print_register_hook): Delete declaration. + (DEPRECATED_DO_REGISTERS_INFO): Define. + (z8k_do_registers_info): Declare. + +2002-10-30 Joel Brobecker <brobecker@gnat.com> + + * hppa-tdep.c (find_function_in_inferior): Remove this extern, + as this is already provided by value.h, and was actually causing + a compilation error because of a conflict in parameter type + declaration due to a missing const keyword. + (low_text_segment_addres): Fix a compilation warning. + +2002-10-29 Daniel Jacobowitz <drow@mvista.com> + + * mips-linux-nat.c (mips_linux_cannot_fetch_register): Don't fetch + registers without a name. + (mips_linux_cannot_store_register): Don't store registers without + a name. + +2002-10-28 David Carlton <carlton@math.stanford.edu> + + * symtab.c (find_addr_symbol): Delete. (It was already commented + out.) + * symtab.h: Delete prototype for find_addr_symbol. + +2002-10-26 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_DO_REGISTERS_INFO): Rename + DO_REGISTERS_INFO. + gdbarch.h, gdbarch.c: Re-generate. + * infcmd.c (default_print_registers_info): Update reference. + * mips-tdep.c (mips_gdbarch_init): Set deprecated_do_registers_info. + (mips_dump_tdep): Do not print DO_REGISTERS_INFO. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + +2002-10-26 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c (x86_64_init_abi): Set init_extra_frame_info to + cfi_init_extra_frame_info. + * x86-64-tdep.h (x86_64_init_extra_frame_info): Remove prototype. + * x86-64-linux-tdep.c (x86_64_init_extra_frame_info): Remove function. + + * x86-64-tdep.c (x86_64_init_abi): Add calls to override the i386 + target where necessary. Add more comments and remove the ones + that don't provide any useful information. + + * i386-tdep.c (i386_frame_saved_pc): Replace call to + deprecated_read_register_dummy with + frame_unwind_unsigned_register. + + * i386-tdep.c (i386_extract_struct_value_address): Use + regcache_raw_read_unsigned instead of + regcache_cooked_read_unsigned since we know that the register + we're reading isn't a pseudo register. Rename variable 'val' into + the more descriptive 'addr'. + + * x86-64-tdep.c: Fix some formatting problems, mostly in comments. + (x86_64_push_return_address): Add comment. + (x86_64_pop_frame): Make static. + (examine_argument): Clarify comment. + (x86_64_skip_prologue): Make prolog_expact variable static. + + * dwarf2cfi.c: Fix some formatting problems. + (context_cpy, read_encoded_pointer): Clarify comments. + + * x86-64-tdep.c (x86_64_breakpoint_from_pc): Constify. + (x86_64_init_abi): Move set_gdbarch_* calls that overlap with the + i386 target back into x86_64_gdbarch_init. Add some comments and + remove meaningless ones. + +2002-10-25 Andrew Cagney <cagney@redhat.com> + + * complaints.h (struct deprecated_complaint): Rename `struct + complaint'. + * complaints.c (complain): Update. + * remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Delete + incorrect comment indicating that "symfile.h" was being included + for the `struct complaint' definition. + * remote-vx.c: Update. + * objc-lang.c: Update. + * xcoffread.c: Update. + * hpread.c: Update. + * mdebugread.c: Update. + * stabsread.c: Update. + * dwarf2read.c: Update. + * dwarfread.c: Update. + * elfread.c: Update. + * coffread.c: Update. + * stabsread.h: Update. + * dbxread.c: Update. + * buildsym.c: Update. + * gdbtypes.c: Update. + * macrotab.c: Update. + 2002-11-14 David Carlton <carlton@math.stanford.edu> * Makefile.in (symtab.o): Depend on gdb_assert_h. @@ -174,6 +1058,11 @@ 2002-10-25 Mark Kettenis <kettenis@gnu.org> + * x86-64-tdep.c (x86_64_gdbarch_init): Make a bit more similar to + the version in i386-tdep.c. Move set_gdbarch_* calls out into... + (x86_64_init_abi): ...new function. + + * Makefile.in (i386v-nat.o): Add $(i386_tdep_h). * i386v-nat.c: Include "i386-tdep.h". 2002-10-25 Andrew Cagney <cagney@redhat.com> @@ -501,7 +1390,7 @@ 2002-10-11 Klee Dienes <kdienes@apple.com> - * findvar.c (read_memory_typed_address): New function. + * corefile.c (read_memory_typed_address): New function. * gdbcore.h (read_memory_typed_address): Add prototype. * blockframe.c (sigtramp_saved_pc): Use read_memory_typed_address to read a value destined for a CORE_ADDR, not read_memory_integer. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 07a6a02..2947317f 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -9,6 +9,7 @@ Kevin Buettner kevinb@redhat.com Andrew Cagney ac131313@redhat.com J.T. Conklin jtc@redback.com Fred Fish fnf@ninemoons.com +Daniel Jacobowitz dan@debian.org Mark Kettenis kettenis@gnu.org Peter Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de Stan Shebs shebs@apple.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 91316a9..5c027e5 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -55,6 +55,8 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +DESTDIR = + AR = @AR@ AR_FLAGS = qv RANLIB = @RANLIB@ @@ -536,7 +538,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ charset.c cli-out.c coffread.c complaints.c completer.c corefile.c \ cp-abi.c cp-support.c cp-valprint.c \ dbxread.c demangle.c dictionary.c \ - disasm.c doublest.c dwarfread.c dwarf2read.c \ + disasm.c doublest.c dummy-frame.c dwarfread.c dwarf2read.c \ elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \ f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \ gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ @@ -551,7 +553,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ nlmread.c \ objfiles.c osabi.c \ p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \ - regcache.c remote.c \ + regcache.c reggroups.c remote.c \ scm-exp.c scm-lang.c scm-valprint.c serial.c ser-unix.c source.c \ stabsread.c stack.c std-regs.c symfile.c symmisc.c symtab.c \ target.c thread.c top.c tracepoint.c typeprint.c \ @@ -643,6 +645,7 @@ dictionary_h = dictionary.h disasm_h = disasm.h doublest_h = doublest.h $(floatformat_h) dst_h = dst.h +dummy_frame_h = dummy-frame.h dwarf2cfi_h = dwarf2cfi.h environ_h = environ.h event_loop_h = event-loop.h @@ -701,6 +704,7 @@ ppc_tdep_h = ppc-tdep.h $(osabi_h) ppcnbsd_tdep_h = ppcnbsd-tdep.h proc_utils_h = proc-utils.h regcache_h = regcache.h +reggroups_h = reggroups.h remote_utils_h = remote-utils.h $(target_h) remote_h = remote.h scm_lang_h = scm-lang.h $(scm_tags_h) @@ -831,8 +835,7 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \ 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 \ - charset.o disasm.o \ + charset.o dictionary.o disasm.o dummy-frame.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ @@ -858,7 +861,8 @@ COMMON_OBS = version.o block.o blockframe.o breakpoint.o findvar.o regcache.o \ nlmread.o serial.o mdebugread.o top.o utils.o \ ui-file.o \ frame.o doublest.o \ - gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o + gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o \ + reggroups.o OBS = $(COMMON_OBS) $(ANNOTATE_OBS) @@ -922,9 +926,12 @@ install-only: $(CONFIG_INSTALL) true ; \ fi ; \ $(srcdir)/../mkinstalldirs $(bindir) ; \ - $(INSTALL_PROGRAM) gdb$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \ - $(srcdir)/../mkinstalldirs $(man1dir) ; \ - $(INSTALL_DATA) $(srcdir)/gdb.1 $(man1dir)/$$transformed_name.1 + $(INSTALL_PROGRAM) gdb$(EXEEXT) \ + $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ + $(srcdir)/../mkinstalldirs \ + $(DESTDIR)$(man1dir) ; \ + $(INSTALL_DATA) $(srcdir)/gdb.1 \ + $(DESTDIR)$(man1dir)/$$transformed_name.1 @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do uninstall: force $(CONFIG_UNINSTALL) @@ -1537,7 +1544,7 @@ block.o: block.c $(defs_h) $(block_h) $(gdb_obstack_h) $(cp_support_h) blockframe.o: blockframe.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \ $(objfiles_h) $(frame_h) $(gdbcore_h) $(value_h) $(target_h) \ $(inferior_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \ - $(block_h) + $(dummy_frame_h) $(block_h) breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \ $(gdbtypes_h) $(expression_h) $(gdbcore_h) $(gdbcmd_h) $(value_h) \ $(command_h) $(inferior_h) $(gdbthread_h) $(target_h) $(language_h) \ @@ -1637,6 +1644,8 @@ doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) \ dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) dsrec.o: dsrec.c $(defs_h) $(serial_h) $(srec_h) # OBSOLETE dstread.o: dstread.c +dummy-frame.o: dummy-frame.c $(defs_h) $(dummy_frame_h) $(regcache_h) \ + $(frame_h) $(inferior_h) $(gdb_assert_h) dve3900-rom.o: dve3900-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(inferior_h) $(command_h) $(gdb_string_h) $(regcache_h) dwarf2cfi.o: dwarf2cfi.c $(defs_h) $(gdbcore_h) $(symtab_h) $(symfile_h) \ @@ -1686,7 +1695,8 @@ fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \ $(terminal_h) $(gdbthread_h) $(command_h) # OBSOLETE fr30-tdep.o: fr30-tdep.c frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ - $(regcache_h) $(gdb_assert_h) + $(regcache_h) $(gdb_assert_h) $(gdb_obstack_h) $(dummy_frame_h) \ + $(gdbcore_h) $(annotate_h) frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(regcache_h) gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \ @@ -1697,7 +1707,7 @@ gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \ $(gdb_string_h) $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) \ $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(gdbthread_h) \ $(annotate_h) $(symfile_h) $(value_h) $(symcat_h) $(floatformat_h) \ - $(gdb_assert_h) $(gdb_string_h) $(gdb_events_h) + $(gdb_assert_h) $(gdb_string_h) $(gdb_events_h) $(reggroups_h) gdbtypes.o: gdbtypes.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(expression_h) \ $(language_h) $(target_h) $(value_h) $(demangle_h) $(complaints_h) \ @@ -1727,7 +1737,7 @@ hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \ hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \ $(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \ $(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \ - $(symfile_h) $(objfiles_h) + $(symfile_h) $(objfiles_h) $(language_h) hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(gdb_wait_h) $(regcache_h) @@ -1775,7 +1785,7 @@ i386obsd-nat.o: i386obsd-nat.c $(defs_h) i386obsd-tdep.o: i386obsd-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \ $(regcache_h) $(i386_tdep_h) $(i387_tdep_h) i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \ - $(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h) + $(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h) $(i386_tdep_h) i386v4-nat.o: i386v4-nat.c $(defs_h) $(value_h) $(inferior_h) $(regcache_h) \ $(i386_tdep_h) $(i387_tdep_h) $(gregset_h) i387-tdep.o: i387-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \ @@ -1881,7 +1891,7 @@ macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) $(macroscope_h) \ macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \ $(macroexp_h) $(gdb_assert_h) macroscope.o: macroscope.c $(defs_h) $(macroscope_h) $(symtab_h) $(target_h) \ - $(frame_h) $(inferior_h) $(source_h) + $(frame_h) $(inferior_h) $(source_h) $(complaints_h) macrotab.o: macrotab.c $(defs_h) $(gdb_obstack_h) $(splay_tree_h) \ $(symtab_h) $(symfile_h) $(objfiles_h) $(macrotab_h) $(gdb_assert_h) \ $(bcache_h) $(complaints_h) @@ -2017,8 +2027,10 @@ procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ ptx4-nat.o: ptx4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) \ $(gregset_h) regcache.o: regcache.c $(defs_h) $(inferior_h) $(target_h) $(gdbarch_h) \ - $(gdbcmd_h) $(regcache_h) $(gdb_assert_h) $(gdb_string_h) \ - $(gdbcmd_h) + $(gdbcmd_h) $(regcache_h) $(reggroups_h) $(gdb_assert_h) \ + $(gdb_string_h) $(gdbcmd_h) +reggroups.o: reggroups.c $(defs_h) $(reggroups_h) $(gdbtypes_h) \ + $(gdb_assert_h) $(regcache_h) $(command_h) $(gdbcmd_h) remote-array.o: remote-array.c $(defs_h) $(gdbcore_h) $(target_h) \ $(gdb_string_h) $(command_h) $(serial_h) $(monitor_h) \ $(remote_utils_h) $(inferior_h) $(version_h) $(regcache_h) @@ -2362,20 +2374,25 @@ install-gdbtk: true ; \ fi ; \ $(SHELL) $(srcdir)/../mkinstalldirs $(bindir); \ - $(INSTALL_PROGRAM) insight$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \ - $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY) ; \ - $(SHELL) $(srcdir)/../mkinstalldirs $(libdir)/insight$(GDBTK_VERSION) ; \ - $(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl $(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \ + $(INSTALL_PROGRAM) insight$(EXEEXT) \ + $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(DESTDIR)$(GDBTK_LIBRARY) ; \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(DESTDIR)$(libdir)/insight$(GDBTK_VERSION) ; \ + $(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl \ + $(DESTDIR)$(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(DESTDIR)$(GDBTK_LIBRARY)/images \ + $(DESTDIR)$(GDBTK_LIBRARY)/images2 ; \ $(SHELL) $(srcdir)/../mkinstalldirs \ - $(GDBTK_LIBRARY)/images \ - $(GDBTK_LIBRARY)/images2 ; \ - $(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY)/help \ - $(GDBTK_LIBRARY)/help/images \ - $(GDBTK_LIBRARY)/help/trace ; \ + $(DESTDIR)$(GDBTK_LIBRARY)/help \ + $(DESTDIR)$(GDBTK_LIBRARY)/help/images \ + $(DESTDIR)$(GDBTK_LIBRARY)/help/trace ; \ cd $(srcdir)/gdbtk/library ; \ for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html help/trace/*.html help/trace/index.toc help/images/*.gif; \ do \ - $(INSTALL_DATA) $$i $(GDBTK_LIBRARY)/$$i ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(GDBTK_LIBRARY)/$$i ; \ done ; uninstall-gdbtk: @@ -2386,8 +2403,8 @@ uninstall-gdbtk: else \ true ; \ fi ; \ - rm -f $(bindir)/$$transformed_name$(EXEEXT) ; \ - rm -rf $(GDBTK_LIBRARY) + rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ + rm -rf $(DESTDIR)$(GDBTK_LIBRARY) clean-gdbtk: rm -f insight$(EXEEXT) diff --git a/gdb/PROBLEMS b/gdb/PROBLEMS index 4c460d6..b2f45d8 100644 --- a/gdb/PROBLEMS +++ b/gdb/PROBLEMS @@ -50,3 +50,18 @@ i386-*-freebsd4.4* gdb/455: GDB doesn't build on a FreeBSD 4.4-STABLE system. The problem is still being investigated. + +alpha*-*-osf* +------------- + +gdb/816: When building GDB with GCC 3.0.1, GDB is unable to load a core +file properly. It generates several errors and warnings regarding +unhandled core file section types, incorrect endianness, the failure to +load the registers. Are also incorrectly reported: The program name, the +cause of the program death, and the call stack at the moment of the +death. This problem has been reported on alpha-osf4.0f and alpha-osf5.1a. +To work-around the problem, add -D__digital__ to the CFLAGS when +building GDB vis: + + $ make CFLAGS='-O2 -D__digital__' + diff --git a/gdb/a68v-nat.c b/gdb/a68v-nat.c index 4cc25ce..0bfe8e2 100644 --- a/gdb/a68v-nat.c +++ b/gdb/a68v-nat.c @@ -41,7 +41,7 @@ fetch_inferior_registers (int ignored) ptrace_$init_control (&inferior_control_registers); inferior_fp_registers.size = sizeof (inferior_fp_registers); - registers_fetched (); + deprecated_registers_fetched (); ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, @@ -61,11 +61,14 @@ fetch_inferior_registers (int ignored) (PTRACE_ARG3_TYPE) & inferior_control_registers, ptrace_$control_set_m68k); - bcopy (&inferior_registers, registers, 16 * 4); - bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], + bcopy (&inferior_registers, &deprecated_registers[0], 16 * 4); + bcopy (&inferior_fp_registers, + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], sizeof inferior_fp_registers.regs); - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_control_registers.sr; - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_control_registers.pc; + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)] + = inferior_control_registers.sr; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)] + = inferior_control_registers.pc; } /* Store our register values back into the inferior. @@ -94,13 +97,16 @@ store_inferior_registers (int regno) (PTRACE_ARG3_TYPE) & inferior_control_registers, ptrace_$control_set_m68k); - bcopy (registers, &inferior_registers, sizeof (inferior_registers)); + bcopy (&deprecated_registers[0], &inferior_registers, + sizeof (inferior_registers)); - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], inferior_fp_registers.regs, - sizeof inferior_fp_registers.regs); + bcopy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + inferior_fp_registers.regs, sizeof inferior_fp_registers.regs); - inferior_control_registers.sr = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_control_registers.pc = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; + inferior_control_registers.sr + = *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)]; + inferior_control_registers.pc + = *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2843aeb..2d46699a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4131,6 +4131,7 @@ fill_in_ada_prototype (struct symbol *func) case LOC_REGPARM_ADDR: TYPE_FIELD_BITPOS (ftype, nargs) = nargs; TYPE_FIELD_BITSIZE (ftype, nargs) = 0; + TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0; TYPE_FIELD_TYPE (ftype, nargs) = lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym))); TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym); @@ -4144,6 +4145,7 @@ fill_in_ada_prototype (struct symbol *func) case LOC_BASEREG_ARG: TYPE_FIELD_BITPOS (ftype, nargs) = nargs; TYPE_FIELD_BITSIZE (ftype, nargs) = 0; + TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0; TYPE_FIELD_TYPE (ftype, nargs) = check_typedef (SYMBOL_TYPE (sym)); TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym); nargs += 1; @@ -4981,7 +4983,7 @@ find_printable_frame (struct frame_info *fi, int level) find_pc_line (fi->pc, fi->next != NULL && !fi->next->signal_handler_caller - && !frame_in_dummy (fi->next)); + && !deprecated_frame_in_dummy (fi->next)); if (sal.symtab && !is_ada_runtime_file (sal.symtab->filename)) { #if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET) @@ -5987,6 +5989,7 @@ template_to_fixed_record_type (struct type *type, char *valaddr, * rediscover why we needed field_offset and fix it properly. */ TYPE_FIELD_BITPOS (rtype, f) = off; TYPE_FIELD_BITSIZE (rtype, f) = 0; + TYPE_FIELD_STATIC_KIND (rtype, f) = 0; if (ada_is_variant_part (type, f)) { @@ -6090,6 +6093,7 @@ template_to_static_fixed_type (struct type *templ_type) { TYPE_FIELD_BITPOS (type, f) = 0; TYPE_FIELD_BITSIZE (type, f) = 0; + TYPE_FIELD_STATIC_KIND (type, f) = 0; if (is_dynamic_field (templ_type, f)) { @@ -6159,6 +6163,7 @@ to_record_with_fixed_variant_part (struct type *type, char *valaddr, TYPE_FIELD_TYPE (rtype, nfields - 1) = branch_type; TYPE_FIELD_NAME (rtype, nfields - 1) = "S"; TYPE_FIELD_BITSIZE (rtype, nfields - 1) = 0; + TYPE_FIELD_STATIC_KIND (rtype, nfields - 1) = 0; TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type); -TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1)); } diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c index 580dcc0..6d7a3d6 100644 --- a/gdb/alpha-nat.c +++ b/gdb/alpha-nat.c @@ -133,19 +133,21 @@ fetch_elf_core_registers (char *core_reg_sect, unsigned core_reg_size, if (which == 2) { /* The FPU Registers. */ - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31 * 8); - memset (®isters[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8); - memset (®ister_valid[FP0_REGNUM], 1, 32); + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + core_reg_sect, 31 * 8); + memset (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8); + memset (&deprecated_register_valid[FP0_REGNUM], 1, 32); } else { /* The General Registers. */ - memcpy (®isters[REGISTER_BYTE (ALPHA_V0_REGNUM)], core_reg_sect, - 31 * 8); - memcpy (®isters[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8); - memset (®isters[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8); - memset (®ister_valid[ALPHA_V0_REGNUM], 1, 32); - register_valid[PC_REGNUM] = 1; + memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_V0_REGNUM)], + core_reg_sect, 31 * 8); + memcpy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)], + core_reg_sect + 31 * 8, 8); + memset (&deprecated_registers[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8); + memset (&deprecated_register_valid[ALPHA_V0_REGNUM], 1, 32); + deprecated_register_valid[PC_REGNUM] = 1; } } @@ -209,10 +211,10 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) for (regi = 0; regi < 31; regi++) if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(long *) ®isters[REGISTER_BYTE (regi)]; + *(regp + regi) = *(long *) &deprecated_registers[REGISTER_BYTE (regi)]; if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + 31) = *(long *) ®isters[REGISTER_BYTE (PC_REGNUM)]; + *(regp + 31) = *(long *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; } /* @@ -241,7 +243,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) if ((regno == -1) || (regno == regi)) { *(regp + regi - FP0_REGNUM) = - *(long *) ®isters[REGISTER_BYTE (regi)]; + *(long *) &deprecated_registers[REGISTER_BYTE (regi)]; } } } diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 1003eed..277b5ca 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1546,7 +1546,7 @@ alpha_store_return_value (struct type *valtype, char *valbuf) else memcpy (raw_buffer, valbuf, length); - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length); } /* Just like reinit_frame_cache, but with the right arguments to be diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a056177..732c40b 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -99,7 +99,7 @@ legacy_extract_return_value (struct type *type, struct regcache *regcache, { char *registers = deprecated_grub_regcache_for_registers (regcache); bfd_byte *buf = valbuf; - DEPRECATED_EXTRACT_RETURN_VALUE (type, registers, buf); + DEPRECATED_EXTRACT_RETURN_VALUE (type, registers, buf); /* OK */ } /* Implementation of store return value that grubs the register cache. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 82444d1..2adce63 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2401,13 +2401,14 @@ arm_store_return_value (struct type *type, char *valbuf) case ARM_FLOAT_FPA: convert_to_extended (valbuf, buf); - write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf, - FP_REGISTER_RAW_SIZE); + deprecated_write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf, + FP_REGISTER_RAW_SIZE); break; case ARM_FLOAT_SOFT: case ARM_FLOAT_SOFT_VFP: - write_register_bytes (ARM_A1_REGNUM, valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (ARM_A1_REGNUM, valbuf, + TYPE_LENGTH (type)); break; default: @@ -2418,7 +2419,8 @@ arm_store_return_value (struct type *type, char *valbuf) } } else - write_register_bytes (ARM_A1_REGNUM, valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (ARM_A1_REGNUM, valbuf, + TYPE_LENGTH (type)); } /* Store the address of the place in which to copy the structure the @@ -2858,7 +2860,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_return_address (gdbarch, arm_push_return_address); #endif - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_push_arguments (gdbarch, arm_push_arguments); set_gdbarch_coerce_float_to_double (gdbarch, standard_coerce_float_to_double); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 901927b..4177409 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -36,27 +36,10 @@ #include "annotate.h" #include "regcache.h" #include "gdb_assert.h" +#include "dummy-frame.h" /* Prototypes for exported functions. */ -static void generic_call_dummy_register_unwind (struct frame_info *frame, - void **cache, - int regnum, - int *optimized, - enum lval_type *lval, - CORE_ADDR *addrp, - int *realnum, - void *raw_buffer); -static void frame_saved_regs_register_unwind (struct frame_info *frame, - void **cache, - int regnum, - int *optimized, - enum lval_type *lval, - CORE_ADDR *addrp, - int *realnum, - void *buffer); - - void _initialize_blockframe (void); /* A default FRAME_CHAIN_VALID, in the form that is suitable for most @@ -182,140 +165,6 @@ inside_entry_func (CORE_ADDR pc) symfile_objfile->ei.entry_func_highpc > pc); } -/* Info about the innermost stack frame (contents of FP register) */ - -static struct frame_info *current_frame; - -/* Cache for frame addresses already read by gdb. Valid only while - inferior is stopped. Control variables for the frame cache should - be local to this module. */ - -static struct obstack frame_cache_obstack; - -void * -frame_obstack_alloc (unsigned long size) -{ - return obstack_alloc (&frame_cache_obstack, size); -} - -void -frame_saved_regs_zalloc (struct frame_info *fi) -{ - fi->saved_regs = (CORE_ADDR *) - frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); - memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); -} - - -/* Return the innermost (currently executing) stack frame. */ - -struct frame_info * -get_current_frame (void) -{ - if (current_frame == NULL) - { - if (target_has_stack) - current_frame = create_new_frame (read_fp (), read_pc ()); - else - error ("No stack."); - } - return current_frame; -} - -void -set_current_frame (struct frame_info *frame) -{ - current_frame = frame; -} - - -/* Using the PC, select a mechanism for unwinding a frame returning - the previous frame. The register unwind function should, on - demand, initialize the ->context object. */ - -static void -set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp, - frame_register_unwind_ftype **unwind) -{ - if (!USE_GENERIC_DUMMY_FRAMES) - /* Still need to set this to something. The ``info frame'' code - calls this function to find out where the saved registers are. - Hopefully this is robust enough to stop any core dumps and - return vaguely correct values.. */ - *unwind = frame_saved_regs_register_unwind; - else if (PC_IN_CALL_DUMMY (pc, fp, fp)) - *unwind = generic_call_dummy_register_unwind; - else - *unwind = frame_saved_regs_register_unwind; -} - -/* Create an arbitrary (i.e. address specified by user) or innermost frame. - Always returns a non-NULL value. */ - -struct frame_info * -create_new_frame (CORE_ADDR addr, CORE_ADDR pc) -{ - struct frame_info *fi; - char *name; - - fi = (struct frame_info *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_info)); - - /* Zero all fields by default. */ - memset (fi, 0, sizeof (struct frame_info)); - - fi->frame = addr; - fi->pc = pc; - find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); - fi->signal_handler_caller = PC_IN_SIGTRAMP (fi->pc, name); - - if (INIT_EXTRA_FRAME_INFO_P ()) - INIT_EXTRA_FRAME_INFO (0, fi); - - /* Select/initialize an unwind function. */ - set_unwind_by_pc (fi->pc, fi->frame, &fi->register_unwind); - - return fi; -} - -/* Return the frame that FRAME calls (NULL if FRAME is the innermost - frame). */ - -struct frame_info * -get_next_frame (struct frame_info *frame) -{ - return frame->next; -} - -/* Flush the entire frame cache. */ - -void -flush_cached_frames (void) -{ - /* Since we can't really be sure what the first object allocated was */ - obstack_free (&frame_cache_obstack, 0); - obstack_init (&frame_cache_obstack); - - current_frame = NULL; /* Invalidate cache */ - select_frame (NULL); - annotate_frames_invalid (); -} - -/* Flush the frame cache, and start a new one if necessary. */ - -void -reinit_frame_cache (void) -{ - flush_cached_frames (); - - /* FIXME: The inferior_ptid test is wrong if there is a corefile. */ - if (PIDGET (inferior_ptid) != 0) - { - select_frame (get_current_frame ()); - } -} - /* Return nonzero if the function for this frame lacks a prologue. Many machines can define FRAMELESS_FUNCTION_INVOCATION to just call this function. */ @@ -347,188 +196,6 @@ frameless_look_for_prologue (struct frame_info *frame) return 0; } -/* Return a structure containing various interesting information - about the frame that called NEXT_FRAME. Returns NULL - if there is no such frame. */ - -struct frame_info * -get_prev_frame (struct frame_info *next_frame) -{ - CORE_ADDR address = 0; - struct frame_info *prev; - int fromleaf = 0; - char *name; - - /* If the requested entry is in the cache, return it. - Otherwise, figure out what the address should be for the entry - we're about to add to the cache. */ - - if (!next_frame) - { -#if 0 - /* This screws value_of_variable, which just wants a nice clean - NULL return from block_innermost_frame if there are no frames. - I don't think I've ever seen this message happen otherwise. - And returning NULL here is a perfectly legitimate thing to do. */ - if (!current_frame) - { - error ("You haven't set up a process's stack to examine."); - } -#endif - - return current_frame; - } - - /* If we have the prev one, return it */ - if (next_frame->prev) - return next_frame->prev; - - /* On some machines it is possible to call a function without - setting up a stack frame for it. On these machines, we - define this macro to take two args; a frameinfo pointer - identifying a frame and a variable to set or clear if it is - or isn't leafless. */ - - /* Still don't want to worry about this except on the innermost - frame. This macro will set FROMLEAF if NEXT_FRAME is a - frameless function invocation. */ - if (!(next_frame->next)) - { - fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame); - if (fromleaf) - address = FRAME_FP (next_frame); - } - - if (!fromleaf) - { - /* Two macros defined in tm.h specify the machine-dependent - actions to be performed here. - First, get the frame's chain-pointer. - If that is zero, the frame is the outermost frame or a leaf - called by the outermost frame. This means that if start - calls main without a frame, we'll return 0 (which is fine - anyway). - - Nope; there's a problem. This also returns when the current - routine is a leaf of main. This is unacceptable. We move - this to after the ffi test; I'd rather have backtraces from - start go curfluy than have an abort called from main not show - main. */ - address = FRAME_CHAIN (next_frame); - - /* FIXME: cagney/2002-06-08: There should be two tests here. - The first would check for a valid frame chain based on a user - selectable policy. The default being ``stop at main'' (as - implemented by generic_func_frame_chain_valid()). Other - policies would be available - stop at NULL, .... The second - test, if provided by the target architecture, would check for - more exotic cases - most target architectures wouldn't bother - with this second case. */ - if (!FRAME_CHAIN_VALID (address, next_frame)) - return 0; - } - if (address == 0) - return 0; - - prev = (struct frame_info *) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_info)); - - /* Zero all fields by default. */ - memset (prev, 0, sizeof (struct frame_info)); - - if (next_frame) - next_frame->prev = prev; - prev->next = next_frame; - prev->frame = address; - prev->level = next_frame->level + 1; - -/* This change should not be needed, FIXME! We should - determine whether any targets *need* INIT_FRAME_PC to happen - after INIT_EXTRA_FRAME_INFO and come up with a simple way to - express what goes on here. - - INIT_EXTRA_FRAME_INFO is called from two places: create_new_frame - (where the PC is already set up) and here (where it isn't). - INIT_FRAME_PC is only called from here, always after - INIT_EXTRA_FRAME_INFO. - - The catch is the MIPS, where INIT_EXTRA_FRAME_INFO requires the PC - value (which hasn't been set yet). Some other machines appear to - require INIT_EXTRA_FRAME_INFO before they can do INIT_FRAME_PC. Phoo. - - We shouldn't need INIT_FRAME_PC_FIRST to add more complication to - an already overcomplicated part of GDB. gnu@cygnus.com, 15Sep92. - - Assuming that some machines need INIT_FRAME_PC after - INIT_EXTRA_FRAME_INFO, one possible scheme: - - SETUP_INNERMOST_FRAME() - Default version is just create_new_frame (read_fp ()), - read_pc ()). Machines with extra frame info would do that (or the - local equivalent) and then set the extra fields. - SETUP_ARBITRARY_FRAME(argc, argv) - Only change here is that create_new_frame would no longer init extra - frame info; SETUP_ARBITRARY_FRAME would have to do that. - INIT_PREV_FRAME(fromleaf, prev) - Replace INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC. This should - also return a flag saying whether to keep the new frame, or - whether to discard it, because on some machines (e.g. mips) it - is really awkward to have FRAME_CHAIN_VALID called *before* - INIT_EXTRA_FRAME_INFO (there is no good way to get information - deduced in FRAME_CHAIN_VALID into the extra fields of the new frame). - std_frame_pc(fromleaf, prev) - This is the default setting for INIT_PREV_FRAME. It just does what - the default INIT_FRAME_PC does. Some machines will call it from - INIT_PREV_FRAME (either at the beginning, the end, or in the middle). - Some machines won't use it. - kingdon@cygnus.com, 13Apr93, 31Jan94, 14Dec94. */ - - INIT_FRAME_PC_FIRST (fromleaf, prev); - - if (INIT_EXTRA_FRAME_INFO_P ()) - INIT_EXTRA_FRAME_INFO (fromleaf, prev); - - /* This entry is in the frame queue now, which is good since - FRAME_SAVED_PC may use that queue to figure out its value - (see tm-sparc.h). We want the pc saved in the inferior frame. */ - INIT_FRAME_PC (fromleaf, prev); - - /* If ->frame and ->pc are unchanged, we are in the process of getting - ourselves into an infinite backtrace. Some architectures check this - in FRAME_CHAIN or thereabouts, but it seems like there is no reason - this can't be an architecture-independent check. */ - if (next_frame != NULL) - { - if (prev->frame == next_frame->frame - && prev->pc == next_frame->pc) - { - next_frame->prev = NULL; - obstack_free (&frame_cache_obstack, prev); - return NULL; - } - } - - /* Initialize the code used to unwind the frame PREV based on the PC - (and probably other architectural information). The PC lets you - check things like the debug info at that point (dwarf2cfi?) and - use that to decide how the frame should be unwound. */ - set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind); - - find_pc_partial_function (prev->pc, &name, - (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); - if (PC_IN_SIGTRAMP (prev->pc, name)) - prev->signal_handler_caller = 1; - - return prev; -} - -CORE_ADDR -get_frame_pc (struct frame_info *frame) -{ - return frame->pc; -} - /* return the address of the PC for the given FRAME, ie the current PC value if FRAME is the innermost frame, or the address adjusted to point to the call instruction if not. */ @@ -550,34 +217,6 @@ frame_address_in_block (struct frame_info *frame) return pc; } -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated. This is a compatibility function for targets - that do not yet implement FRAME_INIT_SAVED_REGS. */ -/* Find the addresses in which registers are saved in FRAME. */ - -void -get_frame_saved_regs (struct frame_info *frame, - struct frame_saved_regs *saved_regs_addr) -{ - if (frame->saved_regs == NULL) - { - frame->saved_regs = (CORE_ADDR *) - frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); - } - if (saved_regs_addr == NULL) - { - struct frame_saved_regs saved_regs; - FRAME_FIND_SAVED_REGS (frame, saved_regs); - memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS); - } - else - { - FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); - memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS); - } -} -#endif - /* Return the innermost lexical block in execution in a specified stack frame. The frame address is assumed valid. @@ -1030,7 +669,7 @@ sigtramp_saved_pc (struct frame_info *frame) { CORE_ADDR sigcontext_addr; char *buf; - int ptrbytes = TARGET_PTR_BIT / TARGET_CHAR_BIT; + int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr); int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; buf = alloca (ptrbytes); @@ -1046,7 +685,7 @@ sigtramp_saved_pc (struct frame_info *frame) /* Don't cause a memory_error when accessing sigcontext in case the stack layout has changed or the stack is corrupt. */ target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); - return extract_typed_address (buf, builtin_type_void_data_ptr); + return extract_typed_address (buf, builtin_type_void_func_ptr); } #endif /* SIGCONTEXT_PC_OFFSET */ @@ -1108,244 +747,6 @@ pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp, } -/* - * GENERIC DUMMY FRAMES - * - * The following code serves to maintain the dummy stack frames for - * inferior function calls (ie. when gdb calls into the inferior via - * call_function_by_hand). This code saves the machine state before - * the call in host memory, so we must maintain an independent stack - * and keep it consistant etc. I am attempting to make this code - * generic enough to be used by many targets. - * - * The cheapest and most generic way to do CALL_DUMMY on a new target - * is probably to define CALL_DUMMY to be empty, CALL_DUMMY_LENGTH to - * zero, and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember - * to define PUSH_RETURN_ADDRESS, because no call instruction will be - * being executed by the target. Also FRAME_CHAIN_VALID as - * generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as - * generic_fix_call_dummy. */ - -/* Dummy frame. This saves the processor state just prior to setting - up the inferior function call. Older targets save the registers - on the target stack (but that really slows down function calls). */ - -struct dummy_frame -{ - struct dummy_frame *next; - - CORE_ADDR pc; - CORE_ADDR fp; - CORE_ADDR sp; - CORE_ADDR top; - struct regcache *regcache; - - /* Address range of the call dummy code. Look for PC in the range - [LO..HI) (after allowing for DECR_PC_AFTER_BREAK). */ - CORE_ADDR call_lo; - CORE_ADDR call_hi; -}; - -static struct dummy_frame *dummy_frame_stack = NULL; - -/* Function: find_dummy_frame(pc, fp, sp) - - Search the stack of dummy frames for one matching the given PC and - FP/SP. Unlike PC_IN_CALL_DUMMY, this function doesn't need to - adjust for DECR_PC_AFTER_BREAK. This is because it is only legal - to call this function after the PC has been adjusted. */ - -static struct regcache * -generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) -{ - struct dummy_frame *dummyframe; - - for (dummyframe = dummy_frame_stack; dummyframe != NULL; - dummyframe = dummyframe->next) - { - /* Does the PC fall within the dummy frame's breakpoint - instruction. If not, discard this one. */ - if (!(pc >= dummyframe->call_lo && pc < dummyframe->call_hi)) - continue; - /* Does the FP match? */ - if (dummyframe->top != 0) - { - /* If the target architecture explicitly saved the - top-of-stack before the inferior function call, assume - that that same architecture will always pass in an FP - (frame base) value that eactly matches that saved TOS. - Don't check the saved SP and SP as they can lead to false - hits. */ - if (fp != dummyframe->top) - continue; - } - else - { - /* An older target that hasn't explicitly or implicitly - saved the dummy frame's top-of-stack. Try matching the - FP against the saved SP and FP. NOTE: If you're trying - to fix a problem with GDB not correctly finding a dummy - frame, check the comments that go with FRAME_ALIGN() and - SAVE_DUMMY_FRAME_TOS(). */ - if (fp != dummyframe->fp && fp != dummyframe->sp) - continue; - } - /* The FP matches this dummy frame. */ - return dummyframe->regcache; - } - - return 0; -} - -char * -deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) -{ - struct regcache *regcache = generic_find_dummy_frame (pc, fp); - if (regcache == NULL) - return NULL; - return deprecated_grub_regcache_for_registers (regcache); -} - -/* Function: pc_in_call_dummy (pc, sp, fp) - - Return true if the PC falls in a dummy frame created by gdb for an - inferior call. The code below which allows DECR_PC_AFTER_BREAK is - for infrun.c, which may give the function a PC without that - subtracted out. */ - -int -generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) -{ - struct dummy_frame *dummyframe; - for (dummyframe = dummy_frame_stack; - dummyframe != NULL; - dummyframe = dummyframe->next) - { - if ((pc >= dummyframe->call_lo) - && (pc < dummyframe->call_hi + DECR_PC_AFTER_BREAK)) - return 1; - } - return 0; -} - -/* Function: read_register_dummy - Find a saved register from before GDB calls a function in the inferior */ - -CORE_ADDR -deprecated_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) -{ - struct regcache *dummy_regs = generic_find_dummy_frame (pc, fp); - - if (dummy_regs) - { - /* NOTE: cagney/2002-08-12: Replaced a call to - regcache_raw_read_as_address() with a call to - regcache_cooked_read_unsigned(). The old, ...as_address - function was eventually calling extract_unsigned_integer (via - extract_address) to unpack the registers value. The below is - doing an unsigned extract so that it is functionally - equivalent. The read needs to be cooked as, otherwise, it - will never correctly return the value of a register in the - [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) range. */ - ULONGEST val; - regcache_cooked_read_unsigned (dummy_regs, regno, &val); - return val; - } - else - return 0; -} - -/* Save all the registers on the dummy frame stack. Most ports save the - registers on the target stack. This results in lots of unnecessary memory - references, which are slow when debugging via a serial line. Instead, we - save all the registers internally, and never write them to the stack. The - registers get restored when the called function returns to the entry point, - where a breakpoint is laying in wait. */ - -void -generic_push_dummy_frame (void) -{ - struct dummy_frame *dummy_frame; - CORE_ADDR fp = (get_current_frame ())->frame; - - /* check to see if there are stale dummy frames, - perhaps left over from when a longjump took us out of a - function that was called by the debugger */ - - dummy_frame = dummy_frame_stack; - while (dummy_frame) - if (INNER_THAN (dummy_frame->fp, fp)) /* stale -- destroy! */ - { - dummy_frame_stack = dummy_frame->next; - regcache_xfree (dummy_frame->regcache); - xfree (dummy_frame); - dummy_frame = dummy_frame_stack; - } - else - dummy_frame = dummy_frame->next; - - dummy_frame = xmalloc (sizeof (struct dummy_frame)); - dummy_frame->regcache = regcache_xmalloc (current_gdbarch); - - dummy_frame->pc = read_pc (); - dummy_frame->sp = read_sp (); - dummy_frame->top = 0; - dummy_frame->fp = fp; - regcache_cpy (dummy_frame->regcache, current_regcache); - dummy_frame->next = dummy_frame_stack; - dummy_frame_stack = dummy_frame; -} - -void -generic_save_dummy_frame_tos (CORE_ADDR sp) -{ - dummy_frame_stack->top = sp; -} - -/* Record the upper/lower bounds on the address of the call dummy. */ - -void -generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi) -{ - dummy_frame_stack->call_lo = lo; - dummy_frame_stack->call_hi = hi; -} - -/* Restore the machine state from either the saved dummy stack or a - real stack frame. */ - -void -generic_pop_current_frame (void (*popper) (struct frame_info * frame)) -{ - struct frame_info *frame = get_current_frame (); - - if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - generic_pop_dummy_frame (); - else - (*popper) (frame); -} - -/* Function: pop_dummy_frame - Restore the machine state from a saved dummy stack frame. */ - -void -generic_pop_dummy_frame (void) -{ - struct dummy_frame *dummy_frame = dummy_frame_stack; - - /* FIXME: what if the first frame isn't the right one, eg.. - because one call-by-hand function has done a longjmp into another one? */ - - if (!dummy_frame) - error ("Can't pop dummy frame!"); - dummy_frame_stack = dummy_frame->next; - regcache_cpy (current_regcache, dummy_frame->regcache); - flush_cached_frames (); - - regcache_xfree (dummy_frame->regcache); - xfree (dummy_frame); -} - /* Function: frame_chain_valid Returns true for a user frame or a call_function_by_hand dummy frame, and false for the CRT0 start-up frame. Purpose is to terminate backtrace */ @@ -1374,256 +775,3 @@ generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) && !inside_entry_func ((fi)->pc)); } -/* Function: fix_call_dummy - Stub function. Generic dummy frames typically do not need to fix - the frame being created */ - -void -generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, - struct value **args, struct type *type, int gcc_p) -{ - return; -} - -/* Given a call-dummy dummy-frame, return the registers. Here the - register value is taken from the local copy of the register buffer. */ - -static void -generic_call_dummy_register_unwind (struct frame_info *frame, void **cache, - int regnum, int *optimized, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnum, void *bufferp) -{ - gdb_assert (frame != NULL); - gdb_assert (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)); - - /* Describe the register's location. Generic dummy frames always - have the register value in an ``expression''. */ - *optimized = 0; - *lvalp = not_lval; - *addrp = 0; - *realnum = -1; - - /* If needed, find and return the value of the register. */ - if (bufferp != NULL) - { - struct regcache *registers; -#if 1 - /* Get the address of the register buffer that contains all the - saved registers for this dummy frame. Cache that address. */ - registers = (*cache); - if (registers == NULL) - { - registers = generic_find_dummy_frame (frame->pc, frame->frame); - (*cache) = registers; - } -#else - /* Get the address of the register buffer that contains the - saved registers and then extract the value from that. */ - registers = generic_find_dummy_frame (frame->pc, frame->frame); -#endif - gdb_assert (registers != NULL); - /* Return the actual value. */ - /* Use the regcache_cooked_read() method so that it, on the fly, - constructs either a raw or pseudo register from the raw - register cache. */ - regcache_cooked_read (registers, regnum, bufferp); - } -} - -/* Return the register saved in the simplistic ``saved_regs'' cache. - If the value isn't here AND a value is needed, try the next inner - most frame. */ - -static void -frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *bufferp) -{ - /* There is always a frame at this point. And THIS is the frame - we're interested in. */ - gdb_assert (frame != NULL); - /* If we're using generic dummy frames, we'd better not be in a call - dummy. (generic_call_dummy_register_unwind ought to have been called - instead.) */ - gdb_assert (!(USE_GENERIC_DUMMY_FRAMES - && PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))); - - /* Load the saved_regs register cache. */ - if (frame->saved_regs == NULL) - FRAME_INIT_SAVED_REGS (frame); - - if (frame->saved_regs != NULL - && frame->saved_regs[regnum] != 0) - { - if (regnum == SP_REGNUM) - { - /* SP register treated specially. */ - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (bufferp != NULL) - store_address (bufferp, REGISTER_RAW_SIZE (regnum), - frame->saved_regs[regnum]); - } - else - { - /* Any other register is saved in memory, fetch it but cache - a local copy of its value. */ - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = frame->saved_regs[regnum]; - *realnump = -1; - if (bufferp != NULL) - { -#if 1 - /* Save each register value, as it is read in, in a - frame based cache. */ - void **regs = (*cache); - if (regs == NULL) - { - int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS) - * sizeof (void *)); - regs = frame_obstack_alloc (sizeof_cache); - memset (regs, 0, sizeof_cache); - (*cache) = regs; - } - if (regs[regnum] == NULL) - { - regs[regnum] - = frame_obstack_alloc (REGISTER_RAW_SIZE (regnum)); - read_memory (frame->saved_regs[regnum], regs[regnum], - REGISTER_RAW_SIZE (regnum)); - } - memcpy (bufferp, regs[regnum], REGISTER_RAW_SIZE (regnum)); -#else - /* Read the value in from memory. */ - read_memory (frame->saved_regs[regnum], bufferp, - REGISTER_RAW_SIZE (regnum)); -#endif - } - } - return; - } - - /* No luck, assume this and the next frame have the same register - value. If a value is needed, pass the request on down the chain; - otherwise just return an indication that the value is in the same - register as the next frame. */ - if (bufferp == NULL) - { - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - } - else - { - frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, - realnump, bufferp); - } -} - -/* Function: get_saved_register - Find register number REGNUM relative to FRAME and put its (raw, - target format) contents in *RAW_BUFFER. - - Set *OPTIMIZED if the variable was optimized out (and thus can't be - fetched). Note that this is never set to anything other than zero - in this implementation. - - Set *LVAL to lval_memory, lval_register, or not_lval, depending on - whether the value was fetched from memory, from a register, or in a - strange and non-modifiable way (e.g. a frame pointer which was - calculated rather than fetched). We will use not_lval for values - fetched from generic dummy frames. - - Set *ADDRP to the address, either in memory or as a REGISTER_BYTE - offset into the registers array. If the value is stored in a dummy - frame, set *ADDRP to zero. - - To use this implementation, define a function called - "get_saved_register" in your target code, which simply passes all - of its arguments to this function. - - The argument RAW_BUFFER must point to aligned memory. */ - -void -generic_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, - struct frame_info *frame, int regnum, - enum lval_type *lval) -{ - if (!target_has_registers) - error ("No registers."); - - /* Normal systems don't optimize out things with register numbers. */ - if (optimized != NULL) - *optimized = 0; - - if (addrp) /* default assumption: not found in memory */ - *addrp = 0; - - /* Note: since the current frame's registers could only have been - saved by frames INTERIOR TO the current frame, we skip examining - the current frame itself: otherwise, we would be getting the - previous frame's registers which were saved by the current frame. */ - - while (frame && ((frame = frame->next) != NULL)) - { - if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) - { - if (lval) /* found it in a CALL_DUMMY frame */ - *lval = not_lval; - if (raw_buffer) - /* FIXME: cagney/2002-06-26: This should be via the - gdbarch_register_read() method so that it, on the fly, - constructs either a raw or pseudo register from the raw - register cache. */ - regcache_raw_read (generic_find_dummy_frame (frame->pc, - frame->frame), - regnum, raw_buffer); - return; - } - - FRAME_INIT_SAVED_REGS (frame); - if (frame->saved_regs != NULL - && frame->saved_regs[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_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - frame->saved_regs[regnum]); - } - else - { - if (addrp) /* any other register */ - *addrp = frame->saved_regs[regnum]; - if (raw_buffer) - read_memory (frame->saved_regs[regnum], raw_buffer, - REGISTER_RAW_SIZE (regnum)); - } - return; - } - } - - /* If we get thru the loop to this point, it means the register was - not saved in any frame. Return the actual live-register value. */ - - if (lval) /* found it in a live register */ - *lval = lval_register; - if (addrp) - *addrp = REGISTER_BYTE (regnum); - if (raw_buffer) - read_register_gen (regnum, raw_buffer); -} - -void -_initialize_blockframe (void) -{ - obstack_init (&frame_cache_obstack); -} diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c5c91cc..fed39be 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1690,7 +1690,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc) bp_call_dummy breakpoint. */ int -frame_in_dummy (struct frame_info *frame) +deprecated_frame_in_dummy (struct frame_info *frame) { struct breakpoint *b; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 226703b..3abdca7 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -528,7 +528,16 @@ extern enum breakpoint_here breakpoint_here_p (CORE_ADDR); extern int breakpoint_inserted_here_p (CORE_ADDR); -extern int frame_in_dummy (struct frame_info *); +/* FIXME: cagney/2002-11-10: The current [generic] dummy-frame code + implements a functional superset of this function. The only reason + it hasn't been removed is because some architectures still don't + use the new framework. Once they have been fixed, this can go. */ +/* FIXME: cagney/2002-11-10: There should be a function (hmm, + something like, enum { NORMAL_FRAME, DUMMY_FRAME, SIGTRAMP_FRAME } + get_frame_type() ...) that the caller can use to determine the + frame's type. This could replace this function, PC_IN_CALL_DUMMY, + and fi->signal_handler_caller. */ +extern int deprecated_frame_in_dummy (struct frame_info *); extern int breakpoint_thread_match (CORE_ADDR, ptid_t); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index b786536..d9fb7dd 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -31,7 +31,7 @@ #include "gdb_obstack.h" #include "symtab.h" #include "block.h" -#include "symfile.h" /* Needed for "struct complaint", obsavestring */ +#include "symfile.h" #include "objfiles.h" #include "gdbtypes.h" #include "complaints.h" @@ -91,19 +91,19 @@ static struct using_direct_node *copy_usings_to_obstack (struct /* Complaints about the symbols we have encountered. */ -struct complaint block_end_complaint = +struct deprecated_complaint block_end_complaint = {"block end address less than block start address in %s (patched it)", 0, 0}; -struct complaint anon_block_end_complaint = +struct deprecated_complaint anon_block_end_complaint = {"block end address 0x%lx less than block start address 0x%lx (patched it)", 0, 0}; -struct complaint innerblock_complaint = +struct deprecated_complaint innerblock_complaint = {"inner block not inside outer block in %s", 0, 0}; -struct complaint innerblock_anon_complaint = +struct deprecated_complaint innerblock_anon_complaint = {"inner block (0x%lx-0x%lx) not inside outer block (0x%lx-0x%lx)", 0, 0}; -struct complaint blockvector_complaint = +struct deprecated_complaint blockvector_complaint = {"block at %s out of order", 0, 0}; /* maintain the lists of symbols and blocks */ @@ -981,7 +981,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) same. FIXME: Find out why it is happening. This is not believed to happen in most cases (even for coffread.c); it used to be an abort(). */ - static struct complaint msg = + static struct deprecated_complaint msg = {"Context stack not empty in end_symtab", 0, 0}; complain (&msg); context_stack_depth = 0; diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 6229e06..7249ab8 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -192,6 +192,9 @@ EXTERN int context_stack_size; #define pop_context() (&context_stack[--context_stack_depth]); +/* Non-zero if the context stack is empty. */ +#define outermost_context_p() (context_stack_depth == 0) + /* Nonzero if within a function (so symbols should be local, if nothing says specifically). */ diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 94d29ba..91414cb 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -248,9 +248,11 @@ exp1 : exp /* Expressions, not including the comma operator. */ exp : '*' exp %prec UNARY { write_exp_elt_opcode (UNOP_IND); } + ; exp : '&' exp %prec UNARY { write_exp_elt_opcode (UNOP_ADDR); } + ; exp : '-' exp %prec UNARY { write_exp_elt_opcode (UNOP_NEG); } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index c44975a..9d58291 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -27,10 +27,13 @@ #include "gdb_string.h" #include "linespec.h" #include "expression.h" +#include "frame.h" +#include "value.h" #include "language.h" #include "filenames.h" /* for DOSish file names */ #include "objfiles.h" #include "source.h" +#include "disasm.h" #include "ui-out.h" @@ -819,6 +822,92 @@ list_command (char *arg, int from_tty) 0); } +/* Dump a specified section of assembly code. With no command line + arguments, this command will dump the assembly code for the + function surrounding the pc value in the selected frame. With one + argument, it will dump the assembly code surrounding that pc value. + Two arguments are interpeted as bounds within which to dump + assembly. */ + +/* ARGSUSED */ +static void +disassemble_command (char *arg, int from_tty) +{ + CORE_ADDR low, high; + char *name; + CORE_ADDR pc, pc_masked; + char *space_index; +#if 0 + asection *section; +#endif + + name = NULL; + if (!arg) + { + if (!selected_frame) + error ("No frame selected.\n"); + + pc = get_frame_pc (selected_frame); + if (find_pc_partial_function (pc, &name, &low, &high) == 0) + error ("No function contains program counter for selected frame.\n"); +#if defined(TUI) + else if (tui_version) + low = tuiGetLowDisassemblyAddress (low, pc); +#endif + low += FUNCTION_START_OFFSET; + } + else if (!(space_index = (char *) strchr (arg, ' '))) + { + /* One argument. */ + pc = parse_and_eval_address (arg); + if (find_pc_partial_function (pc, &name, &low, &high) == 0) + error ("No function contains specified address.\n"); +#if defined(TUI) + else if (tui_version) + low = tuiGetLowDisassemblyAddress (low, pc); +#endif + low += FUNCTION_START_OFFSET; + } + else + { + /* Two arguments. */ + *space_index = '\0'; + low = parse_and_eval_address (arg); + high = parse_and_eval_address (space_index + 1); + } + +#if defined(TUI) + if (!tui_is_window_visible (DISASSEM_WIN)) +#endif + { + printf_filtered ("Dump of assembler code "); + if (name != NULL) + { + printf_filtered ("for function %s:\n", name); + } + else + { + printf_filtered ("from "); + print_address_numeric (low, 1, gdb_stdout); + printf_filtered (" to "); + print_address_numeric (high, 1, gdb_stdout); + printf_filtered (":\n"); + } + + /* Dump the specified range. */ + gdb_disassembly (uiout, 0, 0, 0, -1, low, high); + + printf_filtered ("End of assembler dump.\n"); + gdb_flush (gdb_stdout); + } +#if defined(TUI) + else + { + tui_show_assembly (low); + } +#endif +} + static void make_command (char *arg, int from_tty) { @@ -1157,6 +1246,14 @@ With two args if one is empty it stands for ten lines away from the other arg.", if (dbx_commands) add_com_alias ("file", "list", class_files, 1); + c = add_com ("disassemble", class_vars, disassemble_command, + "Disassemble a specified section of memory.\n\ +Default is the function surrounding the pc of the selected frame.\n\ +With a single argument, the function surrounding that address is dumped.\n\ +Two arguments are taken as a range of memory to dump."); + set_cmd_completer (c, location_completer); + if (xdb_commands) + add_com_alias ("va", "disassemble", class_xdb, 0); /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would be a really useful feature. Unfortunately, the below wont do diff --git a/gdb/coffread.c b/gdb/coffread.c index ff0f396..a6f615a 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -126,37 +126,37 @@ static struct symbol *opaque_type_chain[HASHSIZE]; /* Complaints about various problems in the file being read */ -struct complaint ef_complaint = +struct deprecated_complaint ef_complaint = {"Unmatched .ef symbol(s) ignored starting at symnum %d", 0, 0}; -struct complaint ef_stack_complaint = +struct deprecated_complaint ef_stack_complaint = {"`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", 0, 0}; -struct complaint eb_stack_complaint = +struct deprecated_complaint eb_stack_complaint = {"`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", 0, 0}; -struct complaint bf_no_aux_complaint = +struct deprecated_complaint bf_no_aux_complaint = {"`.bf' symbol %d has no aux entry", 0, 0}; -struct complaint ef_no_aux_complaint = +struct deprecated_complaint ef_no_aux_complaint = {"`.ef' symbol %d has no aux entry", 0, 0}; -struct complaint lineno_complaint = +struct deprecated_complaint lineno_complaint = {"Line number pointer %d lower than start of line numbers", 0, 0}; -struct complaint unexpected_type_complaint = +struct deprecated_complaint unexpected_type_complaint = {"Unexpected type for symbol %s", 0, 0}; -struct complaint bad_sclass_complaint = +struct deprecated_complaint bad_sclass_complaint = {"Bad n_sclass for symbol %s", 0, 0}; -struct complaint misordered_blocks_complaint = +struct deprecated_complaint misordered_blocks_complaint = {"Blocks out of order at address %x", 0, 0}; -struct complaint tagndx_bad_complaint = +struct deprecated_complaint tagndx_bad_complaint = {"Symbol table entry for %s has bad tagndx value", 0, 0}; -struct complaint eb_complaint = +struct deprecated_complaint eb_complaint = {"Mismatched .eb symbol ignored starting at symnum %d", 0, 0}; /* Simplified internal version of coff symbol table information */ @@ -1990,6 +1990,7 @@ coff_read_struct_type (int index, int length, int lastsym) FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; nfields++; break; @@ -2008,6 +2009,7 @@ coff_read_struct_type (int index, int length, int lastsym) FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = ms->c_value; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; + FIELD_STATIC_KIND (list->field) = 0; nfields++; break; @@ -2128,6 +2130,7 @@ coff_read_enum_type (int index, int length, int lastsym) if (SYMBOL_VALUE (xsym) < 0) unsigned_enum = 0; TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } if (syms == osyms) break; diff --git a/gdb/complaints.c b/gdb/complaints.c index 84cf6a2..b4c55da 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -250,7 +250,7 @@ internal_complaint (struct complaints **complaints, const char *file, } void -complain (struct complaint *complaint, ...) +complain (struct deprecated_complaint *complaint, ...) { va_list args; va_start (args, complaint); diff --git a/gdb/complaints.h b/gdb/complaints.h index c176b19..159dcd1 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -50,9 +50,15 @@ extern void clear_complaints (struct complaints **complaints, int less_verbose, int noisy); -/* Legacy interfaces to keep the old code working (until it is all - converted to the above). While the structure below contains a - number of fields, all but .message are ignored. +/* Deprecated interfaces to keep the old code working (until it is all + converted to the above). Existing code such as: + + struct deprecated_complaint msg = { "msg", 0, 0 }; + complaint (&msg); + + should be replaced by: + + complaint (&symtab_complaints, __FILE__, __LINE__, "msg"); Support for complaining about things in the symbol file that aren't catastrophic. @@ -61,13 +67,13 @@ extern void clear_complaints (struct complaints **complaints, during a symbol read, we report it. At the end of symbol reading, if verbose, we report how many of each problem we had. */ -struct complaint +struct deprecated_complaint { const char *message; unsigned counter_ignored; - struct complaint *next_ignored; + struct deprecated_complaint *next_ignored; }; -extern void complain (struct complaint *, ...); +extern void complain (struct deprecated_complaint *, ...); #endif /* !defined (COMPLAINTS_H) */ diff --git a/gdb/config.in b/gdb/config.in index 8c1c7bf..fa1ab9a 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -1,4 +1,4 @@ -/* config.in. Generated automatically from configure.in by autoheader 2.13. */ +/* config.in. Generated automatically from configure.in by autoheader. */ /* Define if on AIX 3. System headers sometimes define this. @@ -514,3 +514,6 @@ /* Define if <sys/procfs.h> has pr_siginfo64_t. */ #undef HAVE_PR_SIGINFO64_T +/* Define if <thread_db.h> has the TD_NOTALLOC error code. */ +#undef THREAD_DB_HAS_TD_NOTALLOC + diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 4d9fa83..046b065 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -136,6 +136,8 @@ @V@/gdb/i386gnu-tdep.c @V@/gdb/i3gnu-tdep.c @V@/gdb/i386nbsd-nat.c @V@/gdb/i3nbsd-nat.c @V@/gdb/i386nbsd-tdep.c @V@/gdb/i3nbsd-tdep.c +@V@/gdb/i386obsd-nat.c @V@/gdb/i3obsd-nat.c +@V@/gdb/i386obsd-tdep.c @V@/gdb/i3obsd-tdep.c @V@/gdb/ia64-aix-nat.c @V@/gdb/ia64aix-nat.c @V@/gdb/ia64-linux-nat.c @V@/gdb/ia64linux-nat.c @V@/gdb/jv-exp.tab.c @V@/gdb/jv-exp_tab.c @@ -209,6 +211,11 @@ @V@/gdb/testsuite/gdb.c++/demangle.exp @V@/gdb/testsuite/gdb.cxx/demangle.exp @V@/gdb/testsuite/gdb.c++/derivation.cc @V@/gdb/testsuite/gdb.cxx/derivation.cc @V@/gdb/testsuite/gdb.c++/derivation.exp @V@/gdb/testsuite/gdb.cxx/derivation.exp +@V@/gdb/testsuite/gdb.c++/hang.H @V@/gdb/testsuite/gdb.cxx/hang.h +@V@/gdb/testsuite/gdb.c++/hang.exp @V@/gdb/testsuite/gdb.cxx/hang.exp +@V@/gdb/testsuite/gdb.c++/hang1.C @V@/gdb/testsuite/gdb.cxx/hang1.c +@V@/gdb/testsuite/gdb.c++/hang2.C @V@/gdb/testsuite/gdb.cxx/hang2.c +@V@/gdb/testsuite/gdb.c++/hang3.C @V@/gdb/testsuite/gdb.cxx/hang3.c @V@/gdb/testsuite/gdb.c++/inherit.exp @V@/gdb/testsuite/gdb.cxx/inherit.exp @V@/gdb/testsuite/gdb.c++/local.cc @V@/gdb/testsuite/gdb.cxx/local.cc @V@/gdb/testsuite/gdb.c++/local.exp @V@/gdb/testsuite/gdb.cxx/local.exp @@ -220,6 +227,10 @@ @V@/gdb/testsuite/gdb.c++/member-ptr.exp @V@/gdb/testsuite/gdb.cxx/member-ptr.exp @V@/gdb/testsuite/gdb.c++/method.cc @V@/gdb/testsuite/gdb.cxx/method.cc @V@/gdb/testsuite/gdb.c++/method.exp @V@/gdb/testsuite/gdb.cxx/method.exp +@V@/gdb/testsuite/gdb.c++/m-data.cc @V@/gdb/testsuite/gdb.cxx/m-data.cc +@V@/gdb/testsuite/gdb.c++/m-data.exp @V@/gdb/testsuite/gdb.cxx/m-data.exp +@V@/gdb/testsuite/gdb.c++/m-static.cc @V@/gdb/testsuite/gdb.cxx/m-static.cc +@V@/gdb/testsuite/gdb.c++/m-static.exp @V@/gdb/testsuite/gdb.cxx/m-static.exp @V@/gdb/testsuite/gdb.c++/misc.cc @V@/gdb/testsuite/gdb.cxx/misc.cc @V@/gdb/testsuite/gdb.c++/misc.exp @V@/gdb/testsuite/gdb.cxx/misc.exp @V@/gdb/testsuite/gdb.c++/namespace.cc @V@/gdb/testsuite/gdb.cxx/namespace.cc @@ -232,6 +243,8 @@ @V@/gdb/testsuite/gdb.c++/ref-types.exp @V@/gdb/testsuite/gdb.cxx/ref-types.exp @V@/gdb/testsuite/gdb.c++/templates.cc @V@/gdb/testsuite/gdb.cxx/templates.cc @V@/gdb/testsuite/gdb.c++/templates.exp @V@/gdb/testsuite/gdb.cxx/templates.exp +@V@/gdb/testsuite/gdb.c++/try_catch.cc @V@/gdb/testsuite/gdb.cxx/try_catch.cc +@V@/gdb/testsuite/gdb.c++/try_catch.exp @V@/gdb/testsuite/gdb.cxx/try_catch.exp @V@/gdb/testsuite/gdb.c++/userdef.cc @V@/gdb/testsuite/gdb.cxx/userdef.cc @V@/gdb/testsuite/gdb.c++/userdef.exp @V@/gdb/testsuite/gdb.cxx/userdef.exp @V@/gdb/testsuite/gdb.c++/virtfunc.cc @V@/gdb/testsuite/gdb.cxx/virtfunc.cc diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h index 30acdbe..8c4ae45 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -1,6 +1,7 @@ /* Parameters for execution on a H8/500 series machine. - Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002 Free + Software Foundation, Inc. This file is part of GDB. @@ -169,7 +170,7 @@ extern struct type *h8500_register_virtual_type (int regno); of type TYPE, given in virtual format. */ #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) + deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, @@ -253,8 +254,9 @@ extern CORE_ADDR h8500_addr_bits_remove (CORE_ADDR); #define read_memory_short(x) (read_memory_integer(x,2) & 0xffff) -#define PRINT_REGISTER_HOOK(regno) print_register_hook(regno) -extern void print_register_hook (int); +extern void h8500_do_registers_info (int regnum, int all); +#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \ + h8500_do_registers_info (REGNUM, ALL) extern int minimum_mode; diff --git a/gdb/config/i386/i386v42mp.mt b/gdb/config/i386/i386v42mp.mt index 0b2dea8..1a0ac88 100644 --- a/gdb/config/i386/i386v42mp.mt +++ b/gdb/config/i386/i386v42mp.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running SVR4.2MP TDEPFILES= i386-tdep.o i387-tdep.o -TM_FILE= tm-i386v42mp.h +TM_FILE= tm-i386.h diff --git a/gdb/config/i386/nm-i386v42mp.h b/gdb/config/i386/nm-i386v42mp.h index 7ded361..f6fced5 100644 --- a/gdb/config/i386/nm-i386v42mp.h +++ b/gdb/config/i386/nm-i386v42mp.h @@ -20,4 +20,73 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef NM_I386V42MP_H +#define NM_I386V42MP_H + #include "config/nm-sysv4.h" + +/* define to select for other sysv4.2mp weirdness (see procfs.c) */ + +#define UNIXWARE + +#if 0 +/* The following macros extract process and lwp/thread ids from a + composite id. + + For consistency with UnixWare core files, allocate bits 0-15 for + process ids and bits 16 and up for lwp ids. Reserve bit 31 for + negative return values to indicate exceptions, and use bit 30 as a + flag to indicate a user-mode thread, leaving 14 bits for lwp + ids. */ + +/* Number of bits in composite id allocated to process number. */ +#define PIDBITS 16 + +/* Return the process id stored in composite PID. */ +#define PIDGET(PID) (((PID) & ((1 << PIDBITS) - 1))) + +/* Return the thread or lwp id stored in composite PID. */ +#define TIDGET(PID) (((PID) & 0x3fffffff) >> PIDBITS) +#define LIDGET(PID) TIDGET(PID) + +/* Construct a composite id from lwp LID and the process portion of + composite PID. */ +#define MERGEPID(PID, LID) (PIDGET(PID) | ((LID) << PIDBITS)) +#define MKLID(PID, LID) MERGEPID(PID, LID) + +/* Construct a composite id from thread TID and the process portion of + composite PID. */ +#define MKTID(PID, TID) (MERGEPID(PID, TID) | 0x40000000) + +/* Return whether PID contains a user-space thread id. */ +#define ISTID(PID) ((PID) & 0x40000000) +#endif + +/* New definitions of the ptid stuff. Due to the way the + code is structured in uw-thread.c, I'm overloading the thread id + and lwp id onto the lwp field. The tid field is used to indicate + whether the lwp is a tid or not. + + FIXME: Check that core file support is not broken. (See original + #if 0'd comments above.) + FIXME: Restructure uw-thread.c so that the struct ptid fields + can be used as intended. */ + +/* Return the process id stored in composite PID. */ +#define PIDGET(PID) (ptid_get_pid (PID)) + +/* Return the thread or lwp id stored in composite PID. */ +#define TIDGET(PID) (ptid_get_lwp (PID)) +#define LIDGET(PID) TIDGET(PID) + +#define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0)) +#define MKLID(PID, LID) (ptid_build ((PID), (LID), 0)) + +/* Construct a composite id from thread TID and the process portion of + composite PID. */ +#define MKTID(PID, TID) (ptid_build ((PID), (TID), 1)) + +/* Return whether PID contains a user-space thread id. */ +#define ISTID(PID) (ptid_get_tid (PID)) + +#endif /* NM_I386V42MP_H */ diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h index 073c3a3..ad57124 100644 --- a/gdb/config/i386/nm-linux.h +++ b/gdb/config/i386/nm-linux.h @@ -39,9 +39,6 @@ extern int kernel_u_size (void); the core file of the register values. */ #define KERNEL_U_ADDR 0 -/* Offset of the registers within the user area. */ -#define U_REGS_OFFSET 0 - extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum); #define REGISTER_U_ADDR(addr, blockend, regnum) \ (addr) = register_u_addr (blockend, regnum) diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h index 253b194..9c8f41c 100644 --- a/gdb/config/i386/nm-ptx4.h +++ b/gdb/config/i386/nm-ptx4.h @@ -38,7 +38,7 @@ /* We must fetch all the regs before storing, since we store all at once. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) #define CHILD_WAIT struct target_waitstatus; diff --git a/gdb/config/i386/nm-symmetry.h b/gdb/config/i386/nm-symmetry.h index a589a3d..d3f57e6 100644 --- a/gdb/config/i386/nm-symmetry.h +++ b/gdb/config/i386/nm-symmetry.h @@ -28,7 +28,7 @@ /* We must fetch all the regs before storing, since we store all at once. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) #ifdef _SEQUENT_ #define CHILD_WAIT diff --git a/gdb/config/i386/tm-i386v42mp.h b/gdb/config/i386/tm-i386v42mp.h deleted file mode 100644 index 527fdbb..0000000 --- a/gdb/config/i386/tm-i386v42mp.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Macro definitions for GDB on an Intel i386 running SVR4.2MP - Copyright 1991, 1994, 1997, 1999, 2000 Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygnus.com) - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_I386V42MP_H -#define TM_I386V42MP_H 1 - -/* pick up more generic x86 sysv4 stuff */ - -#include "i386/tm-i386.h" - -/* define to select for other sysv4.2mp weirdness (see procfs.c) */ - -#define UNIXWARE - -#if 0 -/* The following macros extract process and lwp/thread ids from a - composite id. - - For consistency with UnixWare core files, allocate bits 0-15 for - process ids and bits 16 and up for lwp ids. Reserve bit 31 for - negative return values to indicate exceptions, and use bit 30 as a - flag to indicate a user-mode thread, leaving 14 bits for lwp - ids. */ - -/* Number of bits in composite id allocated to process number. */ -#define PIDBITS 16 - -/* Return the process id stored in composite PID. */ -#define PIDGET(PID) (((PID) & ((1 << PIDBITS) - 1))) - -/* Return the thread or lwp id stored in composite PID. */ -#define TIDGET(PID) (((PID) & 0x3fffffff) >> PIDBITS) -#define LIDGET(PID) TIDGET(PID) - -/* Construct a composite id from lwp LID and the process portion of - composite PID. */ -#define MERGEPID(PID, LID) (PIDGET(PID) | ((LID) << PIDBITS)) -#define MKLID(PID, LID) MERGEPID(PID, LID) - -/* Construct a composite id from thread TID and the process portion of - composite PID. */ -#define MKTID(PID, TID) (MERGEPID(PID, TID) | 0x40000000) - -/* Return whether PID contains a user-space thread id. */ -#define ISTID(PID) ((PID) & 0x40000000) -#endif - -/* New definitions of the ptid stuff. Due to the way the - code is structured in uw-thread.c, I'm overloading the thread id - and lwp id onto the lwp field. The tid field is used to indicate - whether the lwp is a tid or not. - - FIXME: Check that core file support is not broken. (See original - #if 0'd comments above.) - FIXME: Restructure uw-thread.c so that the struct ptid fields - can be used as intended. */ - -/* Return the process id stored in composite PID. */ -#define PIDGET(PID) (ptid_get_pid (PID)) - -/* Return the thread or lwp id stored in composite PID. */ -#define TIDGET(PID) (ptid_get_lwp (PID)) -#define LIDGET(PID) TIDGET(PID) - -#define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0)) -#define MKLID(PID, LID) (ptid_build ((PID), (LID), 0)) - -/* Construct a composite id from thread TID and the process portion of - composite PID. */ -#define MKTID(PID, TID) (ptid_build ((PID), (TID), 1)) - -/* Return whether PID contains a user-space thread id. */ -#define ISTID(PID) (ptid_get_tid (PID)) - -#endif /* ifndef TM_I386V42MP_H */ diff --git a/gdb/config/m32r/tm-m32r.h b/gdb/config/m32r/tm-m32r.h index 648ff01..f38a760 100644 --- a/gdb/config/m32r/tm-m32r.h +++ b/gdb/config/m32r/tm-m32r.h @@ -146,7 +146,7 @@ extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *); /* mvs_check DEPRECATED_STORE_RETURN_VALUE */ #define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \ - write_register_bytes(REGISTER_BYTE (V0_REGNUM) + \ + deprecated_write_register_bytes(REGISTER_BYTE (V0_REGNUM) + \ ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\ (VALBUF), TYPE_LENGTH (TYPE)); @@ -221,7 +221,7 @@ extern CORE_ADDR m32r_push_arguments (int nargs, /* override the standard get_saved_register function with one that takes account of generic CALL_DUMMY frames */ #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ - generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) + deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) #define USE_GENERIC_DUMMY_FRAMES 1 diff --git a/gdb/config/m68k/nm-sun3.h b/gdb/config/m68k/nm-sun3.h index ba40db7..b2fecb2 100644 --- a/gdb/config/m68k/nm-sun3.h +++ b/gdb/config/m68k/nm-sun3.h @@ -31,4 +31,4 @@ /* We have to grab the regs since we store all regs at once. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index 269d134..a1abc0e 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -68,11 +68,11 @@ { \ char raw_buf[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buf); \ - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ raw_buf, REGISTER_RAW_SIZE (FP0_REGNUM)); \ } \ else \ - write_register_bytes ((TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : 0), \ + deprecated_write_register_bytes ((TYPE_CODE(TYPE) == TYPE_CODE_PTR ? 8 * 4 : 0), \ VALBUF, TYPE_LENGTH (TYPE)) /* Return number of args passed to a frame. diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h index e2889ec..0bae116 100644 --- a/gdb/config/m68k/tm-linux.h +++ b/gdb/config/m68k/tm-linux.h @@ -64,15 +64,15 @@ { \ char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buffer); \ - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \ raw_buffer, TYPE_LENGTH (TYPE)); \ } \ else \ { \ if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \ - write_register_bytes (REGISTER_BYTE (A0_REGNUM), VALBUF, \ + deprecated_write_register_bytes (REGISTER_BYTE (A0_REGNUM), VALBUF, \ TYPE_LENGTH (TYPE)); \ - write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \ + deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \ } \ } diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h index bd2e66c..47bd7a0 100644 --- a/gdb/config/mn10200/tm-mn10200.h +++ b/gdb/config/mn10200/tm-mn10200.h @@ -154,16 +154,16 @@ extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *); internal_error (__FILE__, __LINE__, "failed internal consistency check"); \ else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \ { \ - write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \ - write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \ + deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \ + deprecated_write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \ } \ else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\ { \ - write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \ + deprecated_write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \ } \ else \ { \ - write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \ + deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \ } \ } diff --git a/gdb/config/nm-gnu.h b/gdb/config/nm-gnu.h index 8f17406..1dedb57 100644 --- a/gdb/config/nm-gnu.h +++ b/gdb/config/nm-gnu.h @@ -30,7 +30,7 @@ extern char *gnu_target_pid_to_str (int pid); /* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) /* Don't do wait_for_inferior on attach. */ #define ATTACH_NO_WAIT diff --git a/gdb/config/nm-m3.h b/gdb/config/nm-m3.h index f89838e..07bc26a 100644 --- a/gdb/config/nm-m3.h +++ b/gdb/config/nm-m3.h @@ -77,7 +77,7 @@ extern int must_suspend_thread; /* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) /* Check if the inferior exists */ #define MACH_ERROR_NO_INFERIOR \ diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 6fd8c03..319576d 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -24,6 +24,8 @@ #include "regcache.h" +#define GDB_MULTI_ARCH 0 + /* Forward declarations of some types we use in prototypes */ struct frame_info; @@ -50,12 +52,8 @@ struct inferior_status; ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1)) #endif -/* On the PA, any pass-by-value structure > 8 bytes is actually - passed via a pointer regardless of its type or the compiler - used. */ - -#define REG_STRUCT_HAS_ADDR(gcc_p,type) \ - (TYPE_LENGTH (type) > 8) +extern int hppa_reg_struct_has_addr (int gcc_p, struct type *type); +#define REG_STRUCT_HAS_ADDR(gcc_p,type) hppa_reg_struct_has_addr (gcc_p,type) /* Offset from address of function to start of its code. Zero on most machines. */ @@ -84,23 +82,16 @@ extern int in_solib_call_trampoline (CORE_ADDR, char *); in_solib_return_trampoline (pc, name) extern int in_solib_return_trampoline (CORE_ADDR, char *); -/* Immediately after a function call, return the saved pc. - Can't go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - #undef SAVED_PC_AFTER_CALL #define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call (frame) extern CORE_ADDR saved_pc_after_call (struct frame_info *); -/* Stack grows upward */ -#define INNER_THAN(lhs,rhs) ((lhs) > (rhs)) +extern int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs); +#define INNER_THAN(lhs,rhs) hppa_inner_than(lhs,rhs) -/* elz: adjust the quantity to the next highest value which is 64-bit aligned. - This is used in valops.c, when the sp is adjusted. - On hppa the sp must always be kept 64-bit aligned */ +extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); +#define STACK_ALIGN(sp) hppa_stack_align (sp) -#define STACK_ALIGN(arg) ( ((arg)%8) ? (((arg)+7)&-8) : (arg)) #define EXTRA_STACK_ALIGNMENT_NEEDED 0 /* Sequence of bytes for breakpoint instruction. */ @@ -116,35 +107,8 @@ extern CORE_ADDR saved_pc_after_call (struct frame_info *); #define DECR_PC_AFTER_BREAK 0 -/* Sometimes we may pluck out a minimal symbol that has a negative - address. - - An example of this occurs when an a.out is linked against a foo.sl. - The foo.sl defines a global bar(), and the a.out declares a signature - for bar(). However, the a.out doesn't directly call bar(), but passes - its address in another call. - - If you have this scenario and attempt to "break bar" before running, - gdb will find a minimal symbol for bar() in the a.out. But that - symbol's address will be negative. What this appears to denote is - an index backwards from the base of the procedure linkage table (PLT) - into the data linkage table (DLT), the end of which is contiguous - with the start of the PLT. This is clearly not a valid address for - us to set a breakpoint on. - - Note that one must be careful in how one checks for a negative address. - 0xc0000000 is a legitimate address of something in a shared text - segment, for example. Since I don't know what the possible range - is of these "really, truly negative" addresses that come from the - minimal symbols, I'm resorting to the gross hack of checking the - top byte of the address for all 1's. Sigh. - */ -#define PC_REQUIRES_RUN_BEFORE_USE(pc) \ - (! target_has_stack && (pc & 0xFF000000)) - -/* return instruction is bv r0(rp) or bv,n r0(rp) */ - -#define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 4) | 0x2) == 0xE840C002) +extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); +#define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc) /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the @@ -249,10 +213,10 @@ extern CORE_ADDR saved_pc_after_call (struct frame_info *); (buf)[sizeof(CORE_ADDR) -1] &= ~0x3; \ } while (0) -/* Define DO_REGISTERS_INFO() to do machine-specific formatting +/* Define DEPRECATED_REGISTERS_INFO() to do machine-specific formatting of register dumps. */ -#define DO_REGISTERS_INFO(_regnum, fp) pa_do_registers_info (_regnum, fp) +#define DEPRECATED_REGISTERS_INFO(_regnum, fp) pa_do_registers_info (_regnum, fp) extern void pa_do_registers_info (int, int); #if 0 @@ -262,9 +226,8 @@ extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precis /* PA specific macro to see if the current instruction is nullified. */ #ifndef INSTRUCTION_NULLIFIED -#define INSTRUCTION_NULLIFIED \ - (((int)read_register (IPSW_REGNUM) & 0x00200000) && \ - !((int)read_register (FLAGS_REGNUM) & 0x2)) +extern int hppa_instruction_nullified (void); +#define INSTRUCTION_NULLIFIED hppa_instruction_nullified () #endif /* Number of bytes of storage in the actual machine representation @@ -277,10 +240,8 @@ extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precis register state, the array `registers'. */ #define REGISTER_BYTES (NUM_REGS * 4) -/* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) (N) * 4 +extern int hppa_register_byte (int reg_nr); +#define REGISTER_BYTE(N) hppa_register_byte (N) /* Number of bytes of storage in the program's representation for register N. */ @@ -295,16 +256,11 @@ extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precis #define MAX_REGISTER_VIRTUAL_SIZE 8 -/* Return the GDB type object for the "standard" data type - of data in register N. */ +extern struct type * hppa_register_virtual_type (int reg_nr); +#define REGISTER_VIRTUAL_TYPE(N) hppa_register_virtual_type (N) -#define REGISTER_VIRTUAL_TYPE(N) \ - ((N) < FP4_REGNUM ? builtin_type_int : builtin_type_float) - -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ - -#define STORE_STRUCT_RETURN(ADDR, SP) {write_register (28, (ADDR)); } +extern void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); +#define STORE_STRUCT_RETURN(ADDR, SP) hppa_store_struct_return (ADDR, SP) /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, @@ -358,21 +314,8 @@ struct value *hppa_value_returned_from_stack (register struct type *valtype, #define VALUE_RETURNED_FROM_STACK(valtype,addr) \ hppa_value_returned_from_stack (valtype, addr) -/* - * This macro defines the register numbers (from REGISTER_NAMES) that - * are effectively unavailable to the user through ptrace(). It allows - * us to include the whole register set in REGISTER_NAMES (inorder to - * better support remote debugging). If it is used in - * fetch/store_inferior_registers() gdb will not complain about I/O errors - * on fetching these registers. If all registers in REGISTER_NAMES - * are available, then return false (0). - */ - -#define CANNOT_STORE_REGISTER(regno) \ - ((regno) == 0) || \ - ((regno) == PCSQ_HEAD_REGNUM) || \ - ((regno) >= PCSQ_TAIL_REGNUM && (regno) < IPSW_REGNUM) || \ - ((regno) > IPSW_REGNUM && (regno) < FP4_REGNUM) +extern int hppa_cannot_store_register (int regnum); +#define CANNOT_STORE_REGISTER(regno) hppa_cannot_store_register (regno) #define INIT_EXTRA_FRAME_INFO(fromleaf, frame) init_extra_frame_info (fromleaf, frame) extern void init_extra_frame_info (int, struct frame_info *); @@ -405,9 +348,12 @@ extern int frameless_function_invocation (struct frame_info *); extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); #define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) -#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) +extern CORE_ADDR hppa_frame_args_address (struct frame_info *fi); +#define FRAME_ARGS_ADDRESS(fi) hppa_frame_args_address (fi) + +extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); +#define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi) -#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) /* Set VAL to the number of args passed to frame described by FI. Can set VAL to -1, meaning no way to tell. */ @@ -589,13 +535,8 @@ hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); -/* The low two bits of the PC on the PA contain the privilege level. Some - genius implementing a (non-GCC) compiler apparently decided this means - that "addresses" in a text section therefore include a privilege level, - and thus symbol tables should contain these bits. This seems like a - bonehead thing to do--anyway, it seems to work for our purposes to just - ignore those bits. */ -#define SMASH_TEXT_ADDRESS(addr) ((addr) &= ~0x3) +extern CORE_ADDR hppa_smash_text_address (CORE_ADDR addr); +#define SMASH_TEXT_ADDRESS(addr) hppa_smash_text_address (addr) #define GDB_TARGET_IS_HPPA @@ -744,16 +685,12 @@ extern int hpread_adjust_stack_address (CORE_ADDR); /* If the current gcc for for this target does not produce correct debugging information for float parameters, both prototyped and unprototyped, then define this macro. This forces gdb to always assume that floats are - passed as doubles and then converted in the callee. - - For the pa, it appears that the debug info marks the parameters as - floats regardless of whether the function is prototyped, but the actual - values are passed as doubles for the non-prototyped case and floats for - the prototyped case. Thus we choose to make the non-prototyped case work - for C and break the prototyped case, since the non-prototyped case is - probably much more common. (FIXME). */ + passed as doubles and then converted in the callee. */ -#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (current_language -> la_language == language_c) +extern int hppa_coerce_float_to_double (struct type *formal, + struct type *actual); +#define COERCE_FLOAT_TO_DOUBLE(formal, actual) \ + hppa_coerce_float_to_double (formal, actual) /* Here's how to step off a permanent breakpoint. */ #define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint) diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index 7e6e45a..9a1ceb0 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -264,29 +264,29 @@ call_dummy #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ { \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT && !SOFT_FLOAT) \ - write_register_bytes \ + deprecated_write_register_bytes \ (REGISTER_BYTE (FP4_REGNUM) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ (VALBUF), \ TYPE_LENGTH (TYPE)); \ else if (is_integral_type(TYPE) || SOFT_FLOAT) \ - write_register_bytes \ + deprecated_write_register_bytes \ (REGISTER_BYTE (28) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ (VALBUF), \ TYPE_LENGTH (TYPE)); \ else if (TYPE_LENGTH (TYPE) <= 8) \ - write_register_bytes \ + deprecated_write_register_bytes \ ( REGISTER_BYTE (28), \ (VALBUF), \ TYPE_LENGTH (TYPE)); \ else if (TYPE_LENGTH (TYPE) <= 16) \ { \ - write_register_bytes \ + deprecated_write_register_bytes \ (REGISTER_BYTE (28), \ (VALBUF), \ 8); \ - write_register_bytes \ + deprecated_write_register_bytes \ (REGISTER_BYTE (29), \ ((char *) VALBUF + 8), \ TYPE_LENGTH (TYPE) - 8); \ diff --git a/gdb/config/sparc/nm-nbsd.h b/gdb/config/sparc/nm-nbsd.h index 957a34e..41341c6 100644 --- a/gdb/config/sparc/nm-nbsd.h +++ b/gdb/config/sparc/nm-nbsd.h @@ -30,6 +30,6 @@ /* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) #endif /* NM_NBSD_H */ diff --git a/gdb/config/sparc/nm-sun4os4.h b/gdb/config/sparc/nm-sun4os4.h index d874d58..cee2a3d 100644 --- a/gdb/config/sparc/nm-sun4os4.h +++ b/gdb/config/sparc/nm-sun4os4.h @@ -30,7 +30,7 @@ /* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) /* Return sizeof user struct to callers in less machine dependent routines */ diff --git a/gdb/config/sparc/nm-sun4sol2.h b/gdb/config/sparc/nm-sun4sol2.h index f8aeda0..3cad417 100644 --- a/gdb/config/sparc/nm-sun4sol2.h +++ b/gdb/config/sparc/nm-sun4sol2.h @@ -26,7 +26,7 @@ /* Before storing, we need to read all the registers. */ -#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) +#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) /* Solaris PSRVADDR support does not seem to include a place for nPC. */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 8cac258..6042ac6 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -736,14 +736,9 @@ extern void sparc_software_single_step (enum target_signal, int); #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *); -/* To print every pair of float registers as a double, we use this hook. - We also print the condition code registers in a readable format - (FIXME: can expand this to all control regs). */ - -#undef PRINT_REGISTER_HOOK -#define PRINT_REGISTER_HOOK(regno) \ - sparc_print_register_hook (regno) -extern void sparc_print_register_hook (int regno); +extern void sparc_do_registers_info (int regnum, int all); +#undef DEPRECATED_DO_REGISTERS_INFO +#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparc_do_registers_info (REGNUM, ALL) /* Optimization for storing registers to the inferior. The hook DO_DEFERRED_STORES diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h index fd25f5b..6aad71d 100644 --- a/gdb/config/sparc/tm-sparclet.h +++ b/gdb/config/sparc/tm-sparclet.h @@ -121,14 +121,16 @@ enum { #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ { \ /* Other values are returned in register %o0. */ \ - write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \ + deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \ TYPE_LENGTH (TYPE)); \ } #endif /* GDB_MULTI_ARCH */ -#undef PRINT_REGISTER_HOOK -#define PRINT_REGISTER_HOOK(regno) +extern void sparclet_do_registers_info (int regnum, int all); +#undef DEPRECATED_DO_REGISTERS_INFO +#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL) + /* Offsets into jmp_buf. Not defined by Sun, but at least documented in a comment in <machine/setjmp.h>! */ diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index eb96eda..edc5664 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -1,6 +1,7 @@ /* Parameters for execution on a z8000 series machine. - Copyright 1992, 1993, 1994, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1992, 1993, 1994, 1998, 1999, 2000, 2001, 2002 Free + Software Foundation, Inc. This file is part of GDB. @@ -276,9 +277,9 @@ int sim_z8001_mode; #define NO_STD_REGS -extern void z8k_print_register_hook (int regno); -#define PRINT_REGISTER_HOOK(regno) z8k_print_register_hook(regno) - +extern void z8k_do_registers_info (int regnum, int all); +#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \ + z8k_do_registers_info (REGNUM, ALL) extern void z8k_set_pointer_size (int newsize); #define INIT_EXTRA_SYMTAB_INFO \ diff --git a/gdb/configure b/gdb/configure index 64370a8..f96b8f9 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6546,6 +6546,43 @@ EOF fi +if test "x$ac_cv_header_thread_db_h" = "xyes"; then + echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6 +echo "configure:6552: checking whether <thread_db.h> has TD_NOTALLOC" >&5 +if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6557 "configure" +#include "confdefs.h" +#include <thread_db.h> +int main() { +int i = TD_NOTALLOC; +; return 0; } +EOF +if { (eval echo configure:6564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + gdb_cv_thread_db_h_has_td_notalloc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gdb_cv_thread_db_h_has_td_notalloc=no + +fi +rm -f conftest* + +fi + +echo "$ac_t""$gdb_cv_thread_db_h_has_td_notalloc" 1>&6 +fi +if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then + cat >> confdefs.h <<\EOF +#define THREAD_DB_HAS_TD_NOTALLOC 1 +EOF + +fi + # Check whether --enable-gdbcli or --disable-gdbcli was given. if test "${enable_gdbcli+set}" = set; then @@ -6737,7 +6774,7 @@ WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6 -echo "configure:6741: checking compiler warning flags" >&5 +echo "configure:6778: checking compiler warning flags" >&5 # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. for w in ${build_warnings}; do @@ -6747,14 +6784,14 @@ echo "configure:6741: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <<EOF -#line 6751 "configure" +#line 6788 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:6758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -6814,12 +6851,12 @@ fi if test $want_included_regex = false; then echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6818: checking for GNU regex" >&5 +echo "configure:6855: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6823 "configure" +#line 6860 "configure" #include "confdefs.h" #include <gnu-versions.h> #include <sys/types.h> @@ -6831,7 +6868,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6860,12 +6897,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:6864: checking for cygwin" >&5 +echo "configure:6901: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6869 "configure" +#line 6906 "configure" #include "confdefs.h" #if defined (__CYGWIN__) || defined (__CYGWIN32__) @@ -6903,7 +6940,7 @@ if test x$gdb_cv_os_cygwin = xyes; then else TERM_LIB= echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:6907: checking for tgetent in -lncurses" >&5 +echo "configure:6944: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6911,7 +6948,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 6915 "configure" +#line 6952 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6922,7 +6959,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:6926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6941,7 +6978,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6 -echo "configure:6945: checking for tgetent in -lHcurses" >&5 +echo "configure:6982: checking for tgetent in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6949,7 +6986,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 6953 "configure" +#line 6990 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6960,7 +6997,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:6964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6979,7 +7016,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:6983: checking for tgetent in -ltermlib" >&5 +echo "configure:7020: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6987,7 +7024,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <<EOF -#line 6991 "configure" +#line 7028 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6998,7 +7035,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7017,7 +7054,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:7021: checking for tgetent in -ltermcap" >&5 +echo "configure:7058: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7025,7 +7062,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 7029 "configure" +#line 7066 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7036,7 +7073,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7055,7 +7092,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:7059: checking for tgetent in -lcurses" >&5 +echo "configure:7096: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7063,7 +7100,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 7067 "configure" +#line 7104 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7074,7 +7111,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7093,7 +7130,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:7097: checking for tgetent in -lterminfo" >&5 +echo "configure:7134: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7101,7 +7138,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <<EOF -#line 7105 "configure" +#line 7142 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7112,7 +7149,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:7116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7277,7 +7314,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:7281: checking for Tcl configuration" >&5 +echo "configure:7318: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7385,7 +7422,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:7389: checking for Tk configuration" >&5 +echo "configure:7426: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7494,7 +7531,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:7498: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:7535: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -7560,17 +7597,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:7564: checking for tclInt.h" >&5 +echo "configure:7601: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7569 "configure" +#line 7606 "configure" #include "confdefs.h" #include <tclInt.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7630,7 +7667,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:7634: checking for Tk private headers" >&5 +echo "configure:7671: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -7696,17 +7733,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:7700: checking for tk.h" >&5 +echo "configure:7737: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7705 "configure" +#line 7742 "configure" #include "confdefs.h" #include <tk.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7752,7 +7789,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7756: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:7793: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -7775,7 +7812,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7779: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:7816: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -7798,7 +7835,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7802: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:7839: checking for Tix private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_tixh}" = x ; then for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do if test -f $i/generic/tix.h ; then @@ -7850,7 +7887,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:7854: checking for Itcl configuration" >&5 +echo "configure:7891: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7953,7 +7990,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:7957: checking for Itk configuration" >&5 +echo "configure:7994: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8056,7 +8093,7 @@ if test "${with_tixconfig+set}" = set; then fi echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 -echo "configure:8060: checking for Tix configuration" >&5 +echo "configure:8097: checking for Tix configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8202,7 +8239,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:8206: checking for X" >&5 +echo "configure:8243: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -8264,12 +8301,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 8268 "configure" +#line 8305 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8338,14 +8375,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 8342 "configure" +#line 8379 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:8349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -8637,7 +8674,7 @@ fi # ``gdbserver'' can only be built in a native configuration. if test x"${target}" = x"${host}"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:8641: checking whether gdbserver is supported on this host" >&5 +echo "configure:8678: checking whether gdbserver is supported on this host" >&5 if test x"${build_gdbserver}" = xyes ; then configdirs="${configdirs} gdbserver" SUBDIRS="${SUBDIRS} gdbserver" @@ -8699,7 +8736,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:8703: checking whether ln -s works" >&5 +echo "configure:8740: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8723,12 +8760,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:8727: checking for Cygwin environment" >&5 +echo "configure:8764: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8732 "configure" +#line 8769 "configure" #include "confdefs.h" int main() { @@ -8739,7 +8776,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:8743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8780: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -8756,19 +8793,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:8760: checking for mingw32 environment" >&5 +echo "configure:8797: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8765 "configure" +#line 8802 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:8772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -8787,7 +8824,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:8791: checking for executable suffix" >&5 +echo "configure:8828: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8797,7 +8834,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:8801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:8838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -8839,7 +8876,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:8843: checking for iconv" >&5 +echo "configure:8880: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8847,7 +8884,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 8851 "configure" +#line 8888 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -8857,7 +8894,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:8861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -8869,7 +8906,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext <<EOF -#line 8873 "configure" +#line 8910 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -8879,7 +8916,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:8883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -8900,13 +8937,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:8904: checking for iconv declaration" >&5 +echo "configure:8941: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8910 "configure" +#line 8947 "configure" #include "confdefs.h" #include <stdlib.h> @@ -8925,7 +8962,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.in b/gdb/configure.in index 8628e80..4c2e063 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -600,6 +600,23 @@ if test ${build} = ${host} -a ${host} = ${target} ; then AC_SUBST(CONFIG_LDFLAGS) fi +dnl See if we have a thread_db header file that has TD_NOTALLOC. +if test "x$ac_cv_header_thread_db_h" = "xyes"; then + AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC], + gdb_cv_thread_db_h_has_td_notalloc, + AC_TRY_COMPILE( + [#include <thread_db.h>], + [int i = TD_NOTALLOC;], + gdb_cv_thread_db_h_has_td_notalloc=yes, + gdb_cv_thread_db_h_has_td_notalloc=no + ) + ) +fi +if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then + AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1, + [Define if <thread_db.h> has the TD_NOTALLOC error code.]) +fi + dnl The CLI cannot be disabled yet, but may be in the future dnl Handle CLI sub-directory configury. diff --git a/gdb/core-sol2.c b/gdb/core-sol2.c index 0123cf4..f978b68 100644 --- a/gdb/core-sol2.c +++ b/gdb/core-sol2.c @@ -94,15 +94,19 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, struct regs *gregs = (struct regs *) core_reg_sect; /* G0 *always* holds 0. */ - *(int *) ®isters[REGISTER_BYTE (0)] = 0; + *(int *) &deprecated_registers[REGISTER_BYTE (0)] = 0; /* The globals and output registers. */ - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; - *(int *) ®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; - *(int *) ®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; + memcpy (&deprecated_registers[REGISTER_BYTE (G1_REGNUM)], + &gregs->r_g1, 15 * REGISTER_RAW_SIZE (G1_REGNUM)); + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)] + = gregs->r_ps; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)] + = gregs->r_pc; + *(int *) &deprecated_registers[REGISTER_BYTE (NPC_REGNUM)] + = gregs->r_npc; + *(int *) &deprecated_registers[REGISTER_BYTE (Y_REGNUM)] + = gregs->r_y; /* My best guess at where to get the locals and input registers is exactly where they usually are, right above @@ -112,9 +116,9 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, { int sp; - sp = *(int *) ®isters[REGISTER_BYTE (SP_REGNUM)]; + sp = *(int *) &deprecated_registers[REGISTER_BYTE (SP_REGNUM)]; if (0 != target_read_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM))) { warning ("couldn't read input and local registers from core file\n"); @@ -163,10 +167,10 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, { struct fpu *fpuregs = (struct fpu *) core_reg_sect; - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &fpuregs->fpu_fr, - sizeof (fpuregs->fpu_fr)); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr, - sizeof (FPU_FSR_TYPE)); + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + &fpuregs->fpu_fr, sizeof (fpuregs->fpu_fr)); + memcpy (&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + &fpuregs->fpu_fsr, sizeof (FPU_FSR_TYPE)); } else { diff --git a/gdb/corelow.c b/gdb/corelow.c index 785b8e1..f7e3cf0 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -466,7 +466,7 @@ get_core_registers (int regno) get_core_register_section (".reg2", 2, "floating-point", 0); get_core_register_section (".reg-xfp", 3, "extended floating-point", 0); - registers_fetched (); + deprecated_registers_fetched (); } static void diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 5d64d43..046c08b 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -972,7 +972,7 @@ cris_abi_original_store_return_value (struct type *type, char *valbuf) int len = TYPE_LENGTH (type); if (len <= REGISTER_SIZE) - write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf, len); + deprecated_write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf, len); else internal_error (__FILE__, __LINE__, "cris_abi_original_store_return_value: type length too large."); } @@ -987,7 +987,8 @@ cris_abi_v2_store_return_value (struct type *type, char *valbuf) if (len <= 2 * REGISTER_SIZE) { /* Note that this works since R10 and R11 are consecutive registers. */ - write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf, len); + deprecated_write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf, + len); } else internal_error (__FILE__, __LINE__, "cris_abi_v2_store_return_value: type length too large."); @@ -3706,8 +3707,8 @@ cris_fpless_backtrace (char *noargs, int from_tty) function (since there's no push srp in that case). */ int innermost_frame = 1; - read_register_gen (PC_REGNUM, (char *) &pc); - read_register_gen (SP_REGNUM, (char *) &sp); + deprecated_read_register_gen (PC_REGNUM, (char *) &pc); + deprecated_read_register_gen (SP_REGNUM, (char *) &sp); /* We make an explicit return when we can't find an outer frame. */ while (1) @@ -3846,7 +3847,7 @@ cris_fpless_backtrace (char *noargs, int from_tty) /* We couldn't find a push srp in the prologue, so this must be a leaf function, and thus we use the srp register directly. This should happen at most once, for the innermost function. */ - read_register_gen (SRP_REGNUM, (char *) &pc); + deprecated_read_register_gen (SRP_REGNUM, (char *) &pc); } else { @@ -4289,7 +4290,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); /* No register requires conversion from raw format to virtual format. */ set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index d338ff4..1b2987a 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -486,15 +486,15 @@ d10v_store_return_value (struct type *type, char *valbuf) if (TYPE_LENGTH (type) == 1 && TYPE_CODE (type) == TYPE_CODE_INT) { - write_register_bytes (REGISTER_BYTE (RET1_REGNUM), - &tmp, 1); /* zero the high byte */ - write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1, - valbuf, 1); /* copy the low byte */ + /* zero the high byte */ + deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM), &tmp, 1); + /* copy the low byte */ + deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1, + valbuf, 1); } else - write_register_bytes (REGISTER_BYTE (RET1_REGNUM), - valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM), + valbuf, TYPE_LENGTH (type)); } /* Extract from an array REGBUF containing the (raw) register state @@ -558,7 +558,8 @@ do_d10v_pop_frame (struct frame_info *fi) if (fi->saved_regs[regnum]) { read_memory (fi->saved_regs[regnum], raw_buffer, REGISTER_RAW_SIZE (regnum)); - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, REGISTER_RAW_SIZE (regnum)); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, + REGISTER_RAW_SIZE (regnum)); } } for (regnum = 0; regnum < SP_REGNUM; regnum++) @@ -977,7 +978,7 @@ show_regs (char *args, int from_tty) char num[MAX_REGISTER_RAW_SIZE]; int i; printf_filtered (" "); - read_register_gen (a, (char *) &num); + deprecated_read_register_gen (a, (char *) &num); for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++) { printf_filtered ("%02x", (num[i] & 0xff)); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 1991dc0..4c80ed8 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -167,34 +167,34 @@ static int has_line_numbers; /* Complaints about the symbols we have encountered. */ -struct complaint lbrac_complaint = +struct deprecated_complaint lbrac_complaint = {"bad block start address patched", 0, 0}; -struct complaint string_table_offset_complaint = +struct deprecated_complaint string_table_offset_complaint = {"bad string table offset in symbol %d", 0, 0}; -struct complaint unknown_symtype_complaint = +struct deprecated_complaint unknown_symtype_complaint = {"unknown symbol type %s", 0, 0}; -struct complaint unknown_symchar_complaint = +struct deprecated_complaint unknown_symchar_complaint = {"unknown symbol descriptor `%c'", 0, 0}; -struct complaint lbrac_rbrac_complaint = +struct deprecated_complaint lbrac_rbrac_complaint = {"block start larger than block end", 0, 0}; -struct complaint lbrac_unmatched_complaint = +struct deprecated_complaint lbrac_unmatched_complaint = {"unmatched N_LBRAC before symtab pos %d", 0, 0}; -struct complaint lbrac_mismatch_complaint = +struct deprecated_complaint lbrac_mismatch_complaint = {"N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", 0, 0}; -struct complaint repeated_header_complaint = +struct deprecated_complaint repeated_header_complaint = {"\"repeated\" header file %s not previously seen, at symtab pos %d", 0, 0}; -struct complaint unclaimed_bincl_complaint = +struct deprecated_complaint unclaimed_bincl_complaint = {"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0}; -struct complaint discarding_local_symbols_complaint = +struct deprecated_complaint discarding_local_symbols_complaint = {"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0}; /* find_text_range --- find start and end of loadable code sections @@ -1360,7 +1360,7 @@ read_dbx_symtab (struct objfile *objfile) switch (nlist.n_type) { - static struct complaint function_outside_compilation_unit = { + static struct deprecated_complaint function_outside_compilation_unit = { "function `%s' appears to be defined outside of all compilation units", 0, 0 }; char *p; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 1923c8b..7f05283 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2002-10-26 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + definition of DO_REGISTERS_INFO. + 2002-10-18 Kevin Buettner <kevinb@redhat.com> * gdbint.texinfo (Address Classes): Fix problems with insertion diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index cdb06b2..0cdbc05 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3218,12 +3218,6 @@ Similarly, for hardware breakpoints. If defined, this should evaluate to 1 if @var{addr} is in a shared library in which breakpoints cannot be set and so should be disabled. -@item DO_REGISTERS_INFO -@findex DO_REGISTERS_INFO -If defined, use this to print the value of a register or all registers. - -This method is deprecated. - @item PRINT_FLOAT_INFO() @findex PRINT_FLOAT_INFO If defined, then the @samp{info float} command will print information about diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c index ddb42ab..30c2db7 100644 --- a/gdb/dwarf2cfi.c +++ b/gdb/dwarf2cfi.c @@ -180,24 +180,24 @@ static void fde_chunks_need_space (); static void unwind_tmp_obstack_init (); static void unwind_tmp_obstack_free (); -static unsigned int read_1u (bfd * abfd, char **p); -static int read_1s (bfd * abfd, char **p); -static unsigned int read_2u (bfd * abfd, char **p); -static int read_2s (bfd * abfd, char **p); -static unsigned int read_4u (bfd * abfd, char **p); -static int read_4s (bfd * abfd, char **p); -static ULONGEST read_8u (bfd * abfd, char **p); -static LONGEST read_8s (bfd * abfd, char **p); - -static ULONGEST read_uleb128 (bfd * abfd, char **p); -static LONGEST read_sleb128 (bfd * abfd, char **p); -static CORE_ADDR read_pointer (bfd * abfd, char **p); -static CORE_ADDR read_encoded_pointer (bfd * abfd, char **p, +static unsigned int read_1u (bfd *abfd, char **p); +static int read_1s (bfd *abfd, char **p); +static unsigned int read_2u (bfd *abfd, char **p); +static int read_2s (bfd *abfd, char **p); +static unsigned int read_4u (bfd *abfd, char **p); +static int read_4s (bfd *abfd, char **p); +static ULONGEST read_8u (bfd *abfd, char **p); +static LONGEST read_8s (bfd *abfd, char **p); + +static ULONGEST read_uleb128 (bfd *abfd, char **p); +static LONGEST read_sleb128 (bfd *abfd, char **p); +static CORE_ADDR read_pointer (bfd *abfd, char **p); +static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding); static enum ptr_encoding pointer_encoding (unsigned char encoding); -static LONGEST read_initial_length (bfd * abfd, char *buf, int *bytes_read); -static ULONGEST read_length (bfd * abfd, char *buf, int *bytes_read, +static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read); +static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read, int dwarf64); static int is_cie (ULONGEST cie_id, int dwarf64); @@ -304,26 +304,17 @@ context_cpy (struct context *dst, struct context *src) int regs_size = sizeof (struct context_reg) * NUM_REGS; struct context_reg *dreg; - /* Structure dst contains a pointer to an array of - * registers of a given frame as well as src does. This - * array was already allocated before dst was passed to - * context_cpy but the pointer to it was overriden by - * '*dst = *src' and the array was lost. This led to the - * situation, that we've had a copy of src placed in dst, - * but both of them pointed to the same regs array and - * thus we've sometimes blindly rewritten it. Now we save - * the pointer before copying src to dst, return it back - * after that and copy the registers into their new place - * finally. --- mludvig@suse.cz */ + /* Since `struct context' contains a pointer to an array with + register values, make sure we end up with a copy of that array, + and not with a copy of the pointer to that array. */ dreg = dst->reg; *dst = *src; dst->reg = dreg; - memcpy (dst->reg, src->reg, regs_size); } static unsigned int -read_1u (bfd * abfd, char **p) +read_1u (bfd *abfd, char **p) { unsigned ret; @@ -333,7 +324,7 @@ read_1u (bfd * abfd, char **p) } static int -read_1s (bfd * abfd, char **p) +read_1s (bfd *abfd, char **p) { int ret; @@ -343,7 +334,7 @@ read_1s (bfd * abfd, char **p) } static unsigned int -read_2u (bfd * abfd, char **p) +read_2u (bfd *abfd, char **p) { unsigned ret; @@ -353,7 +344,7 @@ read_2u (bfd * abfd, char **p) } static int -read_2s (bfd * abfd, char **p) +read_2s (bfd *abfd, char **p) { int ret; @@ -363,7 +354,7 @@ read_2s (bfd * abfd, char **p) } static unsigned int -read_4u (bfd * abfd, char **p) +read_4u (bfd *abfd, char **p) { unsigned int ret; @@ -373,7 +364,7 @@ read_4u (bfd * abfd, char **p) } static int -read_4s (bfd * abfd, char **p) +read_4s (bfd *abfd, char **p) { int ret; @@ -383,7 +374,7 @@ read_4s (bfd * abfd, char **p) } static ULONGEST -read_8u (bfd * abfd, char **p) +read_8u (bfd *abfd, char **p) { ULONGEST ret; @@ -393,7 +384,7 @@ read_8u (bfd * abfd, char **p) } static LONGEST -read_8s (bfd * abfd, char **p) +read_8s (bfd *abfd, char **p) { LONGEST ret; @@ -403,7 +394,7 @@ read_8s (bfd * abfd, char **p) } static ULONGEST -read_uleb128 (bfd * abfd, char **p) +read_uleb128 (bfd *abfd, char **p) { ULONGEST ret; int i, shift; @@ -427,7 +418,7 @@ read_uleb128 (bfd * abfd, char **p) } static LONGEST -read_sleb128 (bfd * abfd, char **p) +read_sleb128 (bfd *abfd, char **p) { LONGEST ret; int i, shift, size, num_read; @@ -457,7 +448,7 @@ read_sleb128 (bfd * abfd, char **p) } static CORE_ADDR -read_pointer (bfd * abfd, char **p) +read_pointer (bfd *abfd, char **p) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) { @@ -470,11 +461,11 @@ read_pointer (bfd * abfd, char **p) } } -/* This functions only reads appropriate amount of data from *p - * and returns the resulting value. Calling function must handle - * different encoding possibilities itself! */ +/* Read the appropriate amount of data from *P and return the + resulting value based on ENCODING, which the calling function must + provide. */ static CORE_ADDR -read_encoded_pointer (bfd * abfd, char **p, unsigned char encoding) +read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding) { CORE_ADDR ret; @@ -519,10 +510,10 @@ read_encoded_pointer (bfd * abfd, char **p, unsigned char encoding) return ret; } -/* Variable 'encoding' carries 3 different flags: - * - encoding & 0x0f : size of the address (handled in read_encoded_pointer()) - * - encoding & 0x70 : type (absolute, relative, ...) - * - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80). */ +/* The variable 'encoding' carries three different flags: + - encoding & 0x0f : size of the address (handled in read_encoded_pointer()) + - encoding & 0x70 : type (absolute, relative, ...) + - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80). */ enum ptr_encoding pointer_encoding (unsigned char encoding) { @@ -547,7 +538,7 @@ pointer_encoding (unsigned char encoding) } static LONGEST -read_initial_length (bfd * abfd, char *buf, int *bytes_read) +read_initial_length (bfd *abfd, char *buf, int *bytes_read) { LONGEST ret = 0; @@ -567,7 +558,7 @@ read_initial_length (bfd * abfd, char *buf, int *bytes_read) } static ULONGEST -read_length (bfd * abfd, char *buf, int *bytes_read, int dwarf64) +read_length (bfd *abfd, char *buf, int *bytes_read, int dwarf64) { if (dwarf64) { @@ -833,14 +824,14 @@ get_reg (char *reg, struct context *context, int regnum) switch (context->reg[regnum].how) { case REG_CTX_UNSAVED: - read_register_gen (regnum, reg); + deprecated_read_register_gen (regnum, reg); break; case REG_CTX_SAVED_OFFSET: target_read_memory (context->cfa + context->reg[regnum].loc.offset, reg, REGISTER_RAW_SIZE (regnum)); break; case REG_CTX_SAVED_REG: - read_register_gen (context->reg[regnum].loc.reg, reg); + deprecated_read_register_gen (context->reg[regnum].loc.reg, reg); break; case REG_CTX_SAVED_ADDR: target_read_memory (context->reg[regnum].loc.addr, @@ -1697,7 +1688,7 @@ cfi_write_fp (CORE_ADDR val) if (fs->cfa_how == CFA_REG_OFFSET) { val -= fs->cfa_offset; - write_register_gen (fs->cfa_reg, (char *) &val); + deprecated_write_register_gen (fs->cfa_reg, (char *) &val); } else warning ("Can't write fp."); @@ -1716,8 +1707,8 @@ cfi_pop_frame (struct frame_info *fi) for (regnum = 0; regnum < NUM_REGS; regnum++) { get_reg (regbuf, UNWIND_CONTEXT (fi), regnum); - write_register_bytes (REGISTER_BYTE (regnum), regbuf, - REGISTER_RAW_SIZE (regnum)); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), regbuf, + REGISTER_RAW_SIZE (regnum)); } write_register (PC_REGNUM, UNWIND_CONTEXT (fi)->ra); @@ -1828,7 +1819,7 @@ cfi_get_saved_register (char *raw_buffer, if (!frame->next) { - read_register_gen (regnum, raw_buffer); + deprecated_read_register_gen (regnum, raw_buffer); if (lval != NULL) *lval = lval_register; if (addrp != NULL) @@ -1840,7 +1831,7 @@ cfi_get_saved_register (char *raw_buffer, switch (UNWIND_CONTEXT (frame)->reg[regnum].how) { case REG_CTX_UNSAVED: - read_register_gen (regnum, raw_buffer); + deprecated_read_register_gen (regnum, raw_buffer); if (lval != NULL) *lval = not_lval; if (optimized != NULL) @@ -1858,8 +1849,8 @@ cfi_get_saved_register (char *raw_buffer, UNWIND_CONTEXT (frame)->reg[regnum].loc.offset; break; case REG_CTX_SAVED_REG: - read_register_gen (UNWIND_CONTEXT (frame)->reg[regnum].loc.reg, - raw_buffer); + deprecated_read_register_gen (UNWIND_CONTEXT (frame)->reg[regnum].loc.reg, + raw_buffer); if (lval != NULL) *lval = lval_register; if (addrp != NULL) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2963e0b..35d5d2e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -561,135 +561,135 @@ struct field_info /* Various complaints about symbol reading that don't abort the process */ -static struct complaint dwarf2_const_ignored = +static struct deprecated_complaint dwarf2_const_ignored = { "type qualifier 'const' ignored", 0, 0 }; -static struct complaint dwarf2_volatile_ignored = +static struct deprecated_complaint dwarf2_volatile_ignored = { "type qualifier 'volatile' ignored", 0, 0 }; -static struct complaint dwarf2_non_const_array_bound_ignored = +static struct deprecated_complaint dwarf2_non_const_array_bound_ignored = { "non-constant array bounds form '%s' ignored", 0, 0 }; -static struct complaint dwarf2_missing_line_number_section = +static struct deprecated_complaint dwarf2_missing_line_number_section = { "missing .debug_line section", 0, 0 }; -static struct complaint dwarf2_statement_list_fits_in_line_number_section = +static struct deprecated_complaint dwarf2_statement_list_fits_in_line_number_section = { "statement list doesn't fit in .debug_line section", 0, 0 }; -static struct complaint dwarf2_mangled_line_number_section = +static struct deprecated_complaint dwarf2_mangled_line_number_section = { "mangled .debug_line section", 0, 0 }; -static struct complaint dwarf2_unsupported_die_ref_attr = +static struct deprecated_complaint dwarf2_unsupported_die_ref_attr = { "unsupported die ref attribute form: '%s'", 0, 0 }; -static struct complaint dwarf2_unsupported_stack_op = +static struct deprecated_complaint dwarf2_unsupported_stack_op = { "unsupported stack op: '%s'", 0, 0 }; -static struct complaint dwarf2_complex_location_expr = +static struct deprecated_complaint dwarf2_complex_location_expr = { "location expression too complex", 0, 0 }; -static struct complaint dwarf2_unsupported_tag = +static struct deprecated_complaint dwarf2_unsupported_tag = { "unsupported tag: '%s'", 0, 0 }; -static struct complaint dwarf2_unsupported_at_encoding = +static struct deprecated_complaint dwarf2_unsupported_at_encoding = { "unsupported DW_AT_encoding: '%s'", 0, 0 }; -static struct complaint dwarf2_unsupported_at_frame_base = +static struct deprecated_complaint dwarf2_unsupported_at_frame_base = { "unsupported DW_AT_frame_base for function '%s'", 0, 0 }; -static struct complaint dwarf2_unexpected_tag = +static struct deprecated_complaint dwarf2_unexpected_tag = { "unexepected tag in read_type_die: '%s'", 0, 0 }; -static struct complaint dwarf2_missing_at_frame_base = +static struct deprecated_complaint dwarf2_missing_at_frame_base = { "DW_AT_frame_base missing for DW_OP_fbreg", 0, 0 }; -static struct complaint dwarf2_bad_static_member_name = +static struct deprecated_complaint dwarf2_bad_static_member_name = { "unrecognized static data member name '%s'", 0, 0 }; -static struct complaint dwarf2_unsupported_accessibility = +static struct deprecated_complaint dwarf2_unsupported_accessibility = { "unsupported accessibility %d", 0, 0 }; -static struct complaint dwarf2_bad_member_name_complaint = +static struct deprecated_complaint dwarf2_bad_member_name_complaint = { "cannot extract member name from '%s'", 0, 0 }; -static struct complaint dwarf2_missing_member_fn_type_complaint = +static struct deprecated_complaint dwarf2_missing_member_fn_type_complaint = { "member function type missing for '%s'", 0, 0 }; -static struct complaint dwarf2_vtbl_not_found_complaint = +static struct deprecated_complaint dwarf2_vtbl_not_found_complaint = { "virtual function table pointer not found when defining class '%s'", 0, 0 }; -static struct complaint dwarf2_absolute_sibling_complaint = +static struct deprecated_complaint dwarf2_absolute_sibling_complaint = { "ignoring absolute DW_AT_sibling", 0, 0 }; -static struct complaint dwarf2_const_value_length_mismatch = +static struct deprecated_complaint dwarf2_const_value_length_mismatch = { "const value length mismatch for '%s', got %d, expected %d", 0, 0 }; -static struct complaint dwarf2_unsupported_const_value_attr = +static struct deprecated_complaint dwarf2_unsupported_const_value_attr = { "unsupported const value attribute form: '%s'", 0, 0 }; -static struct complaint dwarf2_misplaced_line_number = +static struct deprecated_complaint dwarf2_misplaced_line_number = { "misplaced first line number at 0x%lx for '%s'", 0, 0 }; -static struct complaint dwarf2_line_header_too_long = +static struct deprecated_complaint dwarf2_line_header_too_long = { "line number info header doesn't fit in `.debug_line' section", 0, 0 }; -static struct complaint dwarf2_missing_macinfo_section = +static struct deprecated_complaint dwarf2_missing_macinfo_section = { "missing .debug_macinfo section", 0, 0 }; -static struct complaint dwarf2_macros_too_long = +static struct deprecated_complaint dwarf2_macros_too_long = { "macro info runs off end of `.debug_macinfo' section", 0, 0 }; -static struct complaint dwarf2_macros_not_terminated = +static struct deprecated_complaint dwarf2_macros_not_terminated = { "no terminating 0-type entry for macros in `.debug_macinfo' section", 0, 0 }; -static struct complaint dwarf2_macro_outside_file = +static struct deprecated_complaint dwarf2_macro_outside_file = { "debug info gives macro %s outside of any file: %s", 0, 0 }; -static struct complaint dwarf2_macro_unmatched_end_file = +static struct deprecated_complaint dwarf2_macro_unmatched_end_file = { "macro debug info has an unmatched `close_file' directive", 0, 0 }; -static struct complaint dwarf2_macro_malformed_definition = +static struct deprecated_complaint dwarf2_macro_malformed_definition = { "macro debug info contains a malformed macro definition:\n`%s'", 0, 0 }; -static struct complaint dwarf2_macro_spaces_in_definition = +static struct deprecated_complaint dwarf2_macro_spaces_in_definition = { "macro definition contains spaces in formal argument list:\n`%s'", 0, 0 }; -static struct complaint dwarf2_invalid_attrib_class = +static struct deprecated_complaint dwarf2_invalid_attrib_class = { "invalid attribute class or form for '%s' in '%s'", 0, 0 }; -static struct complaint dwarf2_invalid_pointer_size = +static struct deprecated_complaint dwarf2_invalid_pointer_size = { "invalid pointer size %d", 0, 0 }; @@ -2019,7 +2019,18 @@ read_func_scope (struct die_info *die, struct objfile *objfile, /* Make a block for the local symbols within. */ finish_block (new->name, &local_symbols, new->old_blocks, lowpc, highpc, objfile); - list_in_scope = &file_symbols; + + /* In C++, we can have functions nested inside functions (e.g., when + a function declares a class that has methods). This means that + when we finish processing a function scope, we may need to go + back to building a containing block's symbol lists. */ + local_symbols = new->locals; + param_symbols = new->params; + + /* If we've finished processing a top-level function, subsequent + symbols go in the file symbol list. */ + if (outermost_context_p ()) + list_in_scope = &file_symbols; } /* Process all the DIES contained within a lexical block scope. Start @@ -2144,6 +2155,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, /* Get type of field. */ fp->type = die_type (die, objfile, cu_header); + FIELD_STATIC_KIND (*fp) = 0; + /* Get bit size of field (zero if none). */ attr = dwarf_attr (die, DW_AT_bit_size); if (attr) @@ -2250,6 +2263,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), objfile, cu_header) * bits_per_byte); FIELD_BITSIZE (*fp) = 0; + FIELD_STATIC_KIND (*fp) = 0; FIELD_TYPE (*fp) = die_type (die, objfile, cu_header); FIELD_NAME (*fp) = type_name_no_tag (fp->type); fip->nbaseclasses++; @@ -2753,6 +2767,7 @@ read_enumeration (struct die_info *die, struct objfile *objfile, FIELD_TYPE (fields[num_fields]) = NULL; FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym); FIELD_BITSIZE (fields[num_fields]) = 0; + FIELD_STATIC_KIND (fields[num_fields]) = 0; num_fields++; } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 975c9af..a54e684 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -62,112 +62,112 @@ /* Complaints that can be issued during DWARF debug info reading. */ -struct complaint no_bfd_get_N = +struct deprecated_complaint no_bfd_get_N = { "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0 }; -struct complaint malformed_die = +struct deprecated_complaint malformed_die = { "DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0 }; -struct complaint bad_die_ref = +struct deprecated_complaint bad_die_ref = { "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0 }; -struct complaint unknown_attribute_form = +struct deprecated_complaint unknown_attribute_form = { "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0 }; -struct complaint unknown_attribute_length = +struct deprecated_complaint unknown_attribute_length = { "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0 }; -struct complaint unexpected_fund_type = +struct deprecated_complaint unexpected_fund_type = { "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0 }; -struct complaint unknown_type_modifier = +struct deprecated_complaint unknown_type_modifier = { "DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0 }; -struct complaint volatile_ignored = +struct deprecated_complaint volatile_ignored = { "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0 }; -struct complaint const_ignored = +struct deprecated_complaint const_ignored = { "DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0 }; -struct complaint botched_modified_type = +struct deprecated_complaint botched_modified_type = { "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0 }; -struct complaint op_deref2 = +struct deprecated_complaint op_deref2 = { "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0 }; -struct complaint op_deref4 = +struct deprecated_complaint op_deref4 = { "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0 }; -struct complaint basereg_not_handled = +struct deprecated_complaint basereg_not_handled = { "DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0 }; -struct complaint dup_user_type_allocation = +struct deprecated_complaint dup_user_type_allocation = { "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0 }; -struct complaint dup_user_type_definition = +struct deprecated_complaint dup_user_type_definition = { "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0 }; -struct complaint missing_tag = +struct deprecated_complaint missing_tag = { "DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0 }; -struct complaint bad_array_element_type = +struct deprecated_complaint bad_array_element_type = { "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0 }; -struct complaint subscript_data_items = +struct deprecated_complaint subscript_data_items = { "DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0 }; -struct complaint unhandled_array_subscript_format = +struct deprecated_complaint unhandled_array_subscript_format = { "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0 }; -struct complaint unknown_array_subscript_format = +struct deprecated_complaint unknown_array_subscript_format = { "DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0 }; -struct complaint not_row_major = +struct deprecated_complaint not_row_major = { "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0 }; -struct complaint missing_at_name = +struct deprecated_complaint missing_at_name = { "DIE @ 0x%x, AT_name tag missing", 0, 0 }; @@ -1027,6 +1027,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, &objfile->type_obstack); FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr); + FIELD_STATIC_KIND (list->field) = 0; /* Handle bit fields. */ FIELD_BITSIZE (list->field) = mbr.at_bit_size; if (BITS_BIG_ENDIAN) @@ -1694,6 +1695,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) list = new; FIELD_TYPE (list->field) = NULL; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; FIELD_BITPOS (list->field) = target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED, objfile); diff --git a/gdb/elfread.c b/gdb/elfread.c index 7d37297..a29a71b 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -54,16 +54,16 @@ struct elfinfo /* Various things we might complain about... */ -struct complaint section_info_complaint = +struct deprecated_complaint section_info_complaint = {"elf/stab section information %s without a preceding file symbol", 0, 0}; -struct complaint section_info_dup_complaint = +struct deprecated_complaint section_info_dup_complaint = {"duplicated elf/stab section information for %s", 0, 0}; -struct complaint stab_info_mismatch_complaint = +struct deprecated_complaint stab_info_mismatch_complaint = {"elf/stab section information missing for %s", 0, 0}; -struct complaint stab_info_questionable_complaint = +struct deprecated_complaint stab_info_questionable_complaint = {"elf/stab section information questionable for %s", 0, 0}; static void free_elfinfo (void *); diff --git a/gdb/event-loop.c b/gdb/event-loop.c index 0fa37c1..c8d12f9 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -1,5 +1,5 @@ /* Event loop machinery for GDB, the GNU debugger. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions. This file is part of GDB. @@ -397,6 +397,11 @@ start_event_loop (void) gdb_result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL); if (gdb_result < 0) break; + + /* If we long-jumped out of do_one_event, we probably + didn't get around to resetting the prompt, which leaves + readline in a messed-up state. Reset it here. */ + if (gdb_result == 0) { /* FIXME: this should really be a call to a hook that is diff --git a/gdb/event-top.c b/gdb/event-top.c index 9d871d6..8f39998 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -1168,14 +1168,39 @@ gdb_setup_readline (void) } } +/* Disable command input through the standard CLI channels. Used in + the suspend proc for interpreters that use the standard gdb readline + interface, like the cli & the mi. */ +void +gdb_disable_readline (void) +{ + if (event_loop_p) + { + /* FIXME - It is too heavyweight to delete and remake these + every time you run an interpreter that needs readline. + It is probably better to have the interpreters cache these, + which in turn means that this needs to be moved into interpreter + specific code. */ + +#if 0 + ui_file_delete (gdb_stdout); + ui_file_delete (gdb_stderr); + gdb_stdlog = NULL; + gdb_stdtarg = NULL; +#endif + + rl_callback_handler_remove (); + delete_file_handler (input_fd); + } +} + void _initialize_event_loop (void) { gdb_setup_readline (); + /* Tell gdb to use the cli_command_loop as the main loop. */ if (event_loop_p && command_loop_hook == NULL) - { - /* Tell gdb to use the cli_command_loop as the main loop. */ - command_loop_hook = cli_command_loop; - } + command_loop_hook = cli_command_loop; } + diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 57db6fa..17693f7 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -242,9 +242,11 @@ exp : '(' exp ')' /* Expressions, not including the comma operator. */ exp : '*' exp %prec UNARY { write_exp_elt_opcode (UNOP_IND); } + ; exp : '&' exp %prec UNARY { write_exp_elt_opcode (UNOP_ADDR); } + ; exp : '-' exp %prec UNARY { write_exp_elt_opcode (UNOP_NEG); } @@ -284,6 +286,7 @@ arglist : exp arglist : substring { arglist_len = 2;} + ; arglist : arglist ',' exp %prec ABOVE_COMMA { arglist_len++; } diff --git a/gdb/findvar.c b/gdb/findvar.c index 1a952f7..e375c2a 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -545,14 +545,6 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_THREAD_LOCAL_STATIC: { -#if 0 - /* FIXME: ezannoni 2002-10-21: Temporarly disable the code - below, until the rest of the TLS support code is checked - in. */ - - /* We want to let the target / ABI-specific code construct - this value for us, so we need to dispose of the value - allocated for us above. */ if (target_get_thread_local_address_p ()) addr = target_get_thread_local_address (inferior_ptid, SYMBOL_OBJFILE (var), @@ -561,7 +553,6 @@ addresses have not been bound by the dynamic loader. Try again when executable i finding TLS is an ABI-specific thing. But we don't do that yet. */ else -#endif error ("Cannot find thread-local variables on this target"); break; } diff --git a/gdb/frame.c b/gdb/frame.c index 1ad3b09..bfefc77 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -29,6 +29,10 @@ #include "gdb_assert.h" #include "gdb_string.h" #include "builtin-regs.h" +#include "gdb_obstack.h" +#include "dummy-frame.h" +#include "gdbcore.h" +#include "annotate.h" /* Return a frame uniq ID that can be used to, later re-find the frame. */ @@ -115,7 +119,7 @@ frame_register_unwind (struct frame_info *frame, int regnum, available? */ *realnump = regnum; if (bufferp) - read_register_gen (regnum, bufferp); + deprecated_read_register_gen (regnum, bufferp); return; } @@ -125,6 +129,66 @@ frame_register_unwind (struct frame_info *frame, int regnum, } void +frame_register (struct frame_info *frame, int regnum, + int *optimizedp, enum lval_type *lvalp, + CORE_ADDR *addrp, int *realnump, void *bufferp) +{ + /* Require all but BUFFERP to be valid. A NULL BUFFERP indicates + that the value proper does not need to be fetched. */ + gdb_assert (optimizedp != NULL); + gdb_assert (lvalp != NULL); + gdb_assert (addrp != NULL); + gdb_assert (realnump != NULL); + /* gdb_assert (bufferp != NULL); */ + + /* Ulgh! Old code that, for lval_register, sets ADDRP to the offset + of the register in the register cache. It should instead return + the REGNUM corresponding to that register. Translate the . */ + if (GET_SAVED_REGISTER_P ()) + { + GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame, regnum, lvalp); + /* Compute the REALNUM if the caller wants it. */ + if (*lvalp == lval_register) + { + int regnum; + for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) + { + if (*addrp == register_offset_hack (current_gdbarch, regnum)) + { + *realnump = regnum; + return; + } + } + internal_error (__FILE__, __LINE__, + "Failed to compute the register number corresponding" + " to 0x%s", paddr_d (*addrp)); + } + *realnump = -1; + return; + } + + /* Reached the the bottom (youngest, inner most) of the frame chain + (youngest, inner most) frame, go direct to the hardware register + cache (do not pass go, do not try to cache the value, ...). The + unwound value would have been cached in frame->next but that + doesn't exist. This doesn't matter as the hardware register + cache is stopping any unnecessary accesses to the target. */ + + /* NOTE: cagney/2002-04-14: It would be nice if, instead of a + special case, there was always an inner frame dedicated to the + hardware registers. Unfortunatly, there is too much unwind code + around that looks up/down the frame chain while making the + assumption that each frame level is using the same unwind code. */ + + if (frame == NULL) + frame_register_unwind (NULL, regnum, optimizedp, lvalp, addrp, realnump, + bufferp); + else + frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, + realnump, bufferp); +} + +void frame_unwind_signed_register (struct frame_info *frame, int regnum, LONGEST *val) { @@ -153,6 +217,40 @@ frame_unwind_unsigned_register (struct frame_info *frame, int regnum, } 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_unwind_unsigned_register (get_next_frame (frame), regnum, val); +} + +void +frame_read_signed_register (struct frame_info *frame, int regnum, + LONGEST *val) +{ + /* See note in frame_read_unsigned_register(). */ + gdb_assert (frame != NULL); + frame_unwind_signed_register (get_next_frame (frame), regnum, val); +} + +void generic_unwind_get_saved_register (char *raw_buffer, int *optimizedp, CORE_ADDR *addrp, @@ -206,7 +304,13 @@ get_saved_register (char *raw_buffer, int regnum, enum lval_type *lval) { - GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval); + if (GET_SAVED_REGISTER_P ()) + { + GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval); + return; + } + generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, + regnum, lval); } /* frame_register_read () @@ -219,9 +323,11 @@ get_saved_register (char *raw_buffer, int frame_register_read (struct frame_info *frame, int regnum, void *myaddr) { - int optim; - get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame, - regnum, (enum lval_type *) NULL); + int optimized; + enum lval_type lval; + CORE_ADDR addr; + int realnum; + frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr); /* FIXME: cagney/2002-05-15: This test, is just bogus. @@ -233,7 +339,7 @@ frame_register_read (struct frame_info *frame, int regnum, void *myaddr) if (register_cached (regnum) < 0) return 0; /* register value not available */ - return !optim; + return !optimized; } @@ -276,3 +382,583 @@ frame_map_regnum_to_name (int regnum) return REGISTER_NAME (regnum); return builtin_reg_map_regnum_to_name (regnum); } + +/* Info about the innermost stack frame (contents of FP register) */ + +static struct frame_info *current_frame; + +/* Cache for frame addresses already read by gdb. Valid only while + inferior is stopped. Control variables for the frame cache should + be local to this module. */ + +static struct obstack frame_cache_obstack; + +void * +frame_obstack_alloc (unsigned long size) +{ + return obstack_alloc (&frame_cache_obstack, size); +} + +void +frame_saved_regs_zalloc (struct frame_info *fi) +{ + fi->saved_regs = (CORE_ADDR *) + frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); + memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS); +} + + +/* Return the innermost (currently executing) stack frame. */ + +struct frame_info * +get_current_frame (void) +{ + if (current_frame == NULL) + { + if (target_has_stack) + current_frame = create_new_frame (read_fp (), read_pc ()); + else + error ("No stack."); + } + return current_frame; +} + +void +set_current_frame (struct frame_info *frame) +{ + current_frame = frame; +} + +/* Return the register saved in the simplistic ``saved_regs'' cache. + If the value isn't here AND a value is needed, try the next inner + most frame. */ + +static void +frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp) +{ + /* There is always a frame at this point. And THIS is the frame + we're interested in. */ + gdb_assert (frame != NULL); + /* If we're using generic dummy frames, we'd better not be in a call + dummy. (generic_call_dummy_register_unwind ought to have been called + instead.) */ + gdb_assert (!(USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))); + + /* Load the saved_regs register cache. */ + if (frame->saved_regs == NULL) + FRAME_INIT_SAVED_REGS (frame); + + if (frame->saved_regs != NULL + && frame->saved_regs[regnum] != 0) + { + if (regnum == SP_REGNUM) + { + /* SP register treated specially. */ + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (bufferp != NULL) + store_address (bufferp, REGISTER_RAW_SIZE (regnum), + frame->saved_regs[regnum]); + } + else + { + /* Any other register is saved in memory, fetch it but cache + a local copy of its value. */ + *optimizedp = 0; + *lvalp = lval_memory; + *addrp = frame->saved_regs[regnum]; + *realnump = -1; + if (bufferp != NULL) + { +#if 1 + /* Save each register value, as it is read in, in a + frame based cache. */ + void **regs = (*cache); + if (regs == NULL) + { + int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS) + * sizeof (void *)); + regs = frame_obstack_alloc (sizeof_cache); + memset (regs, 0, sizeof_cache); + (*cache) = regs; + } + if (regs[regnum] == NULL) + { + regs[regnum] + = frame_obstack_alloc (REGISTER_RAW_SIZE (regnum)); + read_memory (frame->saved_regs[regnum], regs[regnum], + REGISTER_RAW_SIZE (regnum)); + } + memcpy (bufferp, regs[regnum], REGISTER_RAW_SIZE (regnum)); +#else + /* Read the value in from memory. */ + read_memory (frame->saved_regs[regnum], bufferp, + REGISTER_RAW_SIZE (regnum)); +#endif + } + } + return; + } + + /* No luck, assume this and the next frame have the same register + value. If a value is needed, pass the request on down the chain; + otherwise just return an indication that the value is in the same + register as the next frame. */ + if (bufferp == NULL) + { + *optimizedp = 0; + *lvalp = lval_register; + *addrp = 0; + *realnump = regnum; + } + else + { + frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, + realnump, bufferp); + } +} + +/* Function: get_saved_register + Find register number REGNUM relative to FRAME and put its (raw, + target format) contents in *RAW_BUFFER. + + Set *OPTIMIZED if the variable was optimized out (and thus can't be + fetched). Note that this is never set to anything other than zero + in this implementation. + + Set *LVAL to lval_memory, lval_register, or not_lval, depending on + whether the value was fetched from memory, from a register, or in a + strange and non-modifiable way (e.g. a frame pointer which was + calculated rather than fetched). We will use not_lval for values + fetched from generic dummy frames. + + Set *ADDRP to the address, either in memory or as a REGISTER_BYTE + offset into the registers array. If the value is stored in a dummy + frame, set *ADDRP to zero. + + To use this implementation, define a function called + "get_saved_register" in your target code, which simply passes all + of its arguments to this function. + + The argument RAW_BUFFER must point to aligned memory. */ + +void +deprecated_generic_get_saved_register (char *raw_buffer, int *optimized, + CORE_ADDR *addrp, + struct frame_info *frame, int regnum, + enum lval_type *lval) +{ + if (!target_has_registers) + error ("No registers."); + + /* Normal systems don't optimize out things with register numbers. */ + if (optimized != NULL) + *optimized = 0; + + if (addrp) /* default assumption: not found in memory */ + *addrp = 0; + + /* Note: since the current frame's registers could only have been + saved by frames INTERIOR TO the current frame, we skip examining + the current frame itself: otherwise, we would be getting the + previous frame's registers which were saved by the current frame. */ + + while (frame && ((frame = frame->next) != NULL)) + { + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + { + if (lval) /* found it in a CALL_DUMMY frame */ + *lval = not_lval; + if (raw_buffer) + /* FIXME: cagney/2002-06-26: This should be via the + gdbarch_register_read() method so that it, on the fly, + constructs either a raw or pseudo register from the raw + register cache. */ + regcache_raw_read (generic_find_dummy_frame (frame->pc, + frame->frame), + regnum, raw_buffer); + return; + } + + FRAME_INIT_SAVED_REGS (frame); + if (frame->saved_regs != NULL + && frame->saved_regs[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_address (raw_buffer, REGISTER_RAW_SIZE (regnum), + frame->saved_regs[regnum]); + } + else + { + if (addrp) /* any other register */ + *addrp = frame->saved_regs[regnum]; + if (raw_buffer) + read_memory (frame->saved_regs[regnum], raw_buffer, + REGISTER_RAW_SIZE (regnum)); + } + return; + } + } + + /* If we get thru the loop to this point, it means the register was + not saved in any frame. Return the actual live-register value. */ + + if (lval) /* found it in a live register */ + *lval = lval_register; + if (addrp) + *addrp = REGISTER_BYTE (regnum); + if (raw_buffer) + deprecated_read_register_gen (regnum, raw_buffer); +} + +/* Using the PC, select a mechanism for unwinding a frame returning + the previous frame. The register unwind function should, on + demand, initialize the ->context object. */ + +static void +set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp, + frame_register_unwind_ftype **unwind) +{ + if (!USE_GENERIC_DUMMY_FRAMES) + /* Still need to set this to something. The ``info frame'' code + calls this function to find out where the saved registers are. + Hopefully this is robust enough to stop any core dumps and + return vaguely correct values.. */ + *unwind = frame_saved_regs_register_unwind; + else if (PC_IN_CALL_DUMMY (pc, fp, fp)) + *unwind = dummy_frame_register_unwind; + else + *unwind = frame_saved_regs_register_unwind; +} + +/* Create an arbitrary (i.e. address specified by user) or innermost frame. + Always returns a non-NULL value. */ + +struct frame_info * +create_new_frame (CORE_ADDR addr, CORE_ADDR pc) +{ + struct frame_info *fi; + char *name; + + fi = (struct frame_info *) + obstack_alloc (&frame_cache_obstack, + sizeof (struct frame_info)); + + /* Zero all fields by default. */ + memset (fi, 0, sizeof (struct frame_info)); + + fi->frame = addr; + fi->pc = pc; + find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); + fi->signal_handler_caller = PC_IN_SIGTRAMP (fi->pc, name); + + if (INIT_EXTRA_FRAME_INFO_P ()) + INIT_EXTRA_FRAME_INFO (0, fi); + + /* Select/initialize an unwind function. */ + set_unwind_by_pc (fi->pc, fi->frame, &fi->register_unwind); + + return fi; +} + +/* Return the frame that FRAME calls (NULL if FRAME is the innermost + frame). */ + +struct frame_info * +get_next_frame (struct frame_info *frame) +{ + return frame->next; +} + +/* Flush the entire frame cache. */ + +void +flush_cached_frames (void) +{ + /* Since we can't really be sure what the first object allocated was */ + obstack_free (&frame_cache_obstack, 0); + obstack_init (&frame_cache_obstack); + + current_frame = NULL; /* Invalidate cache */ + select_frame (NULL); + annotate_frames_invalid (); +} + +/* Flush the frame cache, and start a new one if necessary. */ + +void +reinit_frame_cache (void) +{ + flush_cached_frames (); + + /* FIXME: The inferior_ptid test is wrong if there is a corefile. */ + if (PIDGET (inferior_ptid) != 0) + { + select_frame (get_current_frame ()); + } +} + +/* Return a structure containing various interesting information + about the frame that called NEXT_FRAME. Returns NULL + if there is no such frame. */ + +struct frame_info * +get_prev_frame (struct frame_info *next_frame) +{ + CORE_ADDR address = 0; + struct frame_info *prev; + int fromleaf; + char *name; + + /* Return the inner-most frame, when the caller passes in NULL. */ + /* NOTE: cagney/2002-11-09: Not sure how this would happen. The + caller should have previously obtained a valid frame using + get_selected_frame() and then called this code - only possibility + I can think of is code behaving badly. */ + if (next_frame == NULL) + { + /* NOTE: cagney/2002-11-09: There was a code segment here that + would error out when CURRENT_FRAME was NULL. The comment + that went with it made the claim ... + + ``This screws value_of_variable, which just wants a nice + clean NULL return from block_innermost_frame if there are no + frames. I don't think I've ever seen this message happen + otherwise. And returning NULL here is a perfectly legitimate + thing to do.'' + + Per the above, this code shouldn't even be called with a NULL + NEXT_FRAME. */ + return current_frame; + } + + /* Only try to do the unwind once. */ + if (next_frame->prev_p) + return next_frame->prev; + next_frame->prev_p = 1; + + /* On some machines it is possible to call a function without + setting up a stack frame for it. On these machines, we + define this macro to take two args; a frameinfo pointer + identifying a frame and a variable to set or clear if it is + or isn't leafless. */ + + /* Still don't want to worry about this except on the innermost + frame. This macro will set FROMLEAF if NEXT_FRAME is a frameless + function invocation. */ + if (next_frame->next == NULL) + /* FIXME: 2002-11-09: Frameless functions can occure anywhere in + the frame chain, not just the inner most frame! The generic, + per-architecture, frame code should handle this and the below + should simply be removed. */ + fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame); + else + fromleaf = 0; + + if (fromleaf) + /* A frameless inner-most frame. The `FP' (which isn't an + architecture frame-pointer register!) of the caller is the same + as the callee. */ + /* FIXME: 2002-11-09: There isn't any reason to special case this + edge condition. Instead the per-architecture code should hande + it locally. */ + address = FRAME_FP (next_frame); + else + { + /* Two macros defined in tm.h specify the machine-dependent + actions to be performed here. + + First, get the frame's chain-pointer. + + If that is zero, the frame is the outermost frame or a leaf + called by the outermost frame. This means that if start + calls main without a frame, we'll return 0 (which is fine + anyway). + + Nope; there's a problem. This also returns when the current + routine is a leaf of main. This is unacceptable. We move + this to after the ffi test; I'd rather have backtraces from + start go curfluy than have an abort called from main not show + main. */ + address = FRAME_CHAIN (next_frame); + + /* FIXME: cagney/2002-06-08: There should be two tests here. + The first would check for a valid frame chain based on a user + selectable policy. The default being ``stop at main'' (as + implemented by generic_func_frame_chain_valid()). Other + policies would be available - stop at NULL, .... The second + test, if provided by the target architecture, would check for + more exotic cases - most target architectures wouldn't bother + with this second case. */ + if (!FRAME_CHAIN_VALID (address, next_frame)) + return 0; + } + if (address == 0) + return 0; + + /* Create an initially zero previous frame. */ + prev = (struct frame_info *) + obstack_alloc (&frame_cache_obstack, + sizeof (struct frame_info)); + memset (prev, 0, sizeof (struct frame_info)); + + /* Link it in. */ + next_frame->prev = prev; + prev->next = next_frame; + prev->frame = address; + prev->level = next_frame->level + 1; + + /* This change should not be needed, FIXME! We should determine + whether any targets *need* INIT_FRAME_PC to happen after + INIT_EXTRA_FRAME_INFO and come up with a simple way to express + what goes on here. + + INIT_EXTRA_FRAME_INFO is called from two places: create_new_frame + (where the PC is already set up) and here (where it isn't). + INIT_FRAME_PC is only called from here, always after + INIT_EXTRA_FRAME_INFO. + + The catch is the MIPS, where INIT_EXTRA_FRAME_INFO requires the + PC value (which hasn't been set yet). Some other machines appear + to require INIT_EXTRA_FRAME_INFO before they can do + INIT_FRAME_PC. Phoo. + + We shouldn't need INIT_FRAME_PC_FIRST to add more complication to + an already overcomplicated part of GDB. gnu@cygnus.com, 15Sep92. + + Assuming that some machines need INIT_FRAME_PC after + INIT_EXTRA_FRAME_INFO, one possible scheme: + + SETUP_INNERMOST_FRAME(): Default version is just create_new_frame + (read_fp ()), read_pc ()). Machines with extra frame info would + do that (or the local equivalent) and then set the extra fields. + + SETUP_ARBITRARY_FRAME(argc, argv): Only change here is that + create_new_frame would no longer init extra frame info; + SETUP_ARBITRARY_FRAME would have to do that. + + INIT_PREV_FRAME(fromleaf, prev) Replace INIT_EXTRA_FRAME_INFO and + INIT_FRAME_PC. This should also return a flag saying whether to + keep the new frame, or whether to discard it, because on some + machines (e.g. mips) it is really awkward to have + FRAME_CHAIN_VALID called *before* INIT_EXTRA_FRAME_INFO (there is + no good way to get information deduced in FRAME_CHAIN_VALID into + the extra fields of the new frame). std_frame_pc(fromleaf, prev) + + This is the default setting for INIT_PREV_FRAME. It just does + what the default INIT_FRAME_PC does. Some machines will call it + from INIT_PREV_FRAME (either at the beginning, the end, or in the + middle). Some machines won't use it. + + kingdon@cygnus.com, 13Apr93, 31Jan94, 14Dec94. */ + + /* NOTE: cagney/2002-11-09: Just ignore the above! There is no + reason for things to be this complicated. + + The trick is to assume that there is always a frame. Instead of + special casing the inner-most frame, create fake frame + (containing the hardware registers) that is inner to the + user-visible inner-most frame (...) and then unwind from that. + That way architecture code can use use the standard + frame_XX_unwind() functions and not differentiate between the + inner most and any other case. + + Since there is always a frame to unwind from, there is always + somewhere (NEXT_FRAME) to store all the info needed to construct + a new (previous) frame without having to first create it. This + means that the convolution below - needing to carefully order a + frame's initialization - isn't needed. + + The irony here though, is that FRAME_CHAIN(), at least for a more + up-to-date architecture, always calls FRAME_SAVED_PC(), and + FRAME_SAVED_PC() computes the PC but without first needing the + frame! Instead of the convolution below, we could have simply + called FRAME_SAVED_PC() and been done with it! Note that + FRAME_SAVED_PC() is being superseed by frame_pc_unwind() and that + function does have somewhere to cache that PC value. */ + + INIT_FRAME_PC_FIRST (fromleaf, prev); + + if (INIT_EXTRA_FRAME_INFO_P ()) + INIT_EXTRA_FRAME_INFO (fromleaf, prev); + + /* This entry is in the frame queue now, which is good since + FRAME_SAVED_PC may use that queue to figure out its value (see + tm-sparc.h). We want the pc saved in the inferior frame. */ + INIT_FRAME_PC (fromleaf, prev); + + /* If ->frame and ->pc are unchanged, we are in the process of + getting ourselves into an infinite backtrace. Some architectures + check this in FRAME_CHAIN or thereabouts, but it seems like there + is no reason this can't be an architecture-independent check. */ + if (prev->frame == next_frame->frame + && prev->pc == next_frame->pc) + { + next_frame->prev = NULL; + obstack_free (&frame_cache_obstack, prev); + return NULL; + } + + /* Initialize the code used to unwind the frame PREV based on the PC + (and probably other architectural information). The PC lets you + check things like the debug info at that point (dwarf2cfi?) and + use that to decide how the frame should be unwound. */ + set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind); + + find_pc_partial_function (prev->pc, &name, + (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); + if (PC_IN_SIGTRAMP (prev->pc, name)) + prev->signal_handler_caller = 1; + + return prev; +} + +CORE_ADDR +get_frame_pc (struct frame_info *frame) +{ + return frame->pc; +} + +#ifdef FRAME_FIND_SAVED_REGS +/* XXX - deprecated. This is a compatibility function for targets + that do not yet implement FRAME_INIT_SAVED_REGS. */ +/* Find the addresses in which registers are saved in FRAME. */ + +void +get_frame_saved_regs (struct frame_info *frame, + struct frame_saved_regs *saved_regs_addr) +{ + if (frame->saved_regs == NULL) + { + frame->saved_regs = (CORE_ADDR *) + frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); + } + if (saved_regs_addr == NULL) + { + struct frame_saved_regs saved_regs; + FRAME_FIND_SAVED_REGS (frame, saved_regs); + memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS); + } + else + { + FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); + memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS); + } +} +#endif + +void +_initialize_frame (void) +{ + obstack_init (&frame_cache_obstack); +} diff --git a/gdb/frame.h b/gdb/frame.h index 849566b..70d85f1 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -23,6 +23,123 @@ #if !defined (FRAME_H) #define FRAME_H 1 +/* The frame object. */ + +struct frame_info; + +/* The frame object's ID. This provides a per-frame unique identifier + that can be used to relocate a `struct frame_info' after a target + resume or a frame cache destruct (assuming the target hasn't + unwound the stack past that frame - a problem handled elsewhere). */ + +struct frame_id +{ + /* The frame's address. This should be constant through out the + lifetime of a frame. */ + /* NOTE: cagney/2002-11-16: The ia64 has two stacks and hence two + frame bases. This will need to be expanded to accomodate that. */ + CORE_ADDR base; + /* The frame's current PC. While the PC within the function may + change, the function that contains the PC does not. Should this + instead be the frame's function? */ + CORE_ADDR pc; +}; + +/* For every stopped thread, GDB tracks two frames: current and + selected. Current frame is the inner most frame of the selected + thread. Selected frame is the frame currently being examined via + the GDB CLI (selected using `up', `down', ...). The frames are + created on-demand (via get_prev_frame()) and then held in a frame + cache. Provide mechanims for controlling these frames. */ +/* FIXME: cagney/2002-11-14: At any time, only one thread's selected + and current frame can be active. Switching threads causes gdb to + discard all that cached frame information. Ulgh! Instead, current + and selected frame should be bound to a thread. */ + +extern struct frame_info *selected_frame; +extern void select_frame (struct frame_info *); +extern void set_current_frame (struct frame_info *); +extern struct frame_info *get_current_frame (void); + +/* Invalidates the frame cache. */ +extern void flush_cached_frames (void); + +/* Flushes the frame cache and then selects the inner most (aka + current) frame - it changes selected frame. */ +/* FIXME: cagney/2002-11-14: Should this re-select the selected frame + from before the flush? */ +extern void reinit_frame_cache (void); + +/* Given a FRAME, return the next (more inner, younger) or previous + (more outer, older) frame. */ +extern struct frame_info *get_prev_frame (struct frame_info *); +extern struct frame_info *get_next_frame (struct frame_info *); + +/* Given a frame's ID, relocate the frame. Returns NULL if the frame + is not found. */ +extern struct frame_info *frame_find_by_id (struct frame_id id); + +/* Base attributes of a frame: */ + +/* The frame's `resume' address. Where the program will resume in + this frame. */ +extern CORE_ADDR get_frame_pc (struct frame_info *); + +/* Return the per-frame unique identifer. Can be used to relocate a + frame after a frame cache flush (and other similar operations). */ +extern void get_frame_id (struct frame_info *fi, struct frame_id *id); + +/* The frame's level: 0 for innermost, 1 for its caller, ...; or -1 + for an invalid frame). */ +extern int frame_relative_level (struct frame_info *fi); + +/* Unwind the stack frame so that the value of REGNUM, in the previous + (up, older) frame is returned. If VALUEP is NULL, don't + fetch/compute the value. Instead just return the location of the + value. */ +extern void frame_register_unwind (struct frame_info *frame, int regnum, + int *optimizedp, enum lval_type *lvalp, + CORE_ADDR *addrp, int *realnump, + void *valuep); + +/* More convenient interface to frame_register_unwind(). */ +/* NOTE: cagney/2002-09-13: Return void as one day these functions may + be changed to return an indication that the read succeeded. */ + +extern void frame_unwind_signed_register (struct frame_info *frame, + int regnum, LONGEST *val); + +extern void frame_unwind_unsigned_register (struct frame_info *frame, + int regnum, ULONGEST *val); + +/* Get the value of the register that belongs to this FRAME. This + function is a wrapper to the call sequence ``frame_unwind_register + (get_next_frame (FRAME))''. As per frame_register_unwind(), if + VALUEP is NULL, the registers value is not fetched/computed. */ + +extern void frame_register (struct frame_info *frame, int regnum, + int *optimizedp, enum lval_type *lvalp, + 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. */ + +extern void frame_read_signed_register (struct frame_info *frame, + int regnum, LONGEST *val); + +extern void frame_read_unsigned_register (struct frame_info *frame, + int regnum, ULONGEST *val); + +/* Map between a frame register number and its name. A frame register + space is a superset of the cooked register space --- it also + includes builtin registers. */ + +extern int frame_map_name_to_regnum (const char *name, int strlen); +extern const char *frame_map_regnum_to_name (int regnum); + + /* Return the location (and possibly value) of REGNUM for the previous (older, up) frame. All parameters except VALUEP can be assumed to be non NULL. When VALUEP is NULL, just the location of the @@ -140,10 +257,11 @@ struct frame_info frame_register_unwind_ftype *register_unwind; void *register_unwind_cache; - /* Pointers to the next (down, inner) and previous (up, outer) - frame_info's in the frame cache. */ - struct frame_info *next; /* down, inner */ - struct frame_info *prev; /* up, outer */ + /* Pointers to the next (down, inner, younger) and previous (up, + outer, older) frame_info's in the frame cache. */ + struct frame_info *next; /* down, inner, younger */ + int prev_p; + struct frame_info *prev; /* up, outer, older */ }; /* Values for the source flag to be used in print_frame_info_base(). */ @@ -188,11 +306,6 @@ extern void frame_saved_regs_zalloc (struct frame_info *); #define FRAME_FP(fi) ((fi)->frame) -/* Level of the frame: 0 for innermost, 1 for its caller, ...; or -1 - for an invalid frame. */ - -extern int frame_relative_level (struct frame_info *fi); - /* Define a default FRAME_CHAIN_VALID, in the form that is suitable for most targets. If FRAME_CHAIN_VALID returns zero it means that the given frame is the outermost one and has no caller. @@ -208,21 +321,8 @@ extern int generic_file_frame_chain_valid (CORE_ADDR, struct frame_info *); extern int generic_func_frame_chain_valid (CORE_ADDR, struct frame_info *); extern void generic_save_dummy_frame_tos (CORE_ADDR sp); -/* The stack frame that the user has specified for commands to act on. - Note that one cannot assume this is the address of valid data. */ - -extern struct frame_info *selected_frame; - -/* Level of the selected frame: - 0 for innermost, 1 for its caller, ... - or -1 for frame specified by address with no defined level. */ - extern struct frame_info *create_new_frame (CORE_ADDR, CORE_ADDR); -extern void flush_cached_frames (void); - -extern void reinit_frame_cache (void); - #ifdef FRAME_FIND_SAVED_REGS /* XXX - deprecated */ @@ -231,14 +331,6 @@ extern void get_frame_saved_regs (struct frame_info *, struct frame_saved_regs *); #endif -extern void set_current_frame (struct frame_info *); - -extern struct frame_info *get_prev_frame (struct frame_info *); - -extern struct frame_info *get_current_frame (void); - -extern struct frame_info *get_next_frame (struct frame_info *); - extern struct block *get_frame_block (struct frame_info *, CORE_ADDR *addr_in_block); @@ -248,8 +340,6 @@ extern struct block *get_selected_block (CORE_ADDR *addr_in_block); extern struct symbol *get_frame_function (struct frame_info *); -extern CORE_ADDR get_frame_pc (struct frame_info *); - extern CORE_ADDR frame_address_in_block (struct frame_info *); extern CORE_ADDR get_pc_function_start (CORE_ADDR); @@ -274,24 +364,6 @@ extern void print_only_stack_frame (struct frame_info *, int, int); extern void show_stack_frame (struct frame_info *); -extern void select_frame (struct frame_info *); - -/* Return an ID that can be used to re-find a frame. */ - -struct frame_id -{ - /* The frame's address. This should be constant through out the - lifetime of a frame. */ - CORE_ADDR base; - /* The frame's current PC. While this changes, the function that - the PC falls into, does not. */ - CORE_ADDR pc; -}; - -extern void get_frame_id (struct frame_info *fi, struct frame_id *id); - -extern struct frame_info *frame_find_by_id (struct frame_id id); - extern void print_frame_info (struct frame_info *, int, int, int); extern void show_frame_info (struct frame_info *, int, int, int); @@ -325,9 +397,14 @@ extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p); -extern void generic_get_saved_register (char *, int *, CORE_ADDR *, - struct frame_info *, int, - enum lval_type *); +/* The function generic_get_saved_register() has been made obsolete. + GET_SAVED_REGISTER now defaults to the recursive equivalent - + generic_unwind_get_saved_register() - so there is no need to even + set GET_SAVED_REGISTER. Architectures that need to override the + register unwind mechanism should modify frame->unwind(). */ +extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *, + struct frame_info *, int, + enum lval_type *); extern void generic_unwind_get_saved_register (char *raw_buffer, int *optimized, @@ -336,24 +413,6 @@ extern void generic_unwind_get_saved_register (char *raw_buffer, int regnum, enum lval_type *lval); -/* Unwind the stack frame so that the value of REGNUM, in the previous - frame is returned. If VALUEP is NULL, don't fetch/compute the - value. Instead just return the location of the value. */ - -extern void frame_register_unwind (struct frame_info *frame, int regnum, - int *optimizedp, enum lval_type *lvalp, - CORE_ADDR *addrp, int *realnump, - void *valuep); - -/* Unwind FRAME so that the value of register REGNUM, in the previous - frame is returned. Simplified versions of frame_register_unwind. */ -/* NOTE: cagney/2002-09-13: Return void as one day these functions may - be changed to return an indication that the read succeeded. */ -extern void frame_unwind_signed_register (struct frame_info *frame, - int regnum, LONGEST *val); -extern void frame_unwind_unsigned_register (struct frame_info *frame, - int regnum, ULONGEST *val); - extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); extern void get_saved_register (char *raw_buffer, int *optimized, @@ -361,18 +420,9 @@ extern void get_saved_register (char *raw_buffer, int *optimized, struct frame_info *frame, int regnum, enum lval_type *lval); -/* Return the register as found on the FRAME. Return zero if the - register could not be found. */ extern int frame_register_read (struct frame_info *frame, int regnum, void *buf); -/* Map between a frame register number and its name. A frame register - space is a superset of the cooked register space --- it also - includes builtin registers. */ - -extern int frame_map_name_to_regnum (const char *name, int strlen); -extern const char *frame_map_regnum_to_name (int regnum); - /* From stack.c. */ extern void args_info (char *, int); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 933faa1..48576cb 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -904,9 +904,10 @@ frv_store_return_value (struct type *type, char *valbuf) int reg8_offset = frv_register_byte (8); if (length <= 4) - write_register_bytes (reg8_offset + (4 - length), valbuf, length); + deprecated_write_register_bytes (reg8_offset + (4 - length), valbuf, + length); else if (length == 8) - write_register_bytes (reg8_offset, valbuf, length); + deprecated_write_register_bytes (reg8_offset, valbuf, length); else internal_error (__FILE__, __LINE__, "Don't know how to return a %d-byte value.", length); diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h index 8088da0..c47c424 100644 --- a/gdb/gdb_thread_db.h +++ b/gdb/gdb_thread_db.h @@ -63,7 +63,8 @@ typedef enum TD_NOTSD, /* No thread-specific data available. */ TD_MALLOC, /* Out of memory. */ TD_PARTIALREG, /* Not entire register set was read or written. */ - TD_NOXREGS /* X register set not available for given thread. */ + TD_NOXREGS, /* X register set not available for given thread. */ + TD_NOTALLOC /* TLS memory not yet allocated. */ } td_err_e; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 901c47e..468726d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -64,6 +64,7 @@ #include "gdb_assert.h" #include "gdb_string.h" #include "gdb-events.h" +#include "reggroups.h" /* Static function declarations */ @@ -171,7 +172,7 @@ struct gdbarch gdbarch_register_virtual_size_ftype *register_virtual_size; int max_register_virtual_size; gdbarch_register_virtual_type_ftype *register_virtual_type; - gdbarch_do_registers_info_ftype *do_registers_info; + gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info; gdbarch_print_registers_info_ftype *print_registers_info; gdbarch_print_float_info_ftype *print_float_info; gdbarch_print_vector_info_ftype *print_vector_info; @@ -274,6 +275,7 @@ struct gdbarch gdbarch_address_class_type_flags_ftype *address_class_type_flags; gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name; gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags; + gdbarch_register_reggroup_p_ftype *register_reggroup_p; }; @@ -437,6 +439,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + default_register_reggroup_p, /* startup_gdbarch() */ }; @@ -531,7 +534,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->init_frame_pc_first = init_frame_pc_noop; current_gdbarch->init_frame_pc = init_frame_pc_default; current_gdbarch->coerce_float_to_double = default_coerce_float_to_double; - current_gdbarch->get_saved_register = generic_unwind_get_saved_register; current_gdbarch->register_convertible = generic_register_convertible_not; current_gdbarch->convert_register_p = legacy_convert_register_p; current_gdbarch->register_to_value = legacy_register_to_value; @@ -568,6 +570,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->elf_make_msymbol_special = default_elf_make_msymbol_special; current_gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; current_gdbarch->name_of_malloc = "malloc"; + current_gdbarch->register_reggroup_p = default_register_reggroup_p; /* gdbarch_alloc() */ return current_gdbarch; @@ -664,7 +667,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->register_virtual_type == 0)) fprintf_unfiltered (log, "\n\tregister_virtual_type"); - /* Skip verify of do_registers_info, has predicate */ + /* Skip verify of deprecated_do_registers_info, has predicate */ /* Skip verify of print_registers_info, invalid_p == 0 */ /* Skip verify of print_float_info, has predicate */ /* Skip verify of print_vector_info, has predicate */ @@ -714,7 +717,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of init_frame_pc_first, invalid_p == 0 */ /* Skip verify of init_frame_pc, invalid_p == 0 */ /* Skip verify of coerce_float_to_double, invalid_p == 0 */ - /* Skip verify of get_saved_register, invalid_p == 0 */ + /* Skip verify of get_saved_register, has predicate */ /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ @@ -819,6 +822,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_class_type_flags, has predicate */ /* Skip verify of address_class_type_flags_to_name, has predicate */ /* Skip verify of address_class_name_to_type_flags, has predicate */ + /* Skip verify of register_reggroup_p, invalid_p == 0 */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -853,6 +857,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->in_function_epilogue_p); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, + "gdbarch_dump: register_reggroup_p = 0x%08lx\n", + (long) current_gdbarch->register_reggroup_p); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, "gdbarch_dump: pseudo_register_read = 0x%08lx\n", (long) current_gdbarch->pseudo_register_read); if (GDB_MULTI_ARCH) @@ -1105,6 +1113,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n", (long) DECR_PC_AFTER_BREAK); #endif +#ifdef DEPRECATED_DO_REGISTERS_INFO +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DO_REGISTERS_INFO(reg_nr, fpregs)", + XSTRING (DEPRECATED_DO_REGISTERS_INFO (reg_nr, fpregs))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_DO_REGISTERS_INFO = 0x%08lx\n", + (long) current_gdbarch->deprecated_do_registers_info + /*DEPRECATED_DO_REGISTERS_INFO ()*/); +#endif #ifdef DEPRECATED_EXTRACT_RETURN_VALUE #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1144,20 +1166,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_store_return_value /*DEPRECATED_STORE_RETURN_VALUE ()*/); #endif -#ifdef DO_REGISTERS_INFO -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "DO_REGISTERS_INFO(reg_nr, fpregs)", - XSTRING (DO_REGISTERS_INFO (reg_nr, fpregs))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: DO_REGISTERS_INFO = 0x%08lx\n", - (long) current_gdbarch->do_registers_info - /*DO_REGISTERS_INFO ()*/); -#endif #ifdef DWARF2_BUILD_FRAME_INFO #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -3113,29 +3121,29 @@ set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, } int -gdbarch_do_registers_info_p (struct gdbarch *gdbarch) +gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->do_registers_info != 0; + return gdbarch->deprecated_do_registers_info != 0; } void -gdbarch_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs) +gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs) { gdb_assert (gdbarch != NULL); - if (gdbarch->do_registers_info == 0) + if (gdbarch->deprecated_do_registers_info == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_do_registers_info invalid"); + "gdbarch: gdbarch_deprecated_do_registers_info invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_do_registers_info called\n"); - gdbarch->do_registers_info (reg_nr, fpregs); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_do_registers_info called\n"); + gdbarch->deprecated_do_registers_info (reg_nr, fpregs); } void -set_gdbarch_do_registers_info (struct gdbarch *gdbarch, - gdbarch_do_registers_info_ftype do_registers_info) +set_gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, + gdbarch_deprecated_do_registers_info_ftype deprecated_do_registers_info) { - gdbarch->do_registers_info = do_registers_info; + gdbarch->deprecated_do_registers_info = deprecated_do_registers_info; } void @@ -3669,6 +3677,13 @@ set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch->coerce_float_to_double = coerce_float_to_double; } +int +gdbarch_get_saved_register_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->get_saved_register != 0; +} + void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) { @@ -5186,6 +5201,25 @@ set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags; } +int +gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->register_reggroup_p == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_register_reggroup_p invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_register_reggroup_p called\n"); + return gdbarch->register_reggroup_p (gdbarch, regnum, reggroup); +} + +void +set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, + gdbarch_register_reggroup_p_ftype register_reggroup_p) +{ + gdbarch->register_reggroup_p = register_reggroup_p; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 994ae82..a2fa465 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -47,6 +47,7 @@ struct value; struct objfile; struct minimal_symbol; struct regcache; +struct reggroup; extern struct gdbarch *current_gdbarch; @@ -778,40 +779,40 @@ extern void set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch_ #endif #endif -#if defined (DO_REGISTERS_INFO) -/* Legacy for systems yet to multi-arch DO_REGISTERS_INFO */ -#if !defined (DO_REGISTERS_INFO_P) -#define DO_REGISTERS_INFO_P() (1) +#if defined (DEPRECATED_DO_REGISTERS_INFO) +/* Legacy for systems yet to multi-arch DEPRECATED_DO_REGISTERS_INFO */ +#if !defined (DEPRECATED_DO_REGISTERS_INFO_P) +#define DEPRECATED_DO_REGISTERS_INFO_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (DO_REGISTERS_INFO_P) -#define DO_REGISTERS_INFO_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DO_REGISTERS_INFO_P) +#define DEPRECATED_DO_REGISTERS_INFO_P() (0) #endif -extern int gdbarch_do_registers_info_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DO_REGISTERS_INFO_P) -#error "Non multi-arch definition of DO_REGISTERS_INFO" +extern int gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DO_REGISTERS_INFO_P) +#error "Non multi-arch definition of DEPRECATED_DO_REGISTERS_INFO" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DO_REGISTERS_INFO_P) -#define DO_REGISTERS_INFO_P() (gdbarch_do_registers_info_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DO_REGISTERS_INFO_P) +#define DEPRECATED_DO_REGISTERS_INFO_P() (gdbarch_deprecated_do_registers_info_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (DO_REGISTERS_INFO) -#define DO_REGISTERS_INFO(reg_nr, fpregs) (internal_error (__FILE__, __LINE__, "DO_REGISTERS_INFO"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DO_REGISTERS_INFO) +#define DEPRECATED_DO_REGISTERS_INFO(reg_nr, fpregs) (internal_error (__FILE__, __LINE__, "DEPRECATED_DO_REGISTERS_INFO"), 0) #endif -typedef void (gdbarch_do_registers_info_ftype) (int reg_nr, int fpregs); -extern void gdbarch_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs); -extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_registers_info_ftype *do_registers_info); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DO_REGISTERS_INFO) -#error "Non multi-arch definition of DO_REGISTERS_INFO" +typedef void (gdbarch_deprecated_do_registers_info_ftype) (int reg_nr, int fpregs); +extern void gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs); +extern void set_gdbarch_deprecated_do_registers_info (struct gdbarch *gdbarch, gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DO_REGISTERS_INFO) +#error "Non multi-arch definition of DEPRECATED_DO_REGISTERS_INFO" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DO_REGISTERS_INFO) -#define DO_REGISTERS_INFO(reg_nr, fpregs) (gdbarch_do_registers_info (current_gdbarch, reg_nr, fpregs)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DO_REGISTERS_INFO) +#define DEPRECATED_DO_REGISTERS_INFO(reg_nr, fpregs) (gdbarch_deprecated_do_registers_info (current_gdbarch, reg_nr, fpregs)) #endif #endif @@ -1209,9 +1210,29 @@ extern void set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch #endif #endif +#if defined (GET_SAVED_REGISTER) +/* Legacy for systems yet to multi-arch GET_SAVED_REGISTER */ +#if !defined (GET_SAVED_REGISTER_P) +#define GET_SAVED_REGISTER_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER_P) +#define GET_SAVED_REGISTER_P() (0) +#endif + +extern int gdbarch_get_saved_register_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER_P) +#error "Non multi-arch definition of GET_SAVED_REGISTER" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER_P) +#define GET_SAVED_REGISTER_P() (gdbarch_get_saved_register_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER) -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)) +#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (internal_error (__FILE__, __LINE__, "GET_SAVED_REGISTER"), 0) #endif typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); @@ -2660,6 +2681,12 @@ typedef int (gdbarch_address_class_name_to_type_flags_ftype) (struct gdbarch *gd extern int gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, char *name, int *type_flags_ptr); extern void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags); +/* Is a register in a group */ + +typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); +extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); +extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 6c9ac04..f7f9a66 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -468,7 +468,7 @@ f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_r v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 # -F:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs +F:2:DEPRECATED_DO_REGISTERS_INFO:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs m:2:PRINT_REGISTERS_INFO:void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0 M:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args M:2:PRINT_VECTOR_INFO:void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args @@ -508,7 +508,7 @@ f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:froml v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double::0 -f:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval:::generic_unwind_get_saved_register::0 +F:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval # f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 @@ -667,6 +667,8 @@ v::HAVE_NONSTEPPABLE_WATCHPOINT:int:have_nonsteppable_watchpoint::::0:0::0 F:2:ADDRESS_CLASS_TYPE_FLAGS:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class M:2:ADDRESS_CLASS_TYPE_FLAGS_TO_NAME:char *:address_class_type_flags_to_name:int type_flags:type_flags: M:2:ADDRESS_CLASS_NAME_TO_TYPE_FLAGS:int:address_class_name_to_type_flags: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 EOF } @@ -778,6 +780,7 @@ struct value; struct objfile; struct minimal_symbol; struct regcache; +struct reggroup; extern struct gdbarch *current_gdbarch; @@ -1253,6 +1256,7 @@ cat <<EOF #include "gdb_assert.h" #include "gdb_string.h" #include "gdb-events.h" +#include "reggroups.h" /* Static function declarations */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index a43987d..c9cae4c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1341,7 +1341,7 @@ get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp) This used to be coded as a macro, but I don't think it is called often enough to merit such treatment. */ -struct complaint stub_noname_complaint = +struct deprecated_complaint stub_noname_complaint = {"stub type has NULL name", 0, 0}; struct type * @@ -1512,7 +1512,7 @@ add_mangled_type (struct extra *pextras, struct type *t) default: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Bad int type code length x%x\n", 0, 0}; complain (&msg, tlen); @@ -1534,7 +1534,7 @@ add_mangled_type (struct extra *pextras, struct type *t) break; default: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Bad float type code length x%x\n", 0, 0}; complain (&msg, tlen); } @@ -1550,7 +1550,7 @@ add_mangled_type (struct extra *pextras, struct type *t) break; case TYPE_CODE_TYPEDEF: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Typedefs in overloaded functions not yet supported\n", 0, 0}; complain (&msg); } @@ -1590,7 +1590,7 @@ add_mangled_type (struct extra *pextras, struct type *t) case TYPE_CODE_ERROR: default: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Unknown type code x%x\n", 0, 0}; complain (&msg, tcode); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index d4d9afe..fe4b0f1 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -397,22 +397,25 @@ struct main_type CORE_ADDR physaddr; char *physname; - - /* For a function or member type, this is 1 if the argument is marked - artificial. Artificial arguments should not be shown to the - user. */ - int artificial; } loc; + /* For a function or member type, this is 1 if the argument is marked + artificial. Artificial arguments should not be shown to the + user. */ + unsigned int artificial : 1; + + /* This flag is zero for non-static fields, 1 for fields whose location + is specified by the label loc.physname, and 2 for fields whose location + is specified by loc.physaddr. */ + + unsigned int static_kind : 2; + /* Size of this field, in bits, or zero if not packed. For an unpacked field, the field's type's length - says how many bytes the field occupies. - A value of -1 or -2 indicates a static field; -1 means the location - is specified by the label loc.physname; -2 means that loc.physaddr - specifies the actual address. */ + says how many bytes the field occupies. */ - int bitsize; + unsigned int bitsize : 29; /* In a struct or union type, type of this field. In a function or member type, type of this argument. @@ -809,14 +812,15 @@ extern void allocate_cplus_struct_type (struct type *); #define FIELD_TYPE(thisfld) ((thisfld).type) #define FIELD_NAME(thisfld) ((thisfld).name) #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) -#define FIELD_ARTIFICIAL(thisfld) ((thisfld).loc.artificial) +#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial) #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) +#define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind) #define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname) #define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define SET_FIELD_PHYSNAME(thisfld, name) \ - ((thisfld).bitsize = -1, FIELD_PHYSNAME(thisfld) = (name)) + ((thisfld).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name)) #define SET_FIELD_PHYSADDR(thisfld, name) \ - ((thisfld).bitsize = -2, FIELD_PHYSADDR(thisfld) = (name)) + ((thisfld).static_kind = 2, FIELD_PHYSADDR(thisfld) = (name)) #define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n] #define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n)) @@ -856,8 +860,9 @@ extern void allocate_cplus_struct_type (struct type *); (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \ : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))) -#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize < 0) -#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize == -2) +#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0) +#define TYPE_FIELD_STATIC_KIND(thistype, n) TYPE_MAIN_TYPE (thistype)->fields[n].static_kind +#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind == 2) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n)) diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index e332dba..8be456f 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2592,21 +2592,15 @@ init_gnu_ops (void) gnu_ops.to_longname = "GNU Hurd process"; /* to_longname */ gnu_ops.to_doc = "GNU Hurd process"; /* to_doc */ gnu_ops.to_open = gnu_open; /* to_open */ - gnu_ops.to_close = 0; /* to_close */ gnu_ops.to_attach = gnu_attach; /* to_attach */ - gnu_ops.to_post_attach = NULL; - gnu_ops.to_require_attach = NULL; /* to_require_attach */ gnu_ops.to_detach = gnu_detach; /* to_detach */ - gnu_ops.to_require_detach = NULL; /* to_require_detach */ gnu_ops.to_resume = gnu_resume; /* to_resume */ gnu_ops.to_wait = gnu_wait; /* to_wait */ - gnu_ops.to_post_wait = NULL; /* to_post_wait */ gnu_ops.to_fetch_registers = gnu_fetch_registers; /* to_fetch_registers */ gnu_ops.to_store_registers = gnu_store_registers; /* to_store_registers */ gnu_ops.to_prepare_to_store = gnu_prepare_to_store; /* to_prepare_to_store */ gnu_ops.to_xfer_memory = gnu_xfer_memory; /* to_xfer_memory */ gnu_ops.to_find_memory_regions = gnu_find_memory_regions; - gnu_ops.to_files_info = 0; /* to_files_info */ gnu_ops.to_insert_breakpoint = memory_insert_breakpoint; gnu_ops.to_remove_breakpoint = memory_remove_breakpoint; gnu_ops.to_terminal_init = gnu_terminal_init_inferior; @@ -2616,45 +2610,19 @@ init_gnu_ops (void) gnu_ops.to_terminal_ours = terminal_ours; gnu_ops.to_terminal_info = child_terminal_info; gnu_ops.to_kill = gnu_kill_inferior; /* to_kill */ - gnu_ops.to_load = 0; /* to_load */ - gnu_ops.to_lookup_symbol = 0; /* to_lookup_symbol */ gnu_ops.to_create_inferior = gnu_create_inferior; /* to_create_inferior */ - gnu_ops.to_post_startup_inferior = NULL; /* to_post_startup_inferior */ - /* to_acknowledge_created_inferior */ - gnu_ops.to_acknowledge_created_inferior = NULL; - /* to_clone_and_follow_inferior */ - gnu_ops.to_clone_and_follow_inferior = NULL; - /* to_post_follow_inferior_by_clone */ - gnu_ops.to_post_follow_inferior_by_clone = NULL; - gnu_ops.to_insert_fork_catchpoint = NULL; - gnu_ops.to_remove_fork_catchpoint = NULL; - gnu_ops.to_insert_vfork_catchpoint = NULL; - gnu_ops.to_remove_vfork_catchpoint = NULL; - gnu_ops.to_has_forked = NULL; /* to_has_forked */ - gnu_ops.to_has_vforked = NULL; /* to_has_vforked */ - gnu_ops.to_can_follow_vfork_prior_to_exec = NULL; - gnu_ops.to_post_follow_vfork = NULL; /* to_post_follow_vfork */ - gnu_ops.to_insert_exec_catchpoint = NULL; - gnu_ops.to_remove_exec_catchpoint = NULL; - gnu_ops.to_has_execd = NULL; - gnu_ops.to_reported_exec_events_per_exec_call = NULL; - gnu_ops.to_has_exited = NULL; gnu_ops.to_mourn_inferior = gnu_mourn_inferior; /* to_mourn_inferior */ gnu_ops.to_can_run = gnu_can_run; /* to_can_run */ - gnu_ops.to_notice_signals = 0; /* to_notice_signals */ gnu_ops.to_thread_alive = gnu_thread_alive; /* to_thread_alive */ gnu_ops.to_pid_to_str = gnu_pid_to_str; /* to_pid_to_str */ gnu_ops.to_stop = gnu_stop; /* to_stop */ gnu_ops.to_pid_to_exec_file = gnu_pid_to_exec_file; /* to_pid_to_exec_file */ gnu_ops.to_stratum = process_stratum; /* to_stratum */ - gnu_ops.DONT_USE = 0; /* to_next */ gnu_ops.to_has_all_memory = 1; /* to_has_all_memory */ gnu_ops.to_has_memory = 1; /* to_has_memory */ gnu_ops.to_has_stack = 1; /* to_has_stack */ gnu_ops.to_has_registers = 1; /* to_has_registers */ gnu_ops.to_has_execution = 1; /* to_has_execution */ - gnu_ops.to_sections = 0; /* sections */ - gnu_ops.to_sections_end = 0; /* sections_end */ gnu_ops.to_magic = OPS_MAGIC; /* to_magic */ } /* init_gnu_ops */ diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index a16b1b3..6ff2710 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -467,7 +467,7 @@ fetch_register (int regno) { if (regno < FP0_REGNUM) supply_register (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs); - else if (FP_REGNUM_P (regno) || FPC_REGNUM_P (regno)) + else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno)) i387_supply_register (regno, (char *) &npx); else internal_error (__FILE__, __LINE__, @@ -492,7 +492,7 @@ store_register (int regno) { if (regno < FP0_REGNUM) regcache_collect (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs); - else if (FP_REGNUM_P (regno) || FPC_REGNUM_P (regno)) + else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno)) i387_fill_fsave ((char *) &npx, regno); else internal_error (__FILE__, __LINE__, diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index affd8dd..0b0578c 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -34,6 +34,7 @@ #include "gdbcore.h" #include "objfiles.h" #include "gdbcmd.h" +#include "gdb_assert.h" /* Extra info which is saved in each frame_info. */ struct frame_extra_info @@ -864,28 +865,38 @@ h8300_register_name (int regno) } static void -h8300_print_register (int regno) +h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, + struct frame_info *frame, int regno) { - long val = read_register (regno); + ULONGEST rval; + long val; const char *name = h8300_register_name (regno); if (!name || !*name) return; - printf_filtered ("%-14s ", name); + /* FIXME: cagney/2002-10-22: The code below assumes that VAL is at + least 4 bytes (32 bits) in size and hence is large enough to hold + the largest h8300 register. Should instead be using ULONGEST and + the phex() functions. */ + gdb_assert (sizeof (val) >= 4); + frame_read_unsigned_register (frame, regno, &rval); + val = rval; + + fprintf_filtered (file, "%-14s ", name); if (h8300hmode) { if (val) - printf_filtered ("0x%08lx %-8ld", val, val); + fprintf_filtered (file, "0x%08lx %-8ld", val, val); else - printf_filtered ("0x%-8lx %-8ld", val, val); + fprintf_filtered (file, "0x%-8lx %-8ld", val, val); } else { if (val) - printf_filtered ("0x%04lx %-4ld", val, val); + fprintf_filtered (file, "0x%04lx %-4ld", val, val); else - printf_filtered ("0x%-4lx %-4ld", val, val); + fprintf_filtered (file, "0x%-4lx %-4ld", val, val); } if (regno == E_CCR_REGNUM) { @@ -895,39 +906,39 @@ h8300_print_register (int regno) unsigned char l; frame_register_read (selected_frame, regno, b); l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1]; - printf_unfiltered ("\t"); - printf_unfiltered ("I-%d ", (l & 0x80) != 0); - printf_unfiltered ("UI-%d ", (l & 0x40) != 0); - printf_unfiltered ("H-%d ", (l & 0x20) != 0); - printf_unfiltered ("U-%d ", (l & 0x10) != 0); + fprintf_filtered (file, "\t"); + fprintf_filtered (file, "I-%d ", (l & 0x80) != 0); + fprintf_filtered (file, "UI-%d ", (l & 0x40) != 0); + fprintf_filtered (file, "H-%d ", (l & 0x20) != 0); + fprintf_filtered (file, "U-%d ", (l & 0x10) != 0); N = (l & 0x8) != 0; Z = (l & 0x4) != 0; V = (l & 0x2) != 0; C = (l & 0x1) != 0; - printf_unfiltered ("N-%d ", N); - printf_unfiltered ("Z-%d ", Z); - printf_unfiltered ("V-%d ", V); - printf_unfiltered ("C-%d ", C); + fprintf_filtered (file, "N-%d ", N); + fprintf_filtered (file, "Z-%d ", Z); + fprintf_filtered (file, "V-%d ", V); + fprintf_filtered (file, "C-%d ", C); if ((C | Z) == 0) - printf_unfiltered ("u> "); + fprintf_filtered (file, "u> "); if ((C | Z) == 1) - printf_unfiltered ("u<= "); + fprintf_filtered (file, "u<= "); if ((C == 0)) - printf_unfiltered ("u>= "); + fprintf_filtered (file, "u>= "); if (C == 1) - printf_unfiltered ("u< "); + fprintf_filtered (file, "u< "); if (Z == 0) - printf_unfiltered ("!= "); + fprintf_filtered (file, "!= "); if (Z == 1) - printf_unfiltered ("== "); + fprintf_filtered (file, "== "); if ((N ^ V) == 0) - printf_unfiltered (">= "); + fprintf_filtered (file, ">= "); if ((N ^ V) == 1) - printf_unfiltered ("< "); + fprintf_filtered (file, "< "); if ((Z | (N ^ V)) == 0) - printf_unfiltered ("> "); + fprintf_filtered (file, "> "); if ((Z | (N ^ V)) == 1) - printf_unfiltered ("<= "); + fprintf_filtered (file, "<= "); } else if (regno == E_EXR_REGNUM && h8300smode) { @@ -936,23 +947,24 @@ h8300_print_register (int regno) unsigned char l; frame_register_read (selected_frame, regno, b); l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1]; - printf_unfiltered ("\t"); - printf_unfiltered ("T-%d - - - ", (l & 0x80) != 0); - printf_unfiltered ("I2-%d ", (l & 4) != 0); - printf_unfiltered ("I1-%d ", (l & 2) != 0); - printf_unfiltered ("I0-%d", (l & 1) != 0); + fprintf_filtered (file, "\t"); + fprintf_filtered (file, "T-%d - - - ", (l & 0x80) != 0); + fprintf_filtered (file, "I2-%d ", (l & 4) != 0); + fprintf_filtered (file, "I1-%d ", (l & 2) != 0); + fprintf_filtered (file, "I0-%d", (l & 1) != 0); } - printf_filtered ("\n"); + fprintf_filtered (file, "\n"); } static void -h8300_do_registers_info (int regno, int cpregs) +h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, + struct frame_info *frame, int regno, int cpregs) { if (regno < 0) for (regno = 0; regno < E_NUM_REGS; ++regno) - h8300_print_register (regno); + h8300_print_register (gdbarch, file, frame, regno); else - h8300_print_register (regno); + h8300_print_register (gdbarch, file, frame, regno); } static CORE_ADDR @@ -1085,7 +1097,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size); set_gdbarch_max_register_virtual_size (gdbarch, h8300h_reg_size); set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type); - set_gdbarch_do_registers_info (gdbarch, h8300_do_registers_info); + set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info); set_gdbarch_print_float_info (gdbarch, h8300_print_float_info); /* diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c index 0696c4e..0bfae7a 100644 --- a/gdb/h8500-tdep.c +++ b/gdb/h8500-tdep.c @@ -175,8 +175,8 @@ h8500_pop_frame (void) } } -void -print_register_hook (int regno) +static void +h8500_print_register_hook (int regno) { if (regno == CCR_REGNUM) { @@ -221,6 +221,117 @@ print_register_hook (int regno) } } +static void +h8500_print_registers_info (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame, + int regnum, int print_all) +{ + int i; + const int numregs = NUM_REGS + NUM_PSEUDO_REGS; + char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); + char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + + for (i = 0; i < numregs; i++) + { + /* Decide between printing all regs, non-float / vector regs, or + specific reg. */ + if (regnum == -1) + { + if (!print_all) + { + if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + continue; + if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) + continue; + } + } + else + { + if (i != regnum) + continue; + } + + /* If the register name is empty, it is undefined for this + processor, so don't display anything. */ + if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') + continue; + + fputs_filtered (REGISTER_NAME (i), file); + print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); + + /* Get the data in raw format. */ + if (! frame_register_read (frame, i, raw_buffer)) + { + fprintf_filtered (file, "*value not available*\n"); + continue; + } + + /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. + The function frame_register_read() should have returned the + pre-cooked register so no conversion is necessary. */ + /* Convert raw data to virtual format if necessary. */ + if (REGISTER_CONVERTIBLE (i)) + { + REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), + raw_buffer, virtual_buffer); + } + else + { + memcpy (virtual_buffer, raw_buffer, + 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) + { + int j; + + val_print (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++) + { + int idx; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + idx = j; + else + idx = REGISTER_RAW_SIZE (i) - 1 - j; + fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); + } + fprintf_filtered (file, ")"); + } + else + { + /* Print the register in hex. */ + val_print (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) + { + fprintf_filtered (file, "\t"); + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + file, 0, 1, 0, Val_pretty_default); + } + } + + /* Some h8500 specific info. */ + h8500_print_register_hook (i); + + fprintf_filtered (file, "\n"); + } +} + +void +h8500_do_registers_info (int regnum, int all) +{ + h8500_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + regnum, all); +} + int h8500_register_size (int regno) { diff --git a/gdb/hp300ux-nat.c b/gdb/hp300ux-nat.c index ecb8a35..7ef3e34 100644 --- a/gdb/hp300ux-nat.c +++ b/gdb/hp300ux-nat.c @@ -161,7 +161,7 @@ store_inferior_register (register int regno, register unsigned int regaddr) { store_inferior_register_1 (regno, regaddr, - (*(int *) ®isters[(REGISTER_BYTE (regno)) + i])); + (*(int *) &deprecated_registers[(REGISTER_BYTE (regno)) + i])); regaddr += sizeof (int); } } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 19e4402..a3f9561 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -30,6 +30,7 @@ #include "value.h" #include "regcache.h" #include "completer.h" +#include "language.h" /* For argument passing to the inferior */ #include "symtab.h" @@ -130,6 +131,21 @@ static void pa_register_look_aside (char *, int, long *); static void pa_print_fp_reg (int); static void pa_strcat_fp_reg (int, struct ui_file *, enum precision_type); static void record_text_segment_lowaddr (bfd *, asection *, void *); +/* FIXME: brobecker 2002-11-07: We will likely be able to make the + following functions static, once we hppa is partially multiarched. */ +int hppa_reg_struct_has_addr (int gcc_p, struct type *type); +int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs); +CORE_ADDR hppa_stack_align (CORE_ADDR sp); +int hppa_pc_requires_run_before_use (CORE_ADDR pc); +int hppa_instruction_nullified (void); +int hppa_register_byte (int reg_nr); +struct type * hppa_register_virtual_type (int reg_nr); +void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); +int hppa_cannot_store_register (int regnum); +CORE_ADDR hppa_frame_args_address (struct frame_info *fi); +CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); +CORE_ADDR hppa_smash_text_address (CORE_ADDR addr); +int hppa_coerce_float_to_double (struct type *formal, struct type *actual); typedef struct { @@ -149,10 +165,8 @@ extern int hp_som_som_object_present; /* In breakpoint.c */ extern int exception_catchpoints_are_fragile; -/* This is defined in valops.c. */ -extern struct value *find_function_in_inferior (char *); - /* Should call_function allocate stack space for a struct return? */ + int hppa_use_struct_convention (int gcc_p, struct type *type) { @@ -300,7 +314,7 @@ static CORE_ADDR low_text_segment_address; static void record_text_segment_lowaddr (bfd *abfd, asection *section, void *ignored) { - if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY) + if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) == (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) && section->vma < low_text_segment_address) low_text_segment_address = section->vma; @@ -813,6 +827,11 @@ frameless_function_invocation (struct frame_info *frame) return (u->Total_frame_size == 0 && u->stub_unwind.stub_type == 0); } +/* Immediately after a function call, return the saved pc. + Can't go through the frames for this because on some machines + the new frame is not set up until the new function executes + some instructions. */ + CORE_ADDR saved_pc_after_call (struct frame_info *frame) { @@ -1450,7 +1469,8 @@ push_dummy_frame (struct inferior_status *inf_status) for (regnum = FP0_REGNUM; regnum < NUM_REGS; regnum++) { - read_register_bytes (REGISTER_BYTE (regnum), (char *) &freg_buffer, 8); + deprecated_read_register_bytes (REGISTER_BYTE (regnum), + (char *) &freg_buffer, 8); sp = push_bytes (sp, (char *) &freg_buffer, 8); } sp = push_word (sp, read_register (IPSW_REGNUM)); @@ -1529,7 +1549,8 @@ hppa_pop_frame (void) if (fsr.regs[regnum]) { read_memory (fsr.regs[regnum], (char *) &freg_buffer, 8); - write_register_bytes (REGISTER_BYTE (regnum), (char *) &freg_buffer, 8); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), + (char *) &freg_buffer, 8); } if (fsr.regs[IPSW_REGNUM]) @@ -4677,6 +4698,221 @@ hppa_skip_permanent_breakpoint (void) /* We can leave the tail's space the same, since there's no jump. */ } +/* Copy the function value from VALBUF into the proper location + for a function return. + + Called only in the context of the "return" command. */ + +void +hppa_store_return_value (struct type *type, char *valbuf) +{ + /* For software floating point, the return value goes into the + integer registers. But we do not have any flag to key this on, + so we always store the value into the integer registers. + + If its a float value, then we also store it into the floating + point registers. */ + deprecated_write_register_bytes (REGISTER_BYTE (28) + + (TYPE_LENGTH (type) > 4 + ? (8 - TYPE_LENGTH (type)) + : (4 - TYPE_LENGTH (type))), + valbuf, TYPE_LENGTH (type)); + if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) + deprecated_write_register_bytes (REGISTER_BYTE (FP4_REGNUM), + valbuf, TYPE_LENGTH (type)); +} + +/* Copy the function's return value into VALBUF. + + This function is called only in the context of "target function calls", + ie. when the debugger forces a function to be called in the child, and + when the debugger forces a fucntion to return prematurely via the + "return" command. */ + +void +hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf) +{ + if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) + memcpy (valbuf, + (char *)regbuf + REGISTER_BYTE (FP4_REGNUM), + TYPE_LENGTH (type)); + else + memcpy (valbuf, + ((char *)regbuf + + REGISTER_BYTE (28) + + (TYPE_LENGTH (type) > 4 + ? (8 - TYPE_LENGTH (type)) + : (4 - TYPE_LENGTH (type)))), + TYPE_LENGTH (type)); +} + +int +hppa_reg_struct_has_addr (int gcc_p, struct type *type) +{ + /* On the PA, any pass-by-value structure > 8 bytes is actually passed + via a pointer regardless of its type or the compiler used. */ + return (TYPE_LENGTH (type) > 8); +} + +int +hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs) +{ + /* Stack grows upward */ + return (lhs > rhs); +} + +CORE_ADDR +hppa_stack_align (CORE_ADDR sp) +{ + /* elz: adjust the quantity to the next highest value which is + 64-bit aligned. This is used in valops.c, when the sp is adjusted. + On hppa the sp must always be kept 64-bit aligned */ + return ((sp % 8) ? (sp + 7) & -8 : sp); +} + +int +hppa_pc_requires_run_before_use (CORE_ADDR pc) +{ + /* Sometimes we may pluck out a minimal symbol that has a negative address. + + An example of this occurs when an a.out is linked against a foo.sl. + The foo.sl defines a global bar(), and the a.out declares a signature + for bar(). However, the a.out doesn't directly call bar(), but passes + its address in another call. + + If you have this scenario and attempt to "break bar" before running, + gdb will find a minimal symbol for bar() in the a.out. But that + symbol's address will be negative. What this appears to denote is + an index backwards from the base of the procedure linkage table (PLT) + into the data linkage table (DLT), the end of which is contiguous + with the start of the PLT. This is clearly not a valid address for + us to set a breakpoint on. + + Note that one must be careful in how one checks for a negative address. + 0xc0000000 is a legitimate address of something in a shared text + segment, for example. Since I don't know what the possible range + is of these "really, truly negative" addresses that come from the + minimal symbols, I'm resorting to the gross hack of checking the + top byte of the address for all 1's. Sigh. */ + + return (!target_has_stack && (pc & 0xFF000000)); +} + +int +hppa_instruction_nullified (void) +{ + /* brobecker 2002/11/07: Couldn't we use a ULONGEST here? It would + avoid the type cast. I'm leaving it as is for now as I'm doing + semi-mechanical multiarching-related changes. */ + const int ipsw = (int) read_register (IPSW_REGNUM); + const int flags = (int) read_register (FLAGS_REGNUM); + + return ((ipsw & 0x00200000) && !(flags & 0x2)); +} + +/* Index within the register vector of the first byte of the space i + used for register REG_NR. */ + +int +hppa_register_byte (int reg_nr) +{ + return reg_nr * 4; +} + +/* Return the GDB type object for the "standard" data type of data + in register N. */ + +struct type * +hppa_register_virtual_type (int reg_nr) +{ + if (reg_nr < FP4_REGNUM) + return builtin_type_int; + else + return builtin_type_float; +} + +/* Store the address of the place in which to copy the structure the + subroutine will return. This is called from call_function. */ + +void +hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + write_register (28, addr); +} + +/* Return True if REGNUM is not a register available to the user + through ptrace(). */ + +int +hppa_cannot_store_register (int regnum) +{ + return (regnum == 0 + || regnum == PCSQ_HEAD_REGNUM + || (regnum >= PCSQ_TAIL_REGNUM && regnum < IPSW_REGNUM) + || (regnum > IPSW_REGNUM && regnum < FP4_REGNUM)); + +} + +CORE_ADDR +hppa_frame_args_address (struct frame_info *fi) +{ + return fi->frame; +} + +CORE_ADDR +hppa_frame_locals_address (struct frame_info *fi) +{ + return fi->frame; +} + +CORE_ADDR +hppa_smash_text_address (CORE_ADDR addr) +{ + /* The low two bits of the PC on the PA contain the privilege level. + Some genius implementing a (non-GCC) compiler apparently decided + this means that "addresses" in a text section therefore include a + privilege level, and thus symbol tables should contain these bits. + This seems like a bonehead thing to do--anyway, it seems to work + for our purposes to just ignore those bits. */ + + return (addr &= ~0x3); +} + +int +hppa_coerce_float_to_double (struct type *formal, struct type *actual) +{ + /* FIXME: For the pa, it appears that the debug info marks the + parameters as floats regardless of whether the function is + prototyped, but the actual values are passed as doubles for the + non-prototyped case and floats for the prototyped case. Thus we + choose to make the non-prototyped case work for C and break the + prototyped case, since the non-prototyped case is probably much + more common. */ + return (current_language -> la_language == language_c); +} + +static struct gdbarch * +hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + struct gdbarch *gdbarch; + + /* find a candidate among the list of pre-declared architectures. */ + arches = gdbarch_list_lookup_by_info (arches, &info); + if (arches != NULL) + return (arches->gdbarch); + + /* If none found, then allocate and initialize one. */ + gdbarch = gdbarch_alloc (&info, NULL); + + return gdbarch; +} + +static void +hppa_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + /* Nothing to print for the moment. */ +} + void _initialize_hppa_tdep (void) { @@ -4685,6 +4921,7 @@ _initialize_hppa_tdep (void) void tbreak_at_finish_command (char *arg, int from_tty); void break_at_finish_at_depth_command (char *arg, int from_tty); + gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep); tm_print_insn = print_insn_hppa; add_cmd ("unwind", class_maintenance, unwind_command, @@ -4722,52 +4959,3 @@ be no argument or the argument must be a depth.\n"), NULL); be no argument or the argument must be a depth.\n"), NULL); } -/* Copy the function value from VALBUF into the proper location - for a function return. - - Called only in the context of the "return" command. */ - -void -hppa_store_return_value (struct type *type, char *valbuf) -{ - /* For software floating point, the return value goes into the - integer registers. But we do not have any flag to key this on, - so we always store the value into the integer registers. - - If its a float value, then we also store it into the floating - point registers. */ - write_register_bytes (REGISTER_BYTE (28) - + (TYPE_LENGTH (type) > 4 - ? (8 - TYPE_LENGTH (type)) - : (4 - TYPE_LENGTH (type))), - valbuf, - TYPE_LENGTH (type)); - if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) - write_register_bytes (REGISTER_BYTE (FP4_REGNUM), - valbuf, - TYPE_LENGTH (type)); -} - -/* Copy the function's return value into VALBUF. - - This function is called only in the context of "target function calls", - ie. when the debugger forces a function to be called in the child, and - when the debugger forces a fucntion to return prematurely via the - "return" command. */ - -void -hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf) -{ - if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) - memcpy (valbuf, - (char *)regbuf + REGISTER_BYTE (FP4_REGNUM), - TYPE_LENGTH (type)); - else - memcpy (valbuf, - ((char *)regbuf - + REGISTER_BYTE (28) - + (TYPE_LENGTH (type) > 4 - ? (8 - TYPE_LENGTH (type)) - : (4 - TYPE_LENGTH (type)))), - TYPE_LENGTH (type)); -} diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c index 51dde60..d859587 100644 --- a/gdb/hppab-nat.c +++ b/gdb/hppab-nat.c @@ -118,7 +118,7 @@ store_inferior_registers (int regno) errno = 0; if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) { - scratch = *(int *) ®isters[REGISTER_BYTE (regno)] | 0x3; + scratch = *(int *) &deprecated_registers[REGISTER_BYTE (regno)] | 0x3; ptrace (PT_WUREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, scratch); if (errno != 0) @@ -135,7 +135,7 @@ store_inferior_registers (int regno) errno = 0; ptrace (PT_WUREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); + *(int *) &deprecated_registers[REGISTER_BYTE (regno) + i]); if (errno != 0) { /* Warning, not error, in case we are attached; sometimes the diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index aab5e96..f10eb5a 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -121,7 +121,7 @@ store_inferior_registers (int regno) { CORE_ADDR temp; - temp = *(CORE_ADDR *)®isters[REGISTER_BYTE (regno)]; + temp = *(CORE_ADDR *)&deprecated_registers[REGISTER_BYTE (regno)]; /* Set the priv level (stored in the low two bits of the PC. */ temp |= 0x3; @@ -146,7 +146,7 @@ store_inferior_registers (int regno) the high part of IPSW. What will it take for HP to catch a clue about building sensible interfaces? */ if (regno == IPSW_REGNUM && len == 8) - *(int *)®isters[REGISTER_BYTE (regno)] = 0; + *(int *)&deprecated_registers[REGISTER_BYTE (regno)] = 0; #endif for (i = 0; i < len; i += sizeof (int)) @@ -154,7 +154,7 @@ store_inferior_registers (int regno) errno = 0; call_ptrace (PT_WUREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr + i, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); + *(int *) &deprecated_registers[REGISTER_BYTE (regno) + i]); if (errno != 0) { /* Warning, not error, in case we are attached; sometimes diff --git a/gdb/hppam3-nat.c b/gdb/hppam3-nat.c index ee67f1b..349df39 100644 --- a/gdb/hppam3-nat.c +++ b/gdb/hppam3-nat.c @@ -113,15 +113,15 @@ store_inferior_registers (int regno) */ if (regno > 0 && regno < NUM_REGS) { - memcpy (&state[regno], ®isters[REGISTER_BYTE (regno)], + memcpy (&state[regno], &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); } else { for (index = 0; index < NUM_REGS; index++) - memcpy (&state[index], ®isters[REGISTER_BYTE (index)], + memcpy (&state[index], &deprecated_registers[REGISTER_BYTE (index)], REGISTER_RAW_SIZE (index)); -/* state[index] = registers[REGISTER_BYTE (index)]; */ +/* state[index] = deprecated_registers[REGISTER_BYTE (index)]; */ } diff --git a/gdb/hpread.c b/gdb/hpread.c index e4154df..4c3bed9 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -129,52 +129,52 @@ struct symloc /* FIXME: Shouldn't this stuff be in a .h file somewhere? */ /* Complaints about the symbols we have encountered. */ -extern struct complaint string_table_offset_complaint; -extern struct complaint lbrac_unmatched_complaint; -extern struct complaint lbrac_mismatch_complaint; +extern struct deprecated_complaint string_table_offset_complaint; +extern struct deprecated_complaint lbrac_unmatched_complaint; +extern struct deprecated_complaint lbrac_mismatch_complaint; -static struct complaint hpread_unhandled_end_common_complaint = +static struct deprecated_complaint hpread_unhandled_end_common_complaint = { "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0 }; -static struct complaint hpread_unhandled_type_complaint = +static struct deprecated_complaint hpread_unhandled_type_complaint = { "hpread_type_translate: unhandled type code.", 0, 0 }; -static struct complaint hpread_struct_complaint = +static struct deprecated_complaint hpread_struct_complaint = { "hpread_read_struct_type: expected SVAR type...", 0, 0 }; -static struct complaint hpread_array_complaint = +static struct deprecated_complaint hpread_array_complaint = { "error in hpread_array_type.", 0, 0 }; -static struct complaint hpread_type_lookup_complaint = +static struct deprecated_complaint hpread_type_lookup_complaint = { "error in hpread_type_lookup().", 0, 0 }; -static struct complaint hpread_unexpected_end_complaint = +static struct deprecated_complaint hpread_unexpected_end_complaint = { "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.", 0, 0 }; -static struct complaint hpread_tagdef_complaint = +static struct deprecated_complaint hpread_tagdef_complaint = { "error processing class tagdef", 0, 0 }; -static struct complaint hpread_unhandled_common_complaint = +static struct deprecated_complaint hpread_unhandled_common_complaint = { "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON.", 0, 0 }; -static struct complaint hpread_unhandled_blockdata_complaint = +static struct deprecated_complaint hpread_unhandled_blockdata_complaint = { "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA.", 0, 0 }; @@ -3185,6 +3185,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym); TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } if (syms == osyms) break; @@ -3346,6 +3347,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym); TYPE_FIELD_ARTIFICIAL (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } } /* Mark it as having been processed */ @@ -3519,6 +3521,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym); TYPE_FIELD_ARTIFICIAL (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } } @@ -3703,6 +3706,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, list = new; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; /* The "classname" field is actually a DNTT pointer to the base class */ baseclass = hpread_type_lookup (parentp->dinheritance.classname, @@ -4100,6 +4104,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, list->field.name = VT (objfile) + fn_fieldp->dsvar.name; FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITSIZE (list->field) = 0; /* use length from type */ + FIELD_STATIC_KIND (list->field) = 0; memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile); list->field.type = memtype; list->attributes = 0; @@ -4119,6 +4124,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, list->field.name = VT (objfile) + fn_fieldp->ddvar.name; FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITSIZE (list->field) = 0; /* use length from type */ + FIELD_STATIC_KIND (list->field) = 0; memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile); list->field.type = memtype; list->attributes = 0; @@ -4167,6 +4173,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* A FIELD by itself (without a GENFIELD) can also be a static member */ + FIELD_STATIC_KIND (list->field) = 0; if (fieldp->dfield.staticmem) { FIELD_BITPOS (list->field) = -1; diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index 981bb9d..26d57ba 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -357,18 +357,19 @@ hpux_thread_store_registers (int regno) else if (regno == SP_REGNUM) { write_memory ((CORE_ADDR) & tcb_ptr->static_ctx.sp, - registers + REGISTER_BYTE (regno), + &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); tcb_ptr->static_ctx.sp = (cma__t_hppa_regs *) - (extract_address (registers + REGISTER_BYTE (regno), REGISTER_RAW_SIZE (regno)) + 160); + (extract_address (&deprecated_registers[REGISTER_BYTE (regno)], + REGISTER_RAW_SIZE (regno)) + 160); } else if (regno == PC_REGNUM) write_memory (sp - 20, - registers + REGISTER_BYTE (regno), + &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); else write_memory (sp + regmap[regno], - registers + REGISTER_BYTE (regno), + &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); } } diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 8458879..5ea7802 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -34,6 +34,10 @@ #include <sys/reg.h> #endif +#ifndef ORIG_EAX +#define ORIG_EAX -1 +#endif + #ifdef HAVE_SYS_DEBUGREG_H #include <sys/debugreg.h> #endif @@ -90,7 +94,15 @@ static int regmap[] = EAX, ECX, EDX, EBX, UESP, EBP, ESI, EDI, EIP, EFL, CS, SS, - DS, ES, FS, GS + DS, ES, FS, GS, + -1, -1, -1, -1, /* st0, st1, st2, st3 */ + -1, -1, -1, -1, /* st4, st5, st6, st7 */ + -1, -1, -1, -1, /* fctrl, fstat, ftag, fiseg */ + -1, -1, -1, -1, /* fioff, foseg, fooff, fop */ + -1, -1, -1, -1, /* xmm0, xmm1, xmm2, xmm3 */ + -1, -1, -1, -1, /* xmm4, xmm5, xmm6, xmm6 */ + -1, /* mxcsr */ + ORIG_EAX }; /* Which ptrace request retrieves which registers? @@ -148,155 +160,58 @@ kernel_u_size (void) } -/* Fetching registers directly from the U area, one at a time. */ - -/* FIXME: kettenis/2000-03-05: This duplicates code from `inptrace.c'. - The problem is that we define FETCH_INFERIOR_REGISTERS since we - want to use our own versions of {fetch,store}_inferior_registers - that use the GETREGS request. This means that the code in - `infptrace.c' is #ifdef'd out. But we need to fall back on that - code when GDB is running on top of a kernel that doesn't support - the GETREGS request. I want to avoid changing `infptrace.c' right - now. */ - -#ifndef PT_READ_U -#define PT_READ_U PTRACE_PEEKUSR -#endif -#ifndef PT_WRITE_U -#define PT_WRITE_U PTRACE_POKEUSR -#endif - -/* Default the type of the ptrace transfer to int. */ -#ifndef PTRACE_XFER_TYPE -#define PTRACE_XFER_TYPE int -#endif - -/* Registers we shouldn't try to fetch. */ -#define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= I386_NUM_GREGS) +/* Accessing registers through the U area, one at a time. */ /* Fetch one register. */ static void fetch_register (int regno) { - /* This isn't really an address. But ptrace thinks of it as one. */ - CORE_ADDR regaddr; - char mess[128]; /* For messages */ - register int i; - unsigned int offset; /* Offset of registers within the u area. */ - char buf[MAX_REGISTER_RAW_SIZE]; int tid; + int val; - if (OLD_CANNOT_FETCH_REGISTER (regno)) + gdb_assert (!have_ptrace_getregs); + if (cannot_fetch_register (regno)) { - memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); + supply_register (regno, NULL); return; } - /* Overload thread id onto process id */ + /* GNU/Linux LWP ID's are process ID's. */ if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - *(PTRACE_XFER_TYPE *) & buf[i] = ptrace (PT_READ_U, tid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (PTRACE_XFER_TYPE); - if (errno != 0) - { - sprintf (mess, "reading register %s (#%d)", - REGISTER_NAME (regno), regno); - perror_with_name (mess); - } - } - supply_register (regno, buf); -} + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ -/* Fetch register values from the inferior. - If REGNO is negative, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ + errno = 0; + val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); + if (errno != 0) + error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno), + regno, safe_strerror (errno)); -void -old_fetch_inferior_registers (int regno) -{ - if (regno >= 0) - { - fetch_register (regno); - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - fetch_register (regno); - } - } + supply_register (regno, &val); } -/* Registers we shouldn't try to store. */ -#define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= I386_NUM_GREGS) - /* Store one register. */ static void store_register (int regno) { - /* This isn't really an address. But ptrace thinks of it as one. */ - CORE_ADDR regaddr; - char mess[128]; /* For messages */ - register int i; - unsigned int offset; /* Offset of registers within the u area. */ int tid; + int val; - if (OLD_CANNOT_STORE_REGISTER (regno)) - { - return; - } + gdb_assert (!have_ptrace_getregs); + if (cannot_store_register (regno)) + return; - /* Overload thread id onto process id */ + /* GNU/Linux LWP ID's are process ID's. */ if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, - *(PTRACE_XFER_TYPE *) & registers[REGISTER_BYTE (regno) + i]); - regaddr += sizeof (PTRACE_XFER_TYPE); - if (errno != 0) - { - sprintf (mess, "writing register %s (#%d)", - REGISTER_NAME (regno), regno); - perror_with_name (mess); - } - } -} - -/* Store our register values back into the inferior. - If REGNO is negative, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ -void -old_store_inferior_registers (int regno) -{ - if (regno >= 0) - { - store_register (regno); - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - store_register (regno); - } - } + errno = 0; + regcache_collect (regno, &val); + ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val); + if (errno != 0) + error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno), + regno, safe_strerror (errno)); } @@ -573,16 +488,15 @@ static void dummy_sse_values (void) {} int cannot_fetch_register (int regno) { - if (! have_ptrace_getregs) - return OLD_CANNOT_FETCH_REGISTER (regno); - return 0; + gdb_assert (regno >= 0 && regno < NUM_REGS); + return (!have_ptrace_getregs && regmap[regno] == -1); } + int cannot_store_register (int regno) { - if (! have_ptrace_getregs) - return OLD_CANNOT_STORE_REGISTER (regno); - return 0; + gdb_assert (regno >= 0 && regno < NUM_REGS); + return (!have_ptrace_getregs && regmap[regno] == -1); } /* Fetch register REGNO from the child process. If REGNO is -1, do @@ -596,9 +510,14 @@ fetch_inferior_registers (int regno) /* Use the old method of peeking around in `struct user' if the GETREGS request isn't available. */ - if (! have_ptrace_getregs) + if (!have_ptrace_getregs) { - old_fetch_inferior_registers (regno); + int i; + + for (i = 0; i < NUM_REGS; i++) + if (regno == -1 || regno == i) + fetch_register (i); + return; } @@ -615,9 +534,9 @@ fetch_inferior_registers (int regno) fetch_regs (tid); /* The call above might reset `have_ptrace_getregs'. */ - if (! have_ptrace_getregs) + if (!have_ptrace_getregs) { - old_fetch_inferior_registers (-1); + fetch_inferior_registers (regno); return; } @@ -662,9 +581,14 @@ store_inferior_registers (int regno) /* Use the old method of poking around in `struct user' if the SETREGS request isn't available. */ - if (! have_ptrace_getregs) + if (!have_ptrace_getregs) { - old_store_inferior_registers (regno); + int i; + + for (i = 0; i < NUM_REGS; i++) + if (regno == -1 || regno == i) + store_register (i); + return; } @@ -724,7 +648,7 @@ i386_linux_dr_get (int regnum) stuff to the target vectore. For now, just return zero if the ptrace call fails. */ errno = 0; - value = ptrace (PT_READ_U, tid, + value = ptrace (PTRACE_PEEKUSER, tid, offsetof (struct user, u_debugreg[regnum]), 0); if (errno != 0) #if 0 @@ -747,7 +671,7 @@ i386_linux_dr_set (int regnum, unsigned long value) tid = PIDGET (inferior_ptid); errno = 0; - ptrace (PT_WRITE_U, tid, + ptrace (PTRACE_POKEUSER, tid, offsetof (struct user, u_debugreg[regnum]), value); if (errno != 0) perror_with_name ("Couldn't write debug register"); diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index a833fb5..f35c4ff 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -25,6 +25,7 @@ #include "value.h" #include "regcache.h" #include "inferior.h" +#include "reggroups.h" /* For i386_linux_skip_solib_resolver. */ #include "symtab.h" @@ -47,6 +48,20 @@ i386_linux_register_name (int reg) return i386_register_name (reg); } + +/* Return non-zero, when the register is in the corresponding register + group. Put the LINUX_ORIG_EAX register in the system group. */ +static int +i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, + struct reggroup *group) +{ + if (regnum == I386_LINUX_ORIG_EAX_REGNUM) + return (group == system_reggroup + || group == save_reggroup + || group == restore_reggroup); + return i386_register_reggroup_p (gdbarch, regnum, group); +} + /* Recognizing signal handler frames. */ @@ -209,11 +224,17 @@ i386_linux_rt_sigtramp_start (CORE_ADDR pc) static int i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name) { - if (name) - return STREQ ("__restore", name) || STREQ ("__restore_rt", name); - - return (i386_linux_sigtramp_start (pc) != 0 - || i386_linux_rt_sigtramp_start (pc) != 0); + /* If we have NAME, we can optimize the search. The trampolines are + named __restore and __restore_rt. However, they aren't dynamically + exported from the shared C library, so the trampoline may appear to + be part of the preceding function. This should always be sigaction, + __sigaction, or __libc_sigaction (all aliases to the same function). */ + if (name == NULL || strstr (name, "sigaction") != NULL) + return (i386_linux_sigtramp_start (pc) != 0 + || i386_linux_rt_sigtramp_start (pc) != 0); + + return (strcmp ("__restore", name) == 0 + || strcmp ("__restore_rt", name) == 0); } /* Assuming FRAME is for a GNU/Linux sigtramp routine, return the @@ -436,6 +457,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1); set_gdbarch_register_name (gdbarch, i386_linux_register_name); + set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p); set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4); tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 5a19308..d658e3a 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -37,6 +37,7 @@ #include "doublest.h" #include "value.h" #include "gdb_assert.h" +#include "reggroups.h" #include "i386-tdep.h" #include "i387-tdep.h" @@ -70,11 +71,43 @@ static const int mmx_num_regs = (sizeof (i386_mmx_names) #define MM0_REGNUM (NUM_REGS) static int -mmx_regnum_p (int reg) +i386_mmx_regnum_p (int reg) { return (reg >= MM0_REGNUM && reg < MM0_REGNUM + mmx_num_regs); } +/* FP register? */ + +int +i386_fp_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (FP0_REGNUM && FP0_REGNUM <= (regnum) && (regnum) < FPC_REGNUM)); +} + +int +i386_fpc_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (FPC_REGNUM <= (regnum) && (regnum) < XMM0_REGNUM)); +} + +/* SSE register? */ + +int +i386_sse_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (XMM0_REGNUM <= (regnum) && (regnum) < MXCSR_REGNUM)); +} + +int +i386_mxcsr_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (regnum == MXCSR_REGNUM)); +} + /* Return the name of register REG. */ const char * @@ -82,7 +115,7 @@ i386_register_name (int reg) { if (reg < 0) return NULL; - if (mmx_regnum_p (reg)) + if (i386_mmx_regnum_p (reg)) return i386_mmx_names[reg - MM0_REGNUM]; if (reg >= sizeof (i386_register_names) / sizeof (*i386_register_names)) return NULL; @@ -462,7 +495,7 @@ i386_get_frame_setup (CORE_ADDR pc) /* Return non-zero if we're dealing with a frameless signal, that is, a signal trampoline invoked from a frameless function. */ -static int +int i386_frameless_signal_p (struct frame_info *frame) { return (frame->next && frame->next->signal_handler_caller @@ -535,8 +568,12 @@ static CORE_ADDR i386_frame_saved_pc (struct frame_info *frame) { if (PC_IN_CALL_DUMMY (frame->pc, 0, 0)) - return deprecated_read_register_dummy (frame->pc, frame->frame, - PC_REGNUM); + { + ULONGEST pc; + + frame_unwind_unsigned_register (frame, PC_REGNUM, &pc); + return pc; + } if (frame->signal_handler_caller) return i386_sigtramp_saved_pc (frame); @@ -834,7 +871,7 @@ i386_do_pop_frame (struct frame_info *frame) if (addr) { read_memory (addr, regbuf, REGISTER_RAW_SIZE (regnum)); - write_register_gen (regnum, regbuf); + deprecated_write_register_gen (regnum, regbuf); } } write_register (FP_REGNUM, read_memory_integer (fp, 4)); @@ -1039,25 +1076,17 @@ i386_store_return_value (struct type *type, struct regcache *regcache, } } -/* 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. */ +/* Extract from REGCACHE, which contains the (raw) register state, the + address in which a function should return its structure value, as a + CORE_ADDR. */ static CORE_ADDR i386_extract_struct_value_address (struct regcache *regcache) { - /* NOTE: cagney/2002-08-12: Replaced a call to - regcache_raw_read_as_address() with a call to - regcache_cooked_read_unsigned(). The old, ...as_address function - was eventually calling extract_unsigned_integer (via - extract_address) to unpack the registers value. The below is - doing an unsigned extract so that it is functionally equivalent. - The read needs to be cooked as, otherwise, it will never - correctly return the value of a register in the [NUM_REGS - .. NUM_REGS+NUM_PSEUDO_REGS) range. */ - ULONGEST val; - regcache_cooked_read_unsigned (regcache, LOW_RETURN_REGNUM, &val); - return val; + ULONGEST addr; + + regcache_raw_read_unsigned (regcache, LOW_RETURN_REGNUM, &addr); + return addr; } @@ -1102,13 +1131,13 @@ i386_register_virtual_type (int regnum) if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) return lookup_pointer_type (builtin_type_void); - if (FP_REGNUM_P (regnum)) + if (i386_fp_regnum_p (regnum)) return builtin_type_i387_ext; - if (SSE_REGNUM_P (regnum)) + if (i386_sse_regnum_p (regnum)) return builtin_type_vec128i; - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) return builtin_type_vec64i; return builtin_type_int; @@ -1135,7 +1164,7 @@ static void i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, void *buf) { - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) { char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE); int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1151,7 +1180,7 @@ static void i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const void *buf) { - if (mmx_regnum_p (regnum)) + if (i386_mmx_regnum_p (regnum)) { char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE); int fpnum = mmx_regnum_to_fp_regnum (regcache, regnum); @@ -1175,7 +1204,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, static int i386_register_convertible (int regnum) { - return FP_REGNUM_P (regnum); + return i386_fp_regnum_p (regnum); } /* Convert data from raw format for register REGNUM in buffer FROM to @@ -1185,7 +1214,7 @@ static void i386_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { - gdb_assert (FP_REGNUM_P (regnum)); + gdb_assert (i386_fp_regnum_p (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -1208,7 +1237,7 @@ static void i386_register_convert_to_raw (struct type *type, int regnum, char *from, char *to) { - gdb_assert (FP_REGNUM_P (regnum)); + gdb_assert (i386_fp_regnum_p (regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -1415,6 +1444,56 @@ i386_nw_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) } +/* i386 register groups. In addition to the normal groups, add "mmx" + and "sse". */ + +static struct reggroup *i386_sse_reggroup; +static struct reggroup *i386_mmx_reggroup; + +static void +i386_init_reggroups (void) +{ + i386_sse_reggroup = reggroup_new ("sse", USER_REGGROUP); + i386_mmx_reggroup = reggroup_new ("mmx", USER_REGGROUP); +} + +static void +i386_add_reggroups (struct gdbarch *gdbarch) +{ + reggroup_add (gdbarch, i386_sse_reggroup); + reggroup_add (gdbarch, i386_mmx_reggroup); + reggroup_add (gdbarch, general_reggroup); + reggroup_add (gdbarch, float_reggroup); + reggroup_add (gdbarch, all_reggroup); + reggroup_add (gdbarch, save_reggroup); + reggroup_add (gdbarch, restore_reggroup); + reggroup_add (gdbarch, vector_reggroup); + reggroup_add (gdbarch, system_reggroup); +} + +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 fp_regnum_p = (i386_fp_regnum_p (regnum) + || i386_fpc_regnum_p (regnum)); + int mmx_regnum_p = (i386_mmx_regnum_p (regnum)); + if (group == i386_mmx_reggroup) + return mmx_regnum_p; + if (group == i386_sse_reggroup) + return sse_regnum_p; + if (group == vector_reggroup) + return (mmx_regnum_p || sse_regnum_p); + if (group == float_reggroup) + return fp_regnum_p; + if (group == general_reggroup) + return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p); + return default_register_reggroup_p (gdbarch, regnum, group); +} + + static struct gdbarch * i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { @@ -1573,6 +1652,10 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, i386_print_insn); + /* Add the i386 register groups. */ + i386_add_reggroups (gdbarch); + set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch, osabi); @@ -1643,4 +1726,7 @@ are \"default\", \"pcc\" and \"reg\", and the default value is \"default\".", i386_go32_init_abi); gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE, i386_nw_init_abi); + + /* Initialize the i386 specific register groups. */ + i386_init_reggroups (); } diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 646001b..627cb0a 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -113,11 +113,10 @@ struct gdbarch_tdep /* FPU opcode, bottom eleven bits. */ #define FOP_REGNUM (FPC_REGNUM + 7) -/* Return non-zero if N corresponds to a FPU data registers. */ -#define FP_REGNUM_P(n) (FP0_REGNUM && FP0_REGNUM <= (n) && (n) < FPC_REGNUM) - -/* Return non-zero if N corresponds to a FPU control register. */ -#define FPC_REGNUM_P(n) (FPC_REGNUM <= (n) && (n) < XMM0_REGNUM) +/* Return non-zero if REGNUM matches the FP register and the FP + register set is active. */ +extern int i386_fp_regnum_p (int regnum); +extern int i386_fpc_regnum_p (int regnum); /* SSE registers. */ @@ -128,17 +127,18 @@ struct gdbarch_tdep #define MXCSR_REGNUM \ (XMM0_REGNUM + gdbarch_tdep (current_gdbarch)->num_xmm_regs) -/* Return non-zero if N corresponds to a SSE data register. */ -#define SSE_REGNUM_P(n) (XMM0_REGNUM <= (n) && (n) < MXCSR_REGNUM) +/* 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 -#define IS_FP_REGNUM(n) FP_REGNUM_P (n) -#define IS_FPU_CTRL_REGNUM(n) FPC_REGNUM_P (n) -#define IS_SSE_REGNUM(n) SSE_REGNUM_P (n) +#define IS_FP_REGNUM(n) i386_fp_regnum_p (n) +#define IS_SSE_REGNUM(n) i386_sse_regnum_p (n) #define I386_NUM_GREGS 16 #define I386_NUM_FREGS 16 @@ -162,10 +162,15 @@ struct gdbarch_tdep /* Functions exported from i386-tdep.c. */ extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name); +extern int i386_frameless_signal_p (struct frame_info *frame); /* Return the name of register REG. */ extern char const *i386_register_name (int reg); +/* Return non-zero if REGNUM is a member of the specified group. */ +extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, + struct reggroup *group); + /* Initialize a basic ELF architecture variant. */ extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *); diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c index 3fa99a3..4623e11 100644 --- a/gdb/i386gnu-nat.c +++ b/gdb/i386gnu-nat.c @@ -184,7 +184,7 @@ store_fpregs (struct proc *thread, int regno) } /* FIXME: kettenis/2001-07-15: Is this right? Should we somehow - take into account REGISTER_VALID like the old code did? */ + take into account DEPRECATED_REGISTER_VALID like the old code did? */ i387_fill_fsave (state.hw_state, regno); err = thread_set_state (thread->port, i386_FLOAT_STATE, @@ -256,7 +256,7 @@ gnu_store_registers (int regno) } #define fill(state, regno) \ - memcpy (REG_ADDR(state, regno), ®isters[REGISTER_BYTE (regno)], \ + memcpy (REG_ADDR(state, regno), &deprecated_registers[REGISTER_BYTE (regno)], \ REGISTER_RAW_SIZE (regno)) if (regno == -1) @@ -266,14 +266,14 @@ gnu_store_registers (int regno) proc_debug (thread, "storing all registers"); for (i = 0; i < I386_NUM_GREGS; i++) - if (register_valid[i]) + if (deprecated_register_valid[i]) fill (state, i); } else { proc_debug (thread, "storing register %s", REGISTER_NAME (regno)); - gdb_assert (register_valid[regno]); + gdb_assert (deprecated_register_valid[regno]); fill (state, regno); } diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c index 78152e4..a6dc505 100644 --- a/gdb/i386v-nat.c +++ b/gdb/i386v-nat.c @@ -85,7 +85,7 @@ register_u_addr (CORE_ADDR blockend, int regnum) struct user u; CORE_ADDR fpstate; - if (FP_REGNUM_P (regnum)) + if (i386_fp_regnum_p (regnum)) { #ifdef KSTKSZ /* SCO, and others? */ blockend += 4 * (SS + 1) - KSTKSZ; diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 3d4b397..9b47e58 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -321,26 +321,35 @@ void i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) { - unsigned int fctrl; - unsigned int fstat; - unsigned int ftag; - unsigned int fiseg; - unsigned int fioff; - unsigned int foseg; - unsigned int fooff; - unsigned int fop; + char buf[4]; + ULONGEST fctrl; + ULONGEST fstat; + ULONGEST ftag; + ULONGEST fiseg; + ULONGEST fioff; + ULONGEST foseg; + ULONGEST fooff; + ULONGEST fop; int fpreg; int top; - fctrl = read_register (FCTRL_REGNUM); - fstat = read_register (FSTAT_REGNUM); - ftag = read_register (FTAG_REGNUM); - fiseg = read_register (FCS_REGNUM); - fioff = read_register (FCOFF_REGNUM); - foseg = read_register (FDS_REGNUM); - fooff = read_register (FDOFF_REGNUM); - fop = read_register (FOP_REGNUM); - + frame_register_read (frame, FCTRL_REGNUM, buf); + fctrl = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FSTAT_REGNUM, buf); + fstat = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FTAG_REGNUM, buf); + ftag = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FISEG_REGNUM, buf); + fiseg = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FIOFF_REGNUM, buf); + fioff = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FOSEG_REGNUM, buf); + foseg = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FOOFF_REGNUM, buf); + fooff = extract_unsigned_integer (buf, 4); + frame_register_read (frame, FOP_REGNUM, buf); + fop = extract_unsigned_integer (buf, 4); + top = ((fstat >> 11) & 7); for (fpreg = 7; fpreg >= 0; fpreg--) @@ -367,7 +376,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, break; } - read_register_gen ((fpreg + 8 - top) % 8 + FP0_REGNUM, raw); + frame_register_read (frame, (fpreg + 8 - top) % 8 + FP0_REGNUM, raw); fputs_filtered ("0x", file); for (i = 9; i >= 0; i--) @@ -379,7 +388,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, fputs_filtered ("\n", file); } - puts_filtered ("\n"); + fputs_filtered ("\n", file); print_i387_status_word (fstat, file); print_i387_control_word (fctrl, file); @@ -435,6 +444,12 @@ static int fsave_offset[] = void i387_supply_register (int regnum, char *fsave) { + if (fsave == NULL) + { + supply_register (regnum, NULL); + return; + } + /* Most of the FPU control registers occupy only 16 bits in the fsave area. Give those a special treatment. */ if (regnum >= FPC_REGNUM @@ -555,6 +570,12 @@ i387_supply_fxsave (char *fxsave) for (i = FP0_REGNUM; i <= last_regnum; i++) { + if (fxsave == NULL) + { + supply_register (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 @@ -621,7 +642,7 @@ i387_fill_fxsave (char *fxsave, int regnum) /* 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 != FDOFF_REGNUM) + && i != FIOFF_REGNUM && i != FOOFF_REGNUM) { unsigned char buf[4]; diff --git a/gdb/ia64-aix-nat.c b/gdb/ia64-aix-nat.c index c41cc7c..c94144c 100644 --- a/gdb/ia64-aix-nat.c +++ b/gdb/ia64-aix-nat.c @@ -71,11 +71,11 @@ supply_gregset (prgregset_t *gregsetp) by other means. Those that aren't are already handled by the code above. */ for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++) - register_valid[regi] = 1; + deprecated_register_valid[regi] = 1; for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++) - register_valid[regi] = 1; + deprecated_register_valid[regi] = 1; for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++) - register_valid[regi] = 1; + deprecated_register_valid[regi] = 1; } void @@ -85,7 +85,7 @@ fill_gregset (prgregset_t *gregsetp, int regno) #define COPY_REG(_fld_,_regi_) \ if ((regno == -1) || regno == _regi_) \ - memcpy (&(gregsetp->_fld_), ®isters[REGISTER_BYTE (_regi_)], \ + memcpy (&(gregsetp->_fld_), &deprecated_registers[REGISTER_BYTE (_regi_)], \ REGISTER_RAW_SIZE (_regi_)) for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++) @@ -108,10 +108,10 @@ fill_gregset (prgregset_t *gregsetp, int regno) if (regno == IA64_BSP_REGNUM || regno == -1) { memcpy (&(gregsetp->__bspstore), - ®isters[REGISTER_BYTE (IA64_BSP_REGNUM)], + &deprecated_registers[REGISTER_BYTE (IA64_BSP_REGNUM)], REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); - memcpy (®isters[REGISTER_BYTE (IA64_BSPSTORE_REGNUM)], - ®isters[REGISTER_BYTE (IA64_BSP_REGNUM)], + memcpy (&deprecated_registers[REGISTER_BYTE (IA64_BSPSTORE_REGNUM)], + &deprecated_registers[REGISTER_BYTE (IA64_BSP_REGNUM)], REGISTER_RAW_SIZE (IA64_BSP_REGNUM)); } @@ -153,7 +153,7 @@ fill_fpregset (prfpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index 82695ef..76b8235 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -400,7 +400,7 @@ fill_gregset (gregset_t *gregsetp, int regno) #define COPY_REG(_idx_,_regi_) \ if ((regno == -1) || regno == _regi_) \ - memcpy (regp + _idx_, ®isters[REGISTER_BYTE (_regi_)], \ + memcpy (regp + _idx_, &deprecated_registers[REGISTER_BYTE (_regi_)], \ REGISTER_RAW_SIZE (_regi_)) for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++) @@ -465,7 +465,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 53f21a4..59c7c73 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1375,8 +1375,8 @@ ia64_get_saved_register (char *raw_buffer, + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96; } - generic_get_saved_register (raw_buffer, optimized, addrp, frame, - regnum, lval); + deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, + frame, regnum, lval); } } @@ -1902,7 +1902,7 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, float_elt_type, floatreg, VALUE_CONTENTS (arg) + argoffset, - ®isters[REGISTER_BYTE (floatreg)]); + &deprecated_registers[REGISTER_BYTE (floatreg)]); floatreg++; argoffset += TYPE_LENGTH (float_elt_type); len -= TYPE_LENGTH (float_elt_type); @@ -1913,7 +1913,7 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* Store the struct return value in r8 if necessary. */ if (struct_return) { - store_address (®isters[REGISTER_BYTE (IA64_GR8_REGNUM)], + store_address (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)], REGISTER_RAW_SIZE (IA64_GR8_REGNUM), struct_addr); } @@ -1954,12 +1954,12 @@ ia64_store_return_value (struct type *type, char *valbuf) if (TYPE_CODE (type) == TYPE_CODE_FLT) { ia64_register_convert_to_raw (type, IA64_FR8_REGNUM, valbuf, - ®isters[REGISTER_BYTE (IA64_FR8_REGNUM)]); + &deprecated_registers[REGISTER_BYTE (IA64_FR8_REGNUM)]); target_store_registers (IA64_FR8_REGNUM); } else - write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM), - valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM), + valbuf, TYPE_LENGTH (type)); } void diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 3339845..01d45b3 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -42,6 +42,8 @@ #include "event-top.h" #include "parser-defs.h" #include "regcache.h" +#include "reggroups.h" +#include <ctype.h> /* Functions exported for general use, in inferior.h: */ @@ -1572,10 +1574,9 @@ default_print_registers_info (struct gdbarch *gdbarch, char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); - /* FIXME: cagney/2002-03-08: This should be deprecated. */ - if (DO_REGISTERS_INFO_P ()) + if (DEPRECATED_DO_REGISTERS_INFO_P ()) { - DO_REGISTERS_INFO (regnum, print_all); + DEPRECATED_DO_REGISTERS_INFO (regnum, print_all); return; } @@ -1585,11 +1586,14 @@ default_print_registers_info (struct gdbarch *gdbarch, specific reg. */ if (regnum == -1) { - if (!print_all) + if (print_all) { - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + if (!gdbarch_register_reggroup_p (gdbarch, i, all_reggroup)) continue; - if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) + } + else + { + if (!gdbarch_register_reggroup_p (gdbarch, i, general_reggroup)) continue; } } @@ -1665,12 +1669,6 @@ default_print_registers_info (struct gdbarch *gdbarch, } } - /* The SPARC wants to print even-numbered float regs as doubles - in addition to printing them as floats. */ -#ifdef PRINT_REGISTER_HOOK - PRINT_REGISTER_HOOK (i); -#endif - fprintf_filtered (file, "\n"); } } @@ -1693,35 +1691,89 @@ registers_info (char *addr_exp, int fpregs) return; } - do + while (*addr_exp != '\0') { - if (addr_exp[0] == '$') - addr_exp++; - end = addr_exp; - while (*end != '\0' && *end != ' ' && *end != '\t') - ++end; - numregs = NUM_REGS + NUM_PSEUDO_REGS; + char *start; + const char *end; - regnum = frame_map_name_to_regnum (addr_exp, end - addr_exp); - if (regnum >= 0) - goto found; - - regnum = numregs; + /* Keep skipping leading white space. */ + if (isspace ((*addr_exp))) + { + addr_exp++; + continue; + } - if (*addr_exp >= '0' && *addr_exp <= '9') - regnum = atoi (addr_exp); /* Take a number */ - if (regnum >= numregs) /* Bad name, or bad number */ - error ("%.*s: invalid register", (int) (end - addr_exp), addr_exp); + /* Discard any leading ``$''. Check that there is something + resembling a register following it. */ + if (addr_exp[0] == '$') + addr_exp++; + if (isspace ((*addr_exp)) || (*addr_exp) == '\0') + error ("Missing register name"); - found: - gdbarch_print_registers_info (current_gdbarch, gdb_stdout, - selected_frame, regnum, fpregs); + /* Find the start/end of this register name/num/group. */ + start = addr_exp; + while ((*addr_exp) != '\0' && !isspace ((*addr_exp))) + addr_exp++; + end = addr_exp; + + /* Figure out what we've found and display it. */ + + /* A register name? */ + { + int regnum = frame_map_name_to_regnum (start, end - start); + if (regnum >= 0) + { + gdbarch_print_registers_info (current_gdbarch, gdb_stdout, + selected_frame, regnum, fpregs); + continue; + } + } + + /* A register number? (how portable is this one?). */ + { + char *endptr; + int regnum = strtol (start, &endptr, 0); + if (endptr == end + && regnum >= 0 + && regnum < NUM_REGS + NUM_PSEUDO_REGS) + { + gdbarch_print_registers_info (current_gdbarch, gdb_stdout, + selected_frame, regnum, fpregs); + continue; + } + } + + /* A register group? */ + { + struct reggroup *const *group; + for (group = reggroups (current_gdbarch); + (*group) != NULL; + group++) + { + /* Don't bother with a length check. Should the user + enter a short register group name, go with the first + group that matches. */ + if (strncmp (start, reggroup_name ((*group)), end - start) == 0) + break; + } + if ((*group) != NULL) + { + int regnum; + for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) + { + if (gdbarch_register_reggroup_p (current_gdbarch, regnum, + (*group))) + gdbarch_print_registers_info (current_gdbarch, + gdb_stdout, selected_frame, + regnum, fpregs); + } + continue; + } + } - addr_exp = end; - while (*addr_exp == ' ' || *addr_exp == '\t') - ++addr_exp; + /* Nothing matched. */ + error ("Invalid register `%.*s'", (int) (end - start), start); } - while (*addr_exp != '\0'); } void @@ -1740,6 +1792,11 @@ static void print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) { + if (!target_has_registers) + error ("The program has no registers now."); + if (selected_frame == NULL) + error ("No selected frame."); + if (gdbarch_print_vector_info_p (gdbarch)) gdbarch_print_vector_info (gdbarch, file, frame, args); else @@ -1747,14 +1804,9 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, int regnum; int printed_something = 0; - if (!target_has_registers) - error ("The program has no registers now."); - if (selected_frame == NULL) - error ("No selected frame."); - for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) { - if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (regnum))) + if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup)) { printed_something = 1; gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1); @@ -1907,6 +1959,11 @@ static void print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, const char *args) { + if (!target_has_registers) + error ("The program has no registers now."); + if (selected_frame == NULL) + error ("No selected frame."); + if (gdbarch_print_float_info_p (gdbarch)) gdbarch_print_float_info (gdbarch, file, frame, args); else @@ -1920,14 +1977,9 @@ print_float_info (struct gdbarch *gdbarch, struct ui_file *file, int regnum; int printed_something = 0; - if (!target_has_registers) - error ("The program has no registers now."); - if (selected_frame == NULL) - error ("No selected frame."); - for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) { - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT) + if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup)) { printed_something = 1; gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1); diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 777a5b4..601e157 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -514,6 +514,37 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, PTRACE_XFER_TYPE *buffer; struct cleanup *old_chain = NULL; +#ifdef PT_IO + /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO request + that promises to be much more efficient in reading and writing + data in the traced process's address space. */ + + { + struct ptrace_io_desc piod; + + /* NOTE: We assume that there are no distinct address spaces for + instruction and data. */ + piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D; + piod.piod_offs = (void *) memaddr; + piod.piod_addr = myaddr; + piod.piod_len = len; + + if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) &piod, 0) == -1) + { + /* If the PT_IO request is somehow not supported, fallback on + using PT_WRITE_D/PT_READ_D. Otherwise we will return zero + to indicate failure. */ + if (errno != EINVAL) + return 0; + } + else + { + /* Return the actual number of bytes read or written. */ + return piod.piod_len; + } + } +#endif + /* Allocate buffer of that many longwords. */ if (len < GDB_MAX_ALLOCA) { diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c index 0f44776..2283887 100644 --- a/gdb/irix4-nat.c +++ b/gdb/irix4-nat.c @@ -77,19 +77,19 @@ fill_gregset (gregset_t *gregsetp, int regno) /* same FIXME as above wrt 32 */ for (regi = 0; regi < 32; regi++) if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(greg_t *) & registers[REGISTER_BYTE (regi)]; + *(regp + regi) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (regi)]; if ((regno == -1) || (regno == PC_REGNUM)) - gregsetp->gp_pc = *(greg_t *) & registers[REGISTER_BYTE (PC_REGNUM)]; + gregsetp->gp_pc = *(greg_t *) & deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; if ((regno == -1) || (regno == CAUSE_REGNUM)) - gregsetp->gp_cause = *(greg_t *) & registers[REGISTER_BYTE (CAUSE_REGNUM)]; + gregsetp->gp_cause = *(greg_t *) & deprecated_registers[REGISTER_BYTE (CAUSE_REGNUM)]; if ((regno == -1) || (regno == HI_REGNUM)) - gregsetp->gp_mdhi = *(greg_t *) & registers[REGISTER_BYTE (HI_REGNUM)]; + gregsetp->gp_mdhi = *(greg_t *) & deprecated_registers[REGISTER_BYTE (HI_REGNUM)]; if ((regno == -1) || (regno == LO_REGNUM)) - gregsetp->gp_mdlo = *(greg_t *) & registers[REGISTER_BYTE (LO_REGNUM)]; + gregsetp->gp_mdlo = *(greg_t *) & deprecated_registers[REGISTER_BYTE (LO_REGNUM)]; } /* @@ -127,14 +127,14 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } } if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) ®isters[REGISTER_BYTE (FCRCS_REGNUM)]; + fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)]; } @@ -184,7 +184,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, return; } - memcpy ((char *) registers, core_reg_sect, core_reg_size); + memcpy ((char *) deprecated_registers, core_reg_sect, core_reg_size); } diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index d5b5c0c..9e4f210 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -83,27 +83,27 @@ fill_gregset (gregset_t *gregsetp, int regno) for (regi = 0; regi <= CTX_RA; regi++) if ((regno == -1) || (regno == regi)) *(regp + regi) = - extract_signed_integer (®isters[REGISTER_BYTE (regi)], + extract_signed_integer (&deprecated_registers[REGISTER_BYTE (regi)], REGISTER_RAW_SIZE (regi)); if ((regno == -1) || (regno == PC_REGNUM)) *(regp + CTX_EPC) = - extract_signed_integer (®isters[REGISTER_BYTE (PC_REGNUM)], + extract_signed_integer (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)], REGISTER_RAW_SIZE (PC_REGNUM)); if ((regno == -1) || (regno == CAUSE_REGNUM)) *(regp + CTX_CAUSE) = - extract_signed_integer (®isters[REGISTER_BYTE (CAUSE_REGNUM)], + extract_signed_integer (&deprecated_registers[REGISTER_BYTE (CAUSE_REGNUM)], REGISTER_RAW_SIZE (CAUSE_REGNUM)); if ((regno == -1) || (regno == HI_REGNUM)) *(regp + CTX_MDHI) = - extract_signed_integer (®isters[REGISTER_BYTE (HI_REGNUM)], + extract_signed_integer (&deprecated_registers[REGISTER_BYTE (HI_REGNUM)], REGISTER_RAW_SIZE (HI_REGNUM)); if ((regno == -1) || (regno == LO_REGNUM)) *(regp + CTX_MDLO) = - extract_signed_integer (®isters[REGISTER_BYTE (LO_REGNUM)], + extract_signed_integer (&deprecated_registers[REGISTER_BYTE (LO_REGNUM)], REGISTER_RAW_SIZE (LO_REGNUM)); } @@ -145,14 +145,14 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } } if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) ®isters[REGISTER_BYTE (FCRCS_REGNUM)]; + fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)]; } @@ -198,7 +198,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, { if (core_reg_size == REGISTER_BYTES) { - memcpy ((char *) registers, core_reg_sect, core_reg_size); + memcpy ((char *) deprecated_registers, core_reg_sect, core_reg_size); } else if (MIPS_REGSIZE == 4 && core_reg_size == (2 * MIPS_REGSIZE) * NUM_REGS) @@ -206,7 +206,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, /* This is a core file from a N32 executable, 64 bits are saved for all registers. */ char *srcp = core_reg_sect; - char *dstp = registers; + char *dstp = deprecated_registers; int regno; for (regno = 0; regno < NUM_REGS; regno++) @@ -250,7 +250,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, return; } - registers_fetched (); + deprecated_registers_fetched (); } /* Register that we are able to handle irix5 core file formats. diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index cd577fb..4b9d57d 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -579,11 +579,8 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo) struct lwp_info *lp; int resume_all; - /* Apparently the interpretation of PID is dependent on STEP: If - STEP is non-zero, a specific PID means `step only this process - id'. But if STEP is zero, then PID means `continue *all* - processes, but give the signal only to this one'. */ - resume_all = (PIDGET (ptid) == -1) || !step; + /* A specific PTID means `step only this process id'. */ + resume_all = (PIDGET (ptid) == -1); if (resume_all) iterate_over_lwps (resume_set_callback, NULL); diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c index 9cd1672..37edc2b 100644 --- a/gdb/lynx-nat.c +++ b/gdb/lynx-nat.c @@ -296,10 +296,10 @@ fetch_inferior_registers (int regno) supply_register (G0_REGNUM, buf); supply_register (TBR_REGNUM, (char *) &ec.tbr); - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &ec.g1, + memcpy (&deprecated_registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1, 4 * REGISTER_RAW_SIZE (G1_REGNUM)); for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; supply_register (PS_REGNUM, (char *) &ec.psr); supply_register (Y_REGNUM, (char *) &ec.y); @@ -307,10 +307,10 @@ fetch_inferior_registers (int regno) supply_register (NPC_REGNUM, (char *) &ec.npc); supply_register (WIM_REGNUM, (char *) &ec.wim); - memcpy (®isters[REGISTER_BYTE (O0_REGNUM)], ec.o, + memcpy (&deprecated_registers[REGISTER_BYTE (O0_REGNUM)], ec.o, 8 * REGISTER_RAW_SIZE (O0_REGNUM)); for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; } if (whatregs & WHATREGS_STACK) @@ -321,16 +321,16 @@ fetch_inferior_registers (int regno) sp = read_register (SP_REGNUM); target_read_memory (sp + FRAME_SAVED_I0, - ®isters[REGISTER_BYTE (I0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (I0_REGNUM)], 8 * REGISTER_RAW_SIZE (I0_REGNUM)); for (i = I0_REGNUM; i <= I7_REGNUM; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; target_read_memory (sp + FRAME_SAVED_L0, - ®isters[REGISTER_BYTE (L0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 8 * REGISTER_RAW_SIZE (L0_REGNUM)); for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; } if (whatregs & WHATREGS_FLOAT) @@ -345,10 +345,10 @@ fetch_inferior_registers (int regno) if (errno) perror_with_name ("ptrace(PTRACE_GETFPREGS)"); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs, + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs, 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; supply_register (FPS_REGNUM, (char *) &fc.fsr); } @@ -383,7 +383,7 @@ store_inferior_registers (int regno) int retval; ec.tbr = read_register (TBR_REGNUM); - memcpy (&ec.g1, ®isters[REGISTER_BYTE (G1_REGNUM)], + memcpy (&ec.g1, &deprecated_registers[REGISTER_BYTE (G1_REGNUM)], 4 * REGISTER_RAW_SIZE (G1_REGNUM)); ec.psr = read_register (PS_REGNUM); @@ -392,7 +392,7 @@ store_inferior_registers (int regno) ec.npc = read_register (NPC_REGNUM); ec.wim = read_register (WIM_REGNUM); - memcpy (ec.o, ®isters[REGISTER_BYTE (O0_REGNUM)], + memcpy (ec.o, &deprecated_registers[REGISTER_BYTE (O0_REGNUM)], 8 * REGISTER_RAW_SIZE (O0_REGNUM)); errno = 0; @@ -411,19 +411,19 @@ store_inferior_registers (int regno) if (regno == -1 || regno == SP_REGNUM) { - if (!register_valid[L0_REGNUM + 5]) + if (!deprecated_register_valid[L0_REGNUM + 5]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp + FRAME_SAVED_I0, - ®isters[REGISTER_BYTE (I0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (I0_REGNUM)], 8 * REGISTER_RAW_SIZE (I0_REGNUM)); target_write_memory (sp + FRAME_SAVED_L0, - ®isters[REGISTER_BYTE (L0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 8 * REGISTER_RAW_SIZE (L0_REGNUM)); } else if (regno >= L0_REGNUM && regno <= I7_REGNUM) { - if (!register_valid[regno]) + if (!deprecated_register_valid[regno]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7) regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM) @@ -432,7 +432,7 @@ store_inferior_registers (int regno) regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM) + FRAME_SAVED_I0; target_write_memory (sp + regoffset, - ®isters[REGISTER_BYTE (regno)], + &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); } } @@ -449,7 +449,7 @@ store_inferior_registers (int regno) if (errno) perror_with_name ("ptrace(PTRACE_GETFPREGS)"); - memcpy (fc.f.fregs, ®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (fc.f.fregs, &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], 32 * REGISTER_RAW_SIZE (FP0_REGNUM)); fc.fsr = read_register (FPS_REGNUM); @@ -571,7 +571,7 @@ store_inferior_registers (int regno) { unsigned int reg; - reg = *(unsigned int *) ®isters[REGISTER_BYTE (regno) + i]; + reg = *(unsigned int *) &deprecated_registers[REGISTER_BYTE (regno) + i]; errno = 0; ptrace (ptrace_fun, PIDGET (inferior_ptid), diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 0957c87..39fdeba 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -217,6 +217,7 @@ type_exp: type exp : exp '^' %prec UNARY { write_exp_elt_opcode (UNOP_IND); } + ; exp : '-' { number_sign = -1; } @@ -331,6 +332,7 @@ exp : INCL '(' exp ',' exp ')' exp : EXCL '(' exp ',' exp ')' { error("Sets are not implemented.");} + ; set : '{' arglist '}' { error("Sets are not implemented.");} diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index aa1a226..3045a58 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1345,7 +1345,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, sizeof (m68hc11_call_dummy_words)); set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value); set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments); @@ -1368,7 +1368,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 31e8e66..d27d177 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -252,7 +252,7 @@ m68k_deprecated_extract_struct_value_address (char *regbuf) static void m68k_store_return_value (struct type *type, char *valbuf) { - write_register_bytes (0, valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (type)); } /* Describe the pointer in each stack frame to the previous stack frame @@ -463,7 +463,7 @@ m68k_push_dummy_frame (void) this target or not. */ for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) { - read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); + deprecated_read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); sp = push_bytes (sp, raw_buffer, 12); } @@ -493,7 +493,8 @@ m68k_pop_frame (void) if (frame->saved_regs[regnum]) { read_memory (frame->saved_regs[regnum], raw_buffer, 12); - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, + 12); } } for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) @@ -836,16 +837,16 @@ fill_gregset (gregset_t *gregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; + *(regp + regi) = *(int *) &deprecated_registers[REGISTER_BYTE (regi)]; } } if ((regno == -1) || (regno == PS_REGNUM)) { - *(regp + R_PS) = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)]; + *(regp + R_PS) = *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)]; } if ((regno == -1) || (regno == PC_REGNUM)) { - *(regp + R_PC) = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; + *(regp + R_PC) = *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; } } @@ -887,22 +888,22 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } } if ((regno == -1) || (regno == E_FPC_REGNUM)) { - fpregsetp->f_pcr = *(int *) ®isters[REGISTER_BYTE (E_FPC_REGNUM)]; + fpregsetp->f_pcr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPC_REGNUM)]; } if ((regno == -1) || (regno == E_FPS_REGNUM)) { - fpregsetp->f_psr = *(int *) ®isters[REGISTER_BYTE (E_FPS_REGNUM)]; + fpregsetp->f_psr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPS_REGNUM)]; } if ((regno == -1) || (regno == E_FPI_REGNUM)) { - fpregsetp->f_fpiaddr = *(int *) ®isters[REGISTER_BYTE (E_FPI_REGNUM)]; + fpregsetp->f_fpiaddr = *(int *) &deprecated_registers[REGISTER_BYTE (E_FPI_REGNUM)]; } } diff --git a/gdb/m68knbsd-nat.c b/gdb/m68knbsd-nat.c index ec986ee..191327a 100644 --- a/gdb/m68knbsd-nat.c +++ b/gdb/m68knbsd-nat.c @@ -36,15 +36,15 @@ fetch_inferior_registers (int regno) ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, 0); - memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, + memcpy (&deprecated_registers[REGISTER_BYTE (0)], &inferior_registers, sizeof (inferior_registers)); ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, sizeof (inferior_fp_registers)); - registers_fetched (); + deprecated_registers_fetched (); } void @@ -53,12 +53,12 @@ store_inferior_registers (int regno) struct reg inferior_registers; struct fpreg inferior_fp_registers; - memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], + memcpy (&inferior_registers, &deprecated_registers[REGISTER_BYTE (0)], sizeof (inferior_registers)); ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, 0); - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (&inferior_fp_registers, &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], sizeof (inferior_fp_registers)); ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); @@ -77,10 +77,10 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, struct md_core *core_reg = (struct md_core *) core_reg_sect; /* Integer registers */ - memcpy (®isters[REGISTER_BYTE (0)], + memcpy (&deprecated_registers[REGISTER_BYTE (0)], &core_reg->intreg, sizeof (struct reg)); /* Floating point registers */ - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &core_reg->freg, sizeof (struct fpreg)); } diff --git a/gdb/macroscope.c b/gdb/macroscope.c index 083dc1f..b482068 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -27,12 +27,13 @@ #include "target.h" #include "frame.h" #include "inferior.h" +#include "complaints.h" struct macro_scope * sal_macro_scope (struct symtab_and_line sal) { - struct macro_source_file *main; + struct macro_source_file *main, *inclusion; struct macro_scope *ms; if (! sal.symtab @@ -42,17 +43,37 @@ sal_macro_scope (struct symtab_and_line sal) ms = (struct macro_scope *) xmalloc (sizeof (*ms)); main = macro_main (sal.symtab->macro_table); - ms->file = macro_lookup_inclusion (main, sal.symtab->filename); - - if (! ms->file) - internal_error - (__FILE__, __LINE__, - "\n" - "the symtab `%s' refers to a preprocessor macro table which doesn't\n" - "have any record of processing a file by that name.\n", - sal.symtab->filename); + inclusion = macro_lookup_inclusion (main, sal.symtab->filename); - ms->line = sal.line; + if (inclusion) + { + ms->file = inclusion; + ms->line = sal.line; + } + else + { + /* There are, unfortunately, cases where a compilation unit can + have a symtab for a source file that doesn't appear in the + macro table. For example, at the moment, Dwarf doesn't have + any way in the .debug_macinfo section to describe the effect + of #line directives, so if you debug a YACC parser you'll get + a macro table which only mentions the .c files generated by + YACC, but symtabs that mention the .y files consumed by YACC. + + In the long run, we should extend the Dwarf macro info + representation to handle #line directives, and get GCC to + emit it. + + For the time being, though, we'll just treat these as + occurring at the end of the main source file. */ + ms->file = main; + ms->line = -1; + + complaint (&symfile_complaints, + "symtab found for `%s', but that file\n" + "is not covered in the compilation unit's macro information", + sal.symtab->filename); + } return ms; } diff --git a/gdb/macrotab.c b/gdb/macrotab.c index accaa7d..5bc5b73 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -445,7 +445,7 @@ macro_include (struct macro_source_file *source, should tolerate bad debug info. So: First, squawk. */ - static struct complaint bogus_inclusion_line = { + static struct deprecated_complaint bogus_inclusion_line = { "both `%s' and `%s' allegedly #included at %s:%d", 0, 0 }; @@ -707,7 +707,7 @@ check_for_redefinition (struct macro_source_file *source, int line, if (! same) { - static struct complaint macro_redefined = { + static struct deprecated_complaint macro_redefined = { "macro `%s' redefined at %s:%d; original definition at %s:%d", 0, 0 }; @@ -801,7 +801,7 @@ macro_undef (struct macro_source_file *source, int line, if (key->end_file) { - static struct complaint double_undef = { + static struct deprecated_complaint double_undef = { "macro '%s' is #undefined twice, at %s:%d and %s:%d", 0, 0 }; @@ -820,7 +820,7 @@ macro_undef (struct macro_source_file *source, int line, has no macro definition in scope is ignored. So we should ignore it too. */ #if 0 - static struct complaint no_macro_to_undefine = { + static struct deprecated_complaint no_macro_to_undefine = { "no definition for macro `%s' in scope to #undef at %s:%d", 0, 0 }; diff --git a/gdb/macrotab.h b/gdb/macrotab.h index df32977..bd44e2c 100644 --- a/gdb/macrotab.h +++ b/gdb/macrotab.h @@ -83,6 +83,15 @@ struct macro_table; tree mapping the #inclusions that contributed to the compilation unit, with the main source file as its root. + Beware --- not every source file mentioned in a compilation unit's + symtab structures will appear in the #inclusion tree! As of Oct + 2002, GCC does record the effect of #line directives in the source + line info, but not in macro info. This means that GDB's symtabs + (built from the former, among other things) may mention filenames + that the #inclusion tree (built from the latter) doesn't have any + record of. See macroscope.c:sal_macro_scope for how to accomodate + this. + It's worth noting that libcpp has a simpler way of representing all this, which we should consider switching to. It might even be suitable for ordinary non-macro line number info. diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 41114b4..23ee96f 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -1024,8 +1024,9 @@ mcore_store_return_value (struct type *type, char *valbuf) zeros = alloca (return_size); memset (zeros, 0, return_size); - write_register_bytes (REGISTER_BYTE (RETVAL_REGNUM), zeros, return_size); - write_register_bytes (offset, valbuf, value_size); + deprecated_write_register_bytes (REGISTER_BYTE (RETVAL_REGNUM), zeros, + return_size); + deprecated_write_register_bytes (offset, valbuf, value_size); } /* Initialize our target-dependent "stuff" for this newly created frame. diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index e9c3b81..e4aa86b 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -145,94 +145,94 @@ struct symloc /* Various complaints about symbol reading that don't abort the process */ -static struct complaint bad_file_number_complaint = +static struct deprecated_complaint bad_file_number_complaint = {"bad file number %d", 0, 0}; -static struct complaint index_complaint = +static struct deprecated_complaint index_complaint = {"bad aux index at symbol %s", 0, 0}; -static struct complaint aux_index_complaint = +static struct deprecated_complaint aux_index_complaint = {"bad proc end in aux found from symbol %s", 0, 0}; -static struct complaint block_index_complaint = +static struct deprecated_complaint block_index_complaint = {"bad aux index at block symbol %s", 0, 0}; -static struct complaint unknown_ext_complaint = +static struct deprecated_complaint unknown_ext_complaint = {"unknown external symbol %s", 0, 0}; -static struct complaint unknown_sym_complaint = +static struct deprecated_complaint unknown_sym_complaint = {"unknown local symbol %s", 0, 0}; -static struct complaint unknown_st_complaint = +static struct deprecated_complaint unknown_st_complaint = {"with type %d", 0, 0}; -static struct complaint block_overflow_complaint = +static struct deprecated_complaint block_overflow_complaint = {"block containing %s overfilled", 0, 0}; -static struct complaint basic_type_complaint = +static struct deprecated_complaint basic_type_complaint = {"cannot map ECOFF basic type 0x%x for %s", 0, 0}; -static struct complaint unknown_type_qual_complaint = +static struct deprecated_complaint unknown_type_qual_complaint = {"unknown type qualifier 0x%x", 0, 0}; -static struct complaint array_index_type_complaint = +static struct deprecated_complaint array_index_type_complaint = {"illegal array index type for %s, assuming int", 0, 0}; -static struct complaint bad_tag_guess_complaint = +static struct deprecated_complaint bad_tag_guess_complaint = {"guessed tag type of %s incorrectly", 0, 0}; -static struct complaint block_member_complaint = +static struct deprecated_complaint block_member_complaint = {"declaration block contains unhandled symbol type %d", 0, 0}; -static struct complaint stEnd_complaint = +static struct deprecated_complaint stEnd_complaint = {"stEnd with storage class %d not handled", 0, 0}; -static struct complaint unknown_mdebug_symtype_complaint = +static struct deprecated_complaint unknown_mdebug_symtype_complaint = {"unknown symbol type 0x%x", 0, 0}; -static struct complaint stab_unknown_complaint = +static struct deprecated_complaint stab_unknown_complaint = {"unknown stabs symbol %s", 0, 0}; -static struct complaint pdr_for_nonsymbol_complaint = +static struct deprecated_complaint pdr_for_nonsymbol_complaint = {"PDR for %s, but no symbol", 0, 0}; -static struct complaint pdr_static_symbol_complaint = +static struct deprecated_complaint pdr_static_symbol_complaint = {"can't handle PDR for static proc at 0x%lx", 0, 0}; -static struct complaint bad_setjmp_pdr_complaint = +static struct deprecated_complaint bad_setjmp_pdr_complaint = {"fixing bad setjmp PDR from libc", 0, 0}; -static struct complaint bad_fbitfield_complaint = +static struct deprecated_complaint bad_fbitfield_complaint = {"can't handle TIR fBitfield for %s", 0, 0}; -static struct complaint bad_continued_complaint = +static struct deprecated_complaint bad_continued_complaint = {"illegal TIR continued for %s", 0, 0}; -static struct complaint bad_rfd_entry_complaint = +static struct deprecated_complaint bad_rfd_entry_complaint = {"bad rfd entry for %s: file %d, index %d", 0, 0}; -static struct complaint unexpected_type_code_complaint = +static struct deprecated_complaint unexpected_type_code_complaint = {"unexpected type code for %s", 0, 0}; -static struct complaint unable_to_cross_ref_complaint = +static struct deprecated_complaint unable_to_cross_ref_complaint = {"unable to cross ref btTypedef for %s", 0, 0}; -static struct complaint bad_indirect_xref_complaint = +static struct deprecated_complaint bad_indirect_xref_complaint = {"unable to cross ref btIndirect for %s", 0, 0}; -static struct complaint illegal_forward_tq0_complaint = +static struct deprecated_complaint illegal_forward_tq0_complaint = {"illegal tq0 in forward typedef for %s", 0, 0}; -static struct complaint illegal_forward_bt_complaint = +static struct deprecated_complaint illegal_forward_bt_complaint = {"illegal bt %d in forward typedef for %s", 0, 0}; -static struct complaint bad_linetable_guess_complaint = +static struct deprecated_complaint bad_linetable_guess_complaint = {"guessed size of linetable for %s incorrectly", 0, 0}; -static struct complaint bad_ext_ifd_complaint = +static struct deprecated_complaint bad_ext_ifd_complaint = {"bad ifd for external symbol: %d (max %d)", 0, 0}; -static struct complaint bad_ext_iss_complaint = +static struct deprecated_complaint bad_ext_iss_complaint = {"bad iss for external symbol: %ld (max %ld)", 0, 0}; /* Macros and extra defs */ @@ -1091,6 +1091,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, FIELD_TYPE (*f) = t; FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss; FIELD_BITSIZE (*f) = 0; + FIELD_STATIC_KIND (*f) = 0; enum_sym = ((struct symbol *) obstack_alloc (¤t_objfile->symbol_obstack, @@ -1283,6 +1284,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, bitsize = 0; FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name); FIELD_BITSIZE (*f) = bitsize; + FIELD_STATIC_KIND (*f) = 0; break; case stIndirect: /* forward declaration on Irix5 */ @@ -2719,7 +2721,7 @@ parse_partial_symbols (struct objfile *objfile) switch (type_code) { - static struct complaint function_outside_compilation_unit = { + static struct deprecated_complaint function_outside_compilation_unit = { "function `%s' appears to be defined outside of all compilation units", 0, 0 }; char *p; diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index ce1b6b5..a493a2d 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,27 @@ +2002-11-13 Andrew Cagney <ac131313@redhat.com> + + * mi-main.c (mi_cmd_data_write_register_values): Use + deprecated_write_register_bytes instead of write_register_bytes. + +2002-11-11 Jeff Johnston <jjohnstn@redhat.com> + + * gdbmi.texinfo (-var-assign): Add comments about interaction + with -var-update and add an example. Part of fix for gdb/702. + +2002-11-08 Jeff Johnston <jjohnstn@redhat.com> + + * mi-main.c (mi_command_loop): Initialize raw_stdout and gdb_stdout + only if mi version is <= 1. + (mi_init_ui): Initialize raw_stdout and gdb_stdout if mi version + is > 1 so startup message is treated as console output. This is + part of fix for PR gdb/604. + +2002-11-06 Jeff Johnston <jjohnstn@redhat.com> + + * mi-cmd-var.c (mi_cmd_var_create): Change the function used to + parse the frame addr from parse_and_eval_address() to + string_to_core_addr(). This is a fix for PR gdb/494. + 2002-10-23 Jeff Johnston <jjohnstn@redhat.com> * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo index 164b1e8..d64328c 100644 --- a/gdb/mi/gdbmi.texinfo +++ b/gdb/mi/gdbmi.texinfo @@ -3799,7 +3799,21 @@ before the value of a child variable can be evaluated. @end example Assigns the value of @var{expression} to the variable object specified -by @var{name}. The object must be @samp{editable}. +by @var{name}. The object must be @samp{editable}. If the variable's +value is altered by the assign, the variable will show up in any +subsequent @code{-var-update} list. + +@subsubheading Example + +@example +(@value{GDBP}) +-var-assign var1 3 +^done,value="3" +(@value{GDBP}) +-var-update * +^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}] +(@value{GDBP}) +@end example @subheading The @code{-var-update} Command @findex -var-update diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index ee65deb..990b278 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -81,7 +81,7 @@ mi_cmd_var_create (char *command, char **argv, int argc) else { var_type = USE_SPECIFIED_FRAME; - frameaddr = parse_and_eval_address (frame); + frameaddr = string_to_core_addr (frame); } if (varobjdebug) diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 5e8b13b..8af91cc 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -36,7 +36,7 @@ #include "event-loop.h" #include "event-top.h" #include "gdbcore.h" /* for write_memory() */ -#include "value.h" /* for write_register_bytes() */ +#include "value.h" /* for deprecated_write_register_bytes() */ #include "regcache.h" #include "gdb.h" #include "frame.h" @@ -632,7 +632,7 @@ mi_cmd_data_write_register_values (char *command, char **argv, int argc) old_chain = make_cleanup (xfree, buffer); store_signed_integer (buffer, REGISTER_SIZE, value); /* Write it down */ - write_register_bytes (REGISTER_BYTE (regnum), buffer, REGISTER_RAW_SIZE (regnum)); + deprecated_write_register_bytes (REGISTER_BYTE (regnum), buffer, REGISTER_RAW_SIZE (regnum)); /* Free the buffer. */ do_cleanups (old_chain); } @@ -1464,12 +1464,16 @@ mi_load_progress (const char *section_name, static void mi_command_loop (int mi_version) { - /* HACK: Force stdout/stderr to point at the console. This avoids - any potential side effects caused by legacy code that is still - using the TUI / fputs_unfiltered_hook */ - raw_stdout = stdio_fileopen (stdout); - /* Route normal output through the MIx */ - gdb_stdout = mi_console_file_new (raw_stdout, "~"); + if (mi_version <= 1) + { + /* HACK: Force stdout/stderr to point at the console. This avoids + any potential side effects caused by legacy code that is still + using the TUI / fputs_unfiltered_hook */ + raw_stdout = stdio_fileopen (stdout); + /* Route normal output through the MIx */ + gdb_stdout = mi_console_file_new (raw_stdout, "~"); + } + /* Route error and log output through the MI */ gdb_stderr = mi_console_file_new (raw_stdout, "&"); gdb_stdlog = gdb_stderr; @@ -1541,8 +1545,16 @@ setup_architecture_data (void) static void mi_init_ui (char *arg0) { - /* Eventually this will contain code that takes control of the - console. */ + if (strlen (interpreter_p) <= 2 || + interpreter_p[2] > '1') + { + /* HACK: Force stdout/stderr to point at the console. This avoids + any potential side effects caused by legacy code that is still + using the TUI / fputs_unfiltered_hook */ + raw_stdout = stdio_fileopen (stdout); + /* Route normal output through the MIx */ + gdb_stdout = mi_console_file_new (raw_stdout, "~"); + } } void diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 454520d..a0469f6 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -29,6 +29,8 @@ int mips_linux_cannot_fetch_register (int regno) { + if (REGISTER_NAME (regno)[0] == 0) + return 1; if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) @@ -40,6 +42,8 @@ mips_linux_cannot_fetch_register (int regno) int mips_linux_cannot_store_register (int regno) { + if (REGISTER_NAME (regno)[0] == 0) + return 1; if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 03279d8..9ad457b 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -132,7 +132,7 @@ fill_gregset (elf_gregset_t *gregsetp, int regno) if (regno < 32) { - src = ®isters[REGISTER_BYTE (regno)]; + src = &deprecated_registers[REGISTER_BYTE (regno)]; dst = regp + regno + EF_REG0; memcpy (dst, src, sizeof (elf_greg_t)); return; @@ -163,7 +163,7 @@ fill_gregset (elf_gregset_t *gregsetp, int regno) if (regaddr != -1) { - src = ®isters[REGISTER_BYTE (regno)]; + src = &deprecated_registers[REGISTER_BYTE (regno)]; dst = regp + regaddr; memcpy (dst, src, sizeof (elf_greg_t)); } @@ -199,13 +199,13 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regno) if ((regno >= FP0_REGNUM) && (regno < FP0_REGNUM + 32)) { - from = (char *) ®isters[REGISTER_BYTE (regno)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + regno - FP0_REGNUM); memcpy (to, from, REGISTER_RAW_SIZE (regno - FP0_REGNUM)); } else if (regno == FCRCS_REGNUM) { - from = (char *) ®isters[REGISTER_BYTE (regno)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regno)]; to = (char *) (*fpregsetp + 32); memcpy (to, from, REGISTER_RAW_SIZE (regno)); } diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c index 545c741..16009c2 100644 --- a/gdb/mips-nat.c +++ b/gdb/mips-nat.c @@ -76,7 +76,7 @@ fetch_inferior_registers (int regno) char buf[MAX_REGISTER_RAW_SIZE]; register int i; - registers_fetched (); + deprecated_registers_fetched (); for (regno = 1; regno < NUM_REGS; regno++) { diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 8aa61c7..16c206e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -3719,7 +3719,7 @@ mips_push_register (CORE_ADDR * sp, int regno) offset = 0; } *sp -= regsize; - read_register_gen (regno, buffer); + deprecated_read_register_gen (regno, buffer); write_memory (*sp, buffer + offset, regsize); } @@ -4667,17 +4667,15 @@ 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); - write_register_bytes (REGISTER_BYTE (lo.reg), - raw_buffer, - REGISTER_RAW_SIZE (lo.reg)); + deprecated_write_register_bytes (REGISTER_BYTE (lo.reg), raw_buffer, + 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); - write_register_bytes (REGISTER_BYTE (hi.reg), - raw_buffer, - REGISTER_RAW_SIZE (hi.reg)); + deprecated_write_register_bytes (REGISTER_BYTE (hi.reg), raw_buffer, + REGISTER_RAW_SIZE (hi.reg)); } } @@ -4691,17 +4689,15 @@ 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); - write_register_bytes (REGISTER_BYTE (lo.reg), - raw_buffer, - REGISTER_RAW_SIZE (lo.reg)); + deprecated_write_register_bytes (REGISTER_BYTE (lo.reg), raw_buffer, + 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); - write_register_bytes (REGISTER_BYTE (hi.reg), - raw_buffer, - REGISTER_RAW_SIZE (hi.reg)); + deprecated_write_register_bytes (REGISTER_BYTE (hi.reg), raw_buffer, + REGISTER_RAW_SIZE (hi.reg)); } } @@ -6061,7 +6057,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type); set_gdbarch_register_virtual_size (gdbarch, generic_register_size); - set_gdbarch_do_registers_info (gdbarch, mips_do_registers_info); + set_gdbarch_deprecated_do_registers_info (gdbarch, mips_do_registers_info); set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp); /* Hook in OS ABI-specific overrides, if they have been registered. */ @@ -6195,9 +6191,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: CAUSE_REGNUM = %d\n", CAUSE_REGNUM); fprintf_unfiltered (file, - "mips_dump_tdep: DO_REGISTERS_INFO # %s\n", - XSTRING (DO_REGISTERS_INFO)); - fprintf_unfiltered (file, "mips_dump_tdep: DWARF_REG_TO_REGNUM # %s\n", XSTRING (DWARF_REG_TO_REGNUM (REGNUM))); fprintf_unfiltered (file, diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c index 62d6860..22f947f 100644 --- a/gdb/mipsm3-nat.c +++ b/gdb/mipsm3-nat.c @@ -122,14 +122,14 @@ static int reg_offset[] = * Caller knows that the regs handled in one transaction are of same size. */ #define FETCH_REGS(state, regnum, count) \ - memcpy (®isters[REGISTER_BYTE (regnum)], \ + memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \ (char *)state+reg_offset[ regnum ], \ count*REGISTER_SIZE) /* Store COUNT contiguous registers to thread STATE starting from REGNUM */ #define STORE_REGS(state, regnum, count) \ memcpy ((char *)state+reg_offset[ regnum ], \ - ®isters[REGISTER_BYTE (regnum)], \ + &deprecated_registers[REGISTER_BYTE (regnum)], \ count*REGISTER_SIZE) #define REGS_ALL -1 @@ -204,7 +204,7 @@ fetch_inferior_registers (int regno) } /* ZERO_REGNUM is always zero */ - *(int *) registers = 0; + *(int *) deprecated_registers = 0; /* Copy thread saved regs 1..31 to gdb's reg value array * Luckily, they are contiquous @@ -259,7 +259,7 @@ fetch_inferior_registers (int regno) /* If the thread does not have saved COPROC1, set regs to zero */ if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1)) - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], + bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], sizeof (struct mips_float_state)); else { @@ -282,7 +282,7 @@ fetch_inferior_registers (int regno) } /* All registers are valid, if not returned yet */ - registers_fetched (); + deprecated_registers_fetched (); } /* Store gdb's view of registers to the thread. @@ -324,7 +324,7 @@ store_inferior_registers (register int regno) /* Don't allow these to change */ /* ZERO_REGNUM */ - *(int *) registers = 0; + *(int *) deprecated_registers = 0; fetch_inferior_registers (PS_REGNUM); fetch_inferior_registers (BADVADDR_REGNUM); @@ -342,8 +342,8 @@ store_inferior_registers (register int regno) * should go to threads frame pointer. If not true, this * fails badly!!!!! */ - memcpy (®isters[REGISTER_BYTE (MACH_FP_REGNUM)], - ®isters[REGISTER_BYTE (FP_REGNUM)], + memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)], + &deprecated_registers[REGISTER_BYTE (FP_REGNUM)], REGISTER_RAW_SIZE (FP_REGNUM)); #endif diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c index 901f9b0..ec46df6 100644 --- a/gdb/mipsv4-nat.c +++ b/gdb/mipsv4-nat.c @@ -75,19 +75,19 @@ fill_gregset (gregset_t *gregsetp, int regno) for (regi = 0; regi <= 32; regi++) if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(greg_t *) & registers[REGISTER_BYTE (regi)]; + *(regp + regi) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (regi)]; if ((regno == -1) || (regno == PC_REGNUM)) - *(regp + CXT_EPC) = *(greg_t *) & registers[REGISTER_BYTE (PC_REGNUM)]; + *(regp + CXT_EPC) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; if ((regno == -1) || (regno == CAUSE_REGNUM)) - *(regp + CXT_CAUSE) = *(greg_t *) & registers[REGISTER_BYTE (CAUSE_REGNUM)]; + *(regp + CXT_CAUSE) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (CAUSE_REGNUM)]; if ((regno == -1) || (regno == HI_REGNUM)) - *(regp + CXT_MDHI) = *(greg_t *) & registers[REGISTER_BYTE (HI_REGNUM)]; + *(regp + CXT_MDHI) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (HI_REGNUM)]; if ((regno == -1) || (regno == LO_REGNUM)) - *(regp + CXT_MDLO) = *(greg_t *) & registers[REGISTER_BYTE (LO_REGNUM)]; + *(regp + CXT_MDLO) = *(greg_t *) & deprecated_registers[REGISTER_BYTE (LO_REGNUM)]; } /* @@ -125,14 +125,14 @@ fill_fpregset (fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]); memcpy (to, from, REGISTER_RAW_SIZE (regi)); } } if ((regno == -1) || (regno == FCRCS_REGNUM)) - fpregsetp->fp_csr = *(unsigned *) ®isters[REGISTER_BYTE (FCRCS_REGNUM)]; + fpregsetp->fp_csr = *(unsigned *) &deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)]; } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 6e7bada..ed55da9 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -139,9 +139,11 @@ static void mn10300_store_return_value (struct type *type, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_PTR) - write_register_bytes (REGISTER_BYTE (4), valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (4), valbuf, + TYPE_LENGTH (type)); else - write_register_bytes (REGISTER_BYTE (0), valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (0), valbuf, + TYPE_LENGTH (type)); } static struct frame_info *analyze_dummy_frame (CORE_ADDR, CORE_ADDR); @@ -1148,7 +1150,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_register_virtual_size (gdbarch, mn10300_register_virtual_size); set_gdbarch_register_virtual_type (gdbarch, mn10300_register_virtual_type); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum); - set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info); + set_gdbarch_deprecated_do_registers_info (gdbarch, mn10300_do_registers_info); set_gdbarch_sp_regnum (gdbarch, 8); set_gdbarch_pc_regnum (gdbarch, 9); set_gdbarch_fp_regnum (gdbarch, 31); diff --git a/gdb/monitor.c b/gdb/monitor.c index 559c0a2..5a9bb60 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -2294,19 +2294,10 @@ static struct target_ops monitor_ops; static void init_base_monitor_ops (void) { - monitor_ops.to_shortname = NULL; - monitor_ops.to_longname = NULL; - monitor_ops.to_doc = NULL; - monitor_ops.to_open = NULL; monitor_ops.to_close = monitor_close; - monitor_ops.to_attach = NULL; - monitor_ops.to_post_attach = NULL; - monitor_ops.to_require_attach = NULL; monitor_ops.to_detach = monitor_detach; - monitor_ops.to_require_detach = NULL; monitor_ops.to_resume = monitor_resume; monitor_ops.to_wait = monitor_wait; - monitor_ops.to_post_wait = NULL; monitor_ops.to_fetch_registers = monitor_fetch_registers; monitor_ops.to_store_registers = monitor_store_registers; monitor_ops.to_prepare_to_store = monitor_prepare_to_store; @@ -2314,48 +2305,18 @@ init_base_monitor_ops (void) monitor_ops.to_files_info = monitor_files_info; monitor_ops.to_insert_breakpoint = monitor_insert_breakpoint; monitor_ops.to_remove_breakpoint = monitor_remove_breakpoint; - monitor_ops.to_terminal_init = 0; - monitor_ops.to_terminal_inferior = 0; - monitor_ops.to_terminal_ours_for_output = 0; - monitor_ops.to_terminal_ours = 0; - monitor_ops.to_terminal_info = 0; monitor_ops.to_kill = monitor_kill; monitor_ops.to_load = monitor_load; - monitor_ops.to_lookup_symbol = 0; monitor_ops.to_create_inferior = monitor_create_inferior; - monitor_ops.to_post_startup_inferior = NULL; - monitor_ops.to_acknowledge_created_inferior = NULL; - monitor_ops.to_clone_and_follow_inferior = NULL; - monitor_ops.to_post_follow_inferior_by_clone = NULL; - monitor_ops.to_insert_fork_catchpoint = NULL; - monitor_ops.to_remove_fork_catchpoint = NULL; - monitor_ops.to_insert_vfork_catchpoint = NULL; - monitor_ops.to_remove_vfork_catchpoint = NULL; - monitor_ops.to_has_forked = NULL; - monitor_ops.to_has_vforked = NULL; - monitor_ops.to_can_follow_vfork_prior_to_exec = NULL; - monitor_ops.to_post_follow_vfork = NULL; - monitor_ops.to_insert_exec_catchpoint = NULL; - monitor_ops.to_remove_exec_catchpoint = NULL; - monitor_ops.to_has_execd = NULL; - monitor_ops.to_reported_exec_events_per_exec_call = NULL; - monitor_ops.to_has_exited = NULL; monitor_ops.to_mourn_inferior = monitor_mourn_inferior; - monitor_ops.to_can_run = 0; - monitor_ops.to_notice_signals = 0; - monitor_ops.to_thread_alive = 0; monitor_ops.to_stop = monitor_stop; monitor_ops.to_rcmd = monitor_rcmd; - monitor_ops.to_pid_to_exec_file = NULL; monitor_ops.to_stratum = process_stratum; - monitor_ops.DONT_USE = 0; monitor_ops.to_has_all_memory = 1; monitor_ops.to_has_memory = 1; monitor_ops.to_has_stack = 1; monitor_ops.to_has_registers = 1; monitor_ops.to_has_execution = 1; - monitor_ops.to_sections = 0; - monitor_ops.to_sections_end = 0; monitor_ops.to_magic = OPS_MAGIC; } /* init_base_monitor_ops */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index e60b1c0..5563cf9 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -470,8 +470,9 @@ ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) static void ns32k_store_return_value (struct type *valtype, char *valbuf) { - write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT ? - FP0_REGNUM : 0, valbuf, TYPE_LENGTH (valtype)); + deprecated_write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT + ? FP0_REGNUM : 0, valbuf, + TYPE_LENGTH (valtype)); } static CORE_ADDR diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c index fd6e619..bf5250f 100644 --- a/gdb/ns32knbsd-nat.c +++ b/gdb/ns32knbsd-nat.c @@ -32,10 +32,10 @@ #include "regcache.h" #define RF(dst, src) \ - memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src)) + memcpy(&deprecated_registers[REGISTER_BYTE(dst)], &src, sizeof(src)) #define RS(src, dst) \ - memcpy(&dst, ®isters[REGISTER_BYTE(src)], sizeof(dst)) + memcpy(&dst, &deprecated_registers[REGISTER_BYTE(src)], sizeof(dst)) void fetch_inferior_registers (int regno) @@ -71,7 +71,7 @@ fetch_inferior_registers (int regno) RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]); RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]); RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]); - registers_fetched (); + deprecated_registers_fetched (); } void @@ -164,7 +164,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, RF (LP0_REGNUM + 3, core_reg->freg.r_freg[3]); RF (LP0_REGNUM + 5, core_reg->freg.r_freg[5]); RF (LP0_REGNUM + 7, core_reg->freg.r_freg[7]); - registers_fetched (); + deprecated_registers_fetched (); } /* Register that we are able to handle ns32knbsd core file formats. @@ -237,7 +237,7 @@ fetch_kcore_registers (struct pcb *pcb) RF (LP0_REGNUM + 3, pcb->pcb_freg[3]); RF (LP0_REGNUM + 5, pcb->pcb_freg[5]); RF (LP0_REGNUM + 7, pcb->pcb_freg[7]); - registers_fetched (); + deprecated_registers_fetched (); } #endif /* FETCH_KCORE_REGISTERS */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 3234d10..21453d0 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -75,11 +75,11 @@ struct objc_method { /* Complaints about ObjC classes, selectors, etc. */ -static struct complaint noclass_lookup_complaint = { +static struct deprecated_complaint noclass_lookup_complaint = { "no way to lookup Objective-C classes", 0, 0 }; -static struct complaint nosel_lookup_complaint = { +static struct deprecated_complaint nosel_lookup_complaint = { "no way to lookup Objective-C selectors", 0, 0 }; diff --git a/gdb/p-exp.y b/gdb/p-exp.y index dfdab74..16d4991 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -234,7 +234,8 @@ static int search_field; start : { current_type = NULL; search_field = 0; } - normal_start; + normal_start {} + ; normal_start : exp1 @@ -258,11 +259,13 @@ exp : exp '^' %prec UNARY { write_exp_elt_opcode (UNOP_IND); if (current_type) current_type = TYPE_TARGET_TYPE (current_type); } + ; exp : '@' exp %prec UNARY { write_exp_elt_opcode (UNOP_ADDR); if (current_type) current_type = TYPE_POINTER_TYPE (current_type); } + ; exp : '-' exp %prec UNARY { write_exp_elt_opcode (UNOP_NEG); } @@ -318,6 +321,7 @@ exp : exp '[' write_exp_elt_opcode (BINOP_SUBSCRIPT); if (current_type) current_type = TYPE_TARGET_TYPE (current_type); } + ; exp : exp '(' /* This is to save the value of arglist_len @@ -646,7 +650,7 @@ variable: name_not_typename if (this_type) current_type = lookup_struct_elt_type ( this_type, - $1.stoken.ptr, false); + copy_name($1.stoken), false); else current_type = NULL; } diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c index 0797e0d..9e7133e 100644 --- a/gdb/ppc-bdm.c +++ b/gdb/ppc-bdm.c @@ -295,7 +295,7 @@ bdm_ppc_store_registers (int regno) && ((i < FP0_REGNUM) || (i > FPLAST_REGNUM))) { /* printf("write valid reg %d\n", bdm_regno); */ - ocd_write_bdm_registers (bdm_regno, registers + REGISTER_BYTE (i), 4); + ocd_write_bdm_registers (bdm_regno, deprecated_registers + REGISTER_BYTE (i), 4); } /* else if (i == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum) @@ -321,14 +321,9 @@ a wiggler, specify wiggler and then the port it is connected to\n\ (e.g. wiggler lpt1)."; /* to_doc */ bdm_ppc_ops.to_open = bdm_ppc_open; bdm_ppc_ops.to_close = ocd_close; - bdm_ppc_ops.to_attach = NULL; - bdm_ppc_ops.to_post_attach = NULL; - bdm_ppc_ops.to_require_attach = NULL; bdm_ppc_ops.to_detach = ocd_detach; - bdm_ppc_ops.to_require_detach = NULL; bdm_ppc_ops.to_resume = ocd_resume; bdm_ppc_ops.to_wait = bdm_ppc_wait; - bdm_ppc_ops.to_post_wait = NULL; bdm_ppc_ops.to_fetch_registers = bdm_ppc_fetch_registers; bdm_ppc_ops.to_store_registers = bdm_ppc_store_registers; bdm_ppc_ops.to_prepare_to_store = ocd_prepare_to_store; @@ -336,47 +331,18 @@ a wiggler, specify wiggler and then the port it is connected to\n\ bdm_ppc_ops.to_files_info = ocd_files_info; bdm_ppc_ops.to_insert_breakpoint = ocd_insert_breakpoint; bdm_ppc_ops.to_remove_breakpoint = ocd_remove_breakpoint; - bdm_ppc_ops.to_terminal_init = NULL; - bdm_ppc_ops.to_terminal_inferior = NULL; - bdm_ppc_ops.to_terminal_ours_for_output = NULL; - bdm_ppc_ops.to_terminal_ours = NULL; - bdm_ppc_ops.to_terminal_info = NULL; bdm_ppc_ops.to_kill = ocd_kill; bdm_ppc_ops.to_load = ocd_load; - bdm_ppc_ops.to_lookup_symbol = NULL; bdm_ppc_ops.to_create_inferior = ocd_create_inferior; - bdm_ppc_ops.to_post_startup_inferior = NULL; - bdm_ppc_ops.to_acknowledge_created_inferior = NULL; - bdm_ppc_ops.to_clone_and_follow_inferior = NULL; - bdm_ppc_ops.to_post_follow_inferior_by_clone = NULL; - bdm_ppc_ops.to_insert_fork_catchpoint = NULL; - bdm_ppc_ops.to_remove_fork_catchpoint = NULL; - bdm_ppc_ops.to_insert_vfork_catchpoint = NULL; - bdm_ppc_ops.to_remove_vfork_catchpoint = NULL; - bdm_ppc_ops.to_has_forked = NULL; - bdm_ppc_ops.to_has_vforked = NULL; - bdm_ppc_ops.to_can_follow_vfork_prior_to_exec = NULL; - bdm_ppc_ops.to_post_follow_vfork = NULL; - bdm_ppc_ops.to_insert_exec_catchpoint = NULL; - bdm_ppc_ops.to_remove_exec_catchpoint = NULL; - bdm_ppc_ops.to_has_execd = NULL; - bdm_ppc_ops.to_reported_exec_events_per_exec_call = NULL; - bdm_ppc_ops.to_has_exited = NULL; bdm_ppc_ops.to_mourn_inferior = ocd_mourn; - bdm_ppc_ops.to_can_run = 0; - bdm_ppc_ops.to_notice_signals = 0; bdm_ppc_ops.to_thread_alive = ocd_thread_alive; bdm_ppc_ops.to_stop = ocd_stop; - bdm_ppc_ops.to_pid_to_exec_file = NULL; bdm_ppc_ops.to_stratum = process_stratum; - bdm_ppc_ops.DONT_USE = NULL; bdm_ppc_ops.to_has_all_memory = 1; bdm_ppc_ops.to_has_memory = 1; bdm_ppc_ops.to_has_stack = 1; bdm_ppc_ops.to_has_registers = 1; bdm_ppc_ops.to_has_execution = 1; - bdm_ppc_ops.to_sections = NULL; - bdm_ppc_ops.to_sections_end = NULL; bdm_ppc_ops.to_magic = OPS_MAGIC; } /* init_bdm_ppc_ops */ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index ecaed85..1f01706 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -175,7 +175,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { char val_buf[4]; store_address (val_buf, 4, struct_addr); - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); + memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4); greg++; } /* Now fill in the registers and stack... */ @@ -192,7 +192,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (len > 8) printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM + freg)], + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + freg)], VALUE_CONTENTS (arg), len); freg++; } @@ -222,9 +222,9 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if ((greg & 1) == 0) greg++; - memcpy (®isters[REGISTER_BYTE (greg)], + memcpy (&deprecated_registers[REGISTER_BYTE (greg)], VALUE_CONTENTS (arg), 4); - memcpy (®isters[REGISTER_BYTE (greg + 1)], + memcpy (&deprecated_registers[REGISTER_BYTE (greg + 1)], VALUE_CONTENTS (arg) + 4, 4); greg += 2; } @@ -247,7 +247,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, } if (greg <= 10) { - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); + memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4); greg++; } else @@ -268,7 +268,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, memcpy (v_val_buf, VALUE_CONTENTS (arg), len); if (vreg <= 13) { - memcpy (®isters[REGISTER_BYTE (tdep->ppc_vr0_regnum + memcpy (&deprecated_registers[REGISTER_BYTE (tdep->ppc_vr0_regnum + vreg)], v_val_buf, 16); vreg++; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index e26a919..71ad8a1 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -43,6 +43,7 @@ #include "ui-out.h" #include "gdb_assert.h" #include "dictionary.h" +#include "disasm.h" extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -138,8 +139,6 @@ static void enable_display (char *, int); static void disable_display_command (char *, int); -static void disassemble_command (char *, int); - static void printf_command (char *, int); static void print_frame_nameless_args (struct frame_info *, long, @@ -2269,114 +2268,6 @@ printf_command (char *arg, int from_tty) } do_cleanups (old_cleanups); } - -/* Dump a specified section of assembly code. With no command line - arguments, this command will dump the assembly code for the - function surrounding the pc value in the selected frame. With one - argument, it will dump the assembly code surrounding that pc value. - Two arguments are interpeted as bounds within which to dump - assembly. */ - -/* ARGSUSED */ -static void -disassemble_command (char *arg, int from_tty) -{ - CORE_ADDR low, high; - char *name; - CORE_ADDR pc, pc_masked; - char *space_index; -#if 0 - asection *section; -#endif - - name = NULL; - if (!arg) - { - if (!selected_frame) - error ("No frame selected.\n"); - - pc = get_frame_pc (selected_frame); - if (find_pc_partial_function (pc, &name, &low, &high) == 0) - error ("No function contains program counter for selected frame.\n"); -#if defined(TUI) - else if (tui_version) - low = tuiGetLowDisassemblyAddress (low, pc); -#endif - low += FUNCTION_START_OFFSET; - } - else if (!(space_index = (char *) strchr (arg, ' '))) - { - /* One argument. */ - pc = parse_and_eval_address (arg); - if (find_pc_partial_function (pc, &name, &low, &high) == 0) - error ("No function contains specified address.\n"); -#if defined(TUI) - else if (tui_version) - low = tuiGetLowDisassemblyAddress (low, pc); -#endif - low += FUNCTION_START_OFFSET; - } - else - { - /* Two arguments. */ - *space_index = '\0'; - low = parse_and_eval_address (arg); - high = parse_and_eval_address (space_index + 1); - } - -#if defined(TUI) - if (!tui_is_window_visible (DISASSEM_WIN)) -#endif - { - printf_filtered ("Dump of assembler code "); - if (name != NULL) - { - printf_filtered ("for function %s:\n", name); - } - else - { - printf_filtered ("from "); - print_address_numeric (low, 1, gdb_stdout); - printf_filtered (" to "); - print_address_numeric (high, 1, gdb_stdout); - printf_filtered (":\n"); - } - - /* Dump the specified range. */ - pc = low; - -#ifdef GDB_TARGET_MASK_DISAS_PC - pc_masked = GDB_TARGET_MASK_DISAS_PC (pc); -#else - pc_masked = pc; -#endif - - while (pc_masked < high) - { - QUIT; - print_address (pc_masked, gdb_stdout); - printf_filtered (":\t"); - /* We often wrap here if there are long symbolic names. */ - wrap_here (" "); - pc += print_insn (pc, gdb_stdout); - printf_filtered ("\n"); - -#ifdef GDB_TARGET_MASK_DISAS_PC - pc_masked = GDB_TARGET_MASK_DISAS_PC (pc); -#else - pc_masked = pc; -#endif - } - printf_filtered ("End of assembler dump.\n"); - gdb_flush (gdb_stdout); - } -#if defined(TUI) - else - { - tui_show_assembly (low); - } -#endif -} /* Print the instruction at address MEMADDR in debugged memory, on STREAM. Returns length of the instruction, in bytes. */ @@ -2426,15 +2317,6 @@ Defaults for format and size letters are those previously used.\n\ Default count is 1. Default address is following last thing printed\n\ with this command or \"print\".", NULL)); - c = add_com ("disassemble", class_vars, disassemble_command, - "Disassemble a specified section of memory.\n\ -Default is the function surrounding the pc of the selected frame.\n\ -With a single argument, the function surrounding that address is dumped.\n\ -Two arguments are taken as a range of memory to dump."); - set_cmd_completer (c, location_completer); - if (xdb_commands) - add_com_alias ("va", "disassemble", class_xdb, 0); - #if 0 add_com ("whereis", class_vars, whereis_command, "Print line number and file of definition of variable."); diff --git a/gdb/ptx4-nat.c b/gdb/ptx4-nat.c index 65eef9d..1798b50 100644 --- a/gdb/ptx4-nat.c +++ b/gdb/ptx4-nat.c @@ -59,7 +59,7 @@ fill_gregset (gregset_t *gregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - (*gregsetp)[regi] = *(greg_t *) & registers[REGISTER_BYTE (regi)]; + (*gregsetp)[regi] = *(greg_t *) & deprecated_registers[REGISTER_BYTE (regi)]; } } } diff --git a/gdb/regcache.c b/gdb/regcache.c index ab65c67..1bbdb61 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -26,6 +26,7 @@ #include "gdbarch.h" #include "gdbcmd.h" #include "regcache.h" +#include "reggroups.h" #include "gdb_assert.h" #include "gdb_string.h" #include "gdbcmd.h" /* For maintenanceprintlist. */ @@ -65,6 +66,8 @@ struct regcache_descr both raw registers and memory by the architecture methods gdbarch_register_read and gdbarch_register_write. */ int nr_cooked_registers; + long sizeof_cooked_registers; + long sizeof_cooked_register_valid_p; /* Offset and size (in 8 bit bytes), of reach register in the register cache. All registers (including those in the range @@ -92,20 +95,28 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch, gdb_assert (gdbarch != NULL); /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers - in the register buffer. Unfortunatly some architectures do. */ + in the register cache. Unfortunatly some architectures still + rely on this and the pseudo_register_write() method. */ descr->nr_raw_registers = descr->nr_cooked_registers; - descr->sizeof_raw_register_valid_p = descr->nr_cooked_registers; - - /* FIXME: cagney/2002-05-11: Instead of using REGISTER_BYTE() this - code should compute the offets et.al. at runtime. This currently - isn't possible because some targets overlap register locations - - see the mess in read_register_bytes() and write_register_bytes() - registers. */ + descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p; + + /* Compute the offset of each register. Legacy architectures define + REGISTER_BYTE() so use that. */ + /* FIXME: cagney/2002-11-07: Instead of using REGISTER_BYTE() this + code should, as is done in init_regcache_descr(), compute the + offets at runtime. This currently isn't possible as some ISAs + define overlapping register regions - see the mess in + read_register_bytes() and write_register_bytes() registers. */ descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long); descr->register_offset = XCALLOC (descr->nr_cooked_registers, long); descr->max_register_size = 0; for (i = 0; i < descr->nr_cooked_registers; i++) { + /* FIXME: cagney/2001-12-04: This code shouldn't need to use + REGISTER_BYTE(). Unfortunatly, 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] = REGISTER_BYTE (i); descr->sizeof_register[i] = REGISTER_RAW_SIZE (i); if (descr->max_register_size < REGISTER_RAW_SIZE (i)) @@ -114,8 +125,13 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch, descr->max_register_size = REGISTER_VIRTUAL_SIZE (i); } - /* Come up with the real size of the registers buffer. */ - descr->sizeof_raw_registers = REGISTER_BYTES; /* OK use. */ + /* Compute the real size of the register buffer. Start out by + trusting REGISTER_BYTES, but then adjust it upwards should that + be found to not be sufficient. */ + /* FIXME: cagney/2002-11-05: Instead of using REGISTER_BYTES, this + code should, as is done in init_regcache_descr(), compute the + total number of register bytes using the accumulated offsets. */ + descr->sizeof_cooked_registers = REGISTER_BYTES; /* OK use. */ for (i = 0; i < descr->nr_cooked_registers; i++) { long regend; @@ -124,15 +140,14 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch, legacy code is free to put registers in random places in the buffer separated by holes. Once REGISTER_BYTE() is killed this can be greatly simplified. */ - /* FIXME: cagney/2001-12-04: This code shouldn't need to use - REGISTER_BYTE(). Unfortunatly, 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. */ regend = descr->register_offset[i] + descr->sizeof_register[i]; - if (descr->sizeof_raw_registers < regend) - descr->sizeof_raw_registers = regend; + if (descr->sizeof_cooked_registers < regend) + descr->sizeof_cooked_registers = regend; } + /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers + in the register cache. Unfortunatly some architectures still + rely on this and the pseudo_register_write() method. */ + descr->sizeof_raw_registers = descr->sizeof_cooked_registers; } static void * @@ -150,6 +165,7 @@ init_regcache_descr (struct gdbarch *gdbarch) directly onto the raw register cache while the pseudo's are either mapped onto raw-registers or memory. */ descr->nr_cooked_registers = NUM_REGS + NUM_PSEUDO_REGS; + descr->sizeof_cooked_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS; /* Fill in a table of register types. */ descr->register_type = XCALLOC (descr->nr_cooked_registers, @@ -177,12 +193,9 @@ init_regcache_descr (struct gdbarch *gdbarch) array. This pretects GDB from erant code that accesses elements of the global register_valid_p[] array in the range [NUM_REGS .. NUM_REGS + NUM_PSEUDO_REGS). */ - descr->sizeof_raw_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS; + descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p; - /* Lay out the register cache. The pseud-registers are included in - the layout even though their value isn't stored in the register - cache. Some code, via read_register_bytes() access a register - using an offset/length rather than a register number. + /* Lay out the register cache. NOTE: cagney/2002-05-22: Only register_type() is used when constructing the register cache. It is assumed that the @@ -203,15 +216,16 @@ init_regcache_descr (struct gdbarch *gdbarch) descr->max_register_size = descr->sizeof_register[i]; } /* Set the real size of the register cache buffer. */ - /* FIXME: cagney/2002-05-22: Should only need to allocate space - for the raw registers. Unfortunatly 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! */ - descr->sizeof_raw_registers = offset; - /* = descr->register_offset[descr->nr_raw_registers]; */ + descr->sizeof_cooked_registers = offset; } + /* FIXME: cagney/2002-05-22: Should only need to allocate space for + the raw registers. Unfortunatly 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! */ + descr->sizeof_raw_registers = descr->sizeof_cooked_registers; + #if 0 /* Sanity check. Confirm that the assumptions about gdbarch are true. The REGCACHE_DESCR_HANDLE is set before doing the checks @@ -276,11 +290,18 @@ max_register_size (struct gdbarch *gdbarch) struct regcache { struct regcache_descr *descr; - char *raw_registers; - char *raw_register_valid_p; - /* If a value isn't in the cache should the corresponding target be - queried for a value. */ - int passthrough_p; + /* The register buffers. A read-only register cache can hold the + full [0 .. NUM_REGS + NUM_PSEUDO_REGS) while a read/write + register cache can only hold [0 .. NUM_REGS). */ + char *registers; + char *register_valid_p; + /* Is this a read-only cache? A read-only cache is used for saving + the target's register state (e.g, across an inferior function + call or just before forcing a function return). A read-only + cache can only be updated via the methods regcache_dup() and + regcache_cpy(). The actual contents are determined by the + reggroup_save and reggroup_restore methods. */ + int readonly_p; }; struct regcache * @@ -292,11 +313,11 @@ regcache_xmalloc (struct gdbarch *gdbarch) descr = regcache_descr (gdbarch); regcache = XMALLOC (struct regcache); regcache->descr = descr; - regcache->raw_registers + regcache->registers = XCALLOC (descr->sizeof_raw_registers, char); - regcache->raw_register_valid_p + regcache->register_valid_p = XCALLOC (descr->sizeof_raw_register_valid_p, char); - regcache->passthrough_p = 0; + regcache->readonly_p = 1; return regcache; } @@ -305,8 +326,8 @@ regcache_xfree (struct regcache *regcache) { if (regcache == NULL) return; - xfree (regcache->raw_registers); - xfree (regcache->raw_register_valid_p); + xfree (regcache->registers); + xfree (regcache->register_valid_p); xfree (regcache); } @@ -322,6 +343,68 @@ make_cleanup_regcache_xfree (struct regcache *regcache) return make_cleanup (do_regcache_xfree, regcache); } +/* Return a pointer to register REGNUM's buffer cache. */ + +static char * +register_buffer (struct regcache *regcache, int regnum) +{ + return regcache->registers + regcache->descr->register_offset[regnum]; +} + +void +regcache_save (struct regcache *dst, struct regcache *src) +{ + struct gdbarch *gdbarch = dst->descr->gdbarch; + int regnum; + /* The SRC and DST register caches had better belong to the same + architecture. */ + gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); + /* The DST should be `read-only', if it wasn't then the save would + end up trying to write the register values out through to the + target. */ + gdb_assert (!src->readonly_p); + gdb_assert (dst->readonly_p); + /* Clear the dest. */ + memset (dst->registers, 0, dst->descr->sizeof_cooked_registers); + memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p); + /* Copy over any registers (identified by their membership in the + save_reggroup) and mark them as valid. The full [0 + .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some + architectures need to save/restore `cooked' registers that live + in memory. */ + for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++) + { + if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) + { + regcache_cooked_read (src, regnum, register_buffer (dst, regnum)); + dst->register_valid_p[regnum] = 1; + } + } +} + +void +regcache_restore (struct regcache *dst, struct regcache *src) +{ + struct gdbarch *gdbarch = dst->descr->gdbarch; + int regnum; + gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); + gdb_assert (!dst->readonly_p); + gdb_assert (src->readonly_p); + /* Copy over any registers, being careful to only restore those that + were both saved and need to be restored. The full [0 + .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some + architectures need to save/restore `cooked' registers that live + in memory. */ + for (regnum = 0; regnum < src->descr->nr_cooked_registers; regnum++) + { + if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup) + && src->register_valid_p[regnum]) + { + regcache_cooked_write (dst, regnum, register_buffer (src, regnum)); + } + } +} + void regcache_cpy (struct regcache *dst, struct regcache *src) { @@ -330,33 +413,13 @@ regcache_cpy (struct regcache *dst, struct regcache *src) gdb_assert (src != NULL && dst != NULL); gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); gdb_assert (src != dst); - /* FIXME: cagney/2002-05-17: To say this bit is bad is being polite. - It keeps the existing code working where things rely on going - through to the register cache. */ - if (src == current_regcache && src->descr->legacy_p) - { - /* ULGH!!!! Old way. Use REGISTER bytes and let code below - untangle fetch. */ - read_register_bytes (0, dst->raw_registers, REGISTER_BYTES); - return; - } - /* FIXME: cagney/2002-05-17: To say this bit is bad is being polite. - It keeps the existing code working where things rely on going - through to the register cache. */ - if (dst == current_regcache && dst->descr->legacy_p) - { - /* ULGH!!!! Old way. Use REGISTER bytes and let code below - untangle fetch. */ - write_register_bytes (0, src->raw_registers, REGISTER_BYTES); - return; - } - buf = alloca (src->descr->max_register_size); - for (i = 0; i < src->descr->nr_raw_registers; i++) - { - /* Should we worry about the valid bit here? */ - regcache_raw_read (src, i, buf); - regcache_raw_write (dst, i, buf); - } + gdb_assert (src->readonly_p || dst->readonly_p); + if (!src->readonly_p) + regcache_save (dst, src); + else if (!dst->readonly_p) + regcache_restore (dst, src); + else + regcache_cpy_no_passthrough (dst, src); } void @@ -369,9 +432,8 @@ regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src) move of data into the current_regcache(). Doing this would be silly - it would mean that valid_p would be completly invalid. */ gdb_assert (dst != current_regcache); - memcpy (dst->raw_registers, src->raw_registers, - dst->descr->sizeof_raw_registers); - memcpy (dst->raw_register_valid_p, src->raw_register_valid_p, + memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers); + memcpy (dst->register_valid_p, src->register_valid_p, dst->descr->sizeof_raw_register_valid_p); } @@ -400,24 +462,24 @@ regcache_valid_p (struct regcache *regcache, int regnum) { gdb_assert (regcache != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); - return regcache->raw_register_valid_p[regnum]; + return regcache->register_valid_p[regnum]; } char * deprecated_grub_regcache_for_registers (struct regcache *regcache) { - return regcache->raw_registers; + return regcache->registers; } char * deprecated_grub_regcache_for_register_valid (struct regcache *regcache) { - return regcache->raw_register_valid_p; + return regcache->register_valid_p; } /* Global structure containing the current regcache. */ /* FIXME: cagney/2002-05-11: The two global arrays registers[] and - register_valid[] currently point into this structure. */ + deprecated_register_valid[] currently point into this structure. */ struct regcache *current_regcache; /* NOTE: this is a write-through cache. There is no "dirty" bit for @@ -427,9 +489,9 @@ struct regcache *current_regcache; /* REGISTERS contains the cached register values (in target byte order). */ -char *registers; +char *deprecated_registers; -/* REGISTER_VALID is 0 if the register needs to be fetched, +/* DEPRECATED_REGISTER_VALID is 0 if the register needs to be fetched, 1 if it has been fetched, and -1 if the register value was not available. @@ -440,7 +502,7 @@ char *registers; system being debugged - some of the registers in such a system may not have been saved. */ -signed char *register_valid; +signed char *deprecated_register_valid; /* The thread/process associated with the current set of registers. */ @@ -459,7 +521,7 @@ static ptid_t registers_ptid; int register_cached (int regnum) { - return register_valid[regnum]; + return deprecated_register_valid[regnum]; } /* Record that REGNUM's value is cached if STATE is >0, uncached but @@ -470,25 +532,7 @@ set_register_cached (int regnum, int state) { gdb_assert (regnum >= 0); gdb_assert (regnum < current_regcache->descr->nr_raw_registers); - current_regcache->raw_register_valid_p[regnum] = state; -} - -/* REGISTER_CHANGED - - invalidate a single register REGNUM in the cache */ -void -register_changed (int regnum) -{ - set_register_cached (regnum, 0); -} - -/* If REGNUM >= 0, return a pointer to register REGNUM's cache buffer area, - else return a pointer to the start of the cache buffer. */ - -static char * -register_buffer (struct regcache *regcache, int regnum) -{ - return regcache->raw_registers + regcache->descr->register_offset[regnum]; + current_regcache->register_valid_p[regnum] = state; } /* Return whether register REGNUM is a real register. */ @@ -531,7 +575,7 @@ registers_changed (void) registers_changed_hook (); } -/* REGISTERS_FETCHED () +/* DEPRECATED_REGISTERS_FETCHED () Indicate that all registers have been fetched, so mark them all valid. */ @@ -544,7 +588,7 @@ registers_changed (void) this function/hack is eliminated. */ void -registers_fetched (void) +deprecated_registers_fetched (void) { int i; @@ -554,29 +598,29 @@ registers_fetched (void) Fetching all real regs NEVER accounts for pseudo-regs. */ } -/* read_register_bytes and write_register_bytes are generally a *BAD* - idea. They are inefficient because they need to check for partial - updates, which can only be done by scanning through all of the - registers and seeing if the bytes that are being read/written fall - inside of an invalid register. [The main reason this is necessary - is that register sizes can vary, so a simple index won't suffice.] - It is far better to call read_register_gen and write_register_gen - if you want to get at the raw register contents, as it only takes a - regnum as an argument, and therefore can't do a partial register - update. +/* deprecated_read_register_bytes and deprecated_write_register_bytes + are generally a *BAD* idea. They are inefficient because they need + to check for partial updates, which can only be done by scanning + through all of the registers and seeing if the bytes that are being + read/written fall inside of an invalid register. [The main reason + this is necessary is that register sizes can vary, so a simple + index won't suffice.] It is far better to call read_register_gen + and write_register_gen if you want to get at the raw register + contents, as it only takes a regnum as an argument, and therefore + can't do a partial register update. Prior to the recent fixes to check for partial updates, both read - and write_register_bytes always checked to see if any registers - were stale, and then called target_fetch_registers (-1) to update - the whole set. This caused really slowed things down for remote - targets. */ + and deprecated_write_register_bytes always checked to see if any + registers were stale, and then called target_fetch_registers (-1) + to update the whole set. This caused really slowed things down for + remote targets. */ /* Copy INLEN bytes of consecutive data from registers starting with the INREGBYTE'th byte of register data into memory at MYADDR. */ void -read_register_bytes (int in_start, char *in_buf, int in_len) +deprecated_read_register_bytes (int in_start, char *in_buf, int in_len) { int in_end = in_start + in_len; int regnum; @@ -604,7 +648,7 @@ read_register_bytes (int in_start, char *in_buf, int in_len) if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != '\0') /* Force the cache to fetch the entire register. */ - read_register_gen (regnum, reg_buf); + deprecated_read_register_gen (regnum, reg_buf); else /* Legacy note: even though this register is ``invalid'' we still need to return something. It would appear that some @@ -613,7 +657,7 @@ read_register_bytes (int in_start, char *in_buf, int in_len) /* FIXME: cagney/2001-08-18: This is just silly. It defeats the entire register read/write flow of control. Must resist temptation to return 0xdeadbeef. */ - memcpy (reg_buf, registers + reg_start, reg_len); + memcpy (reg_buf, &deprecated_registers[reg_start], reg_len); /* Legacy note: This function, for some reason, allows a NULL input buffer. If the buffer is NULL, the registers are still @@ -669,12 +713,12 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) gdb_assert (regcache != NULL && buf != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); if (regcache->descr->legacy_p - && regcache->passthrough_p) + && !regcache->readonly_p) { gdb_assert (regcache == current_regcache); /* For moment, just use underlying legacy code. Ulgh!!! This silently and very indirectly updates the regcache's regcache - via the global register_valid[]. */ + via the global deprecated_register_valid[]. */ legacy_read_register_gen (regnum, buf); return; } @@ -682,7 +726,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) to the current thread. This switching shouldn't be necessary only there is still only one target side register cache. Sigh! On the bright side, at least there is a regcache object. */ - if (regcache->passthrough_p) + if (!regcache->readonly_p) { gdb_assert (regcache == current_regcache); if (! ptid_equal (registers_ptid, inferior_ptid)) @@ -694,8 +738,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) target_fetch_registers (regnum); } /* Copy the value directly into the register cache. */ - memcpy (buf, (regcache->raw_registers - + regcache->descr->register_offset[regnum]), + memcpy (buf, register_buffer (regcache, regnum), regcache->descr->sizeof_register[regnum]); } @@ -748,7 +791,7 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum, } void -read_register_gen (int regnum, char *buf) +deprecated_read_register_gen (int regnum, char *buf) { gdb_assert (current_regcache != NULL); gdb_assert (current_regcache->descr->gdbarch == current_gdbarch); @@ -767,6 +810,12 @@ regcache_cooked_read (struct regcache *regcache, int regnum, void *buf) gdb_assert (regnum < regcache->descr->nr_cooked_registers); if (regnum < regcache->descr->nr_raw_registers) regcache_raw_read (regcache, regnum, buf); + else if (regcache->readonly_p + && regnum < regcache->descr->nr_cooked_registers + && regcache->register_valid_p[regnum]) + /* Read-only register cache, perhaphs the cooked value was cached? */ + memcpy (buf, register_buffer (regcache, regnum), + regcache->descr->sizeof_register[regnum]); else gdbarch_pseudo_register_read (regcache->descr->gdbarch, regcache, regnum, buf); @@ -843,13 +892,13 @@ regcache_raw_write (struct regcache *regcache, int regnum, const void *buf) { gdb_assert (regcache != NULL && buf != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (!regcache->readonly_p); - if (regcache->passthrough_p - && regcache->descr->legacy_p) + if (regcache->descr->legacy_p) { /* For moment, just use underlying legacy code. Ulgh!!! This silently and very indirectly updates the regcache's buffers - via the globals register_valid[] and registers[]. */ + via the globals deprecated_register_valid[] and registers[]. */ gdb_assert (regcache == current_regcache); legacy_write_register_gen (regnum, buf); return; @@ -860,17 +909,6 @@ regcache_raw_write (struct regcache *regcache, int regnum, const void *buf) if (CANNOT_STORE_REGISTER (regnum)) return; - /* Handle the simple case first -> not write through so just store - value in cache. */ - if (!regcache->passthrough_p) - { - memcpy ((regcache->raw_registers - + regcache->descr->register_offset[regnum]), buf, - regcache->descr->sizeof_register[regnum]); - regcache->raw_register_valid_p[regnum] = 1; - return; - } - /* Make certain that the correct cache is selected. */ gdb_assert (regcache == current_regcache); if (! ptid_equal (registers_ptid, inferior_ptid)) @@ -889,12 +927,12 @@ regcache_raw_write (struct regcache *regcache, int regnum, const void *buf) target_prepare_to_store (); memcpy (register_buffer (regcache, regnum), buf, regcache->descr->sizeof_register[regnum]); - regcache->raw_register_valid_p[regnum] = 1; + regcache->register_valid_p[regnum] = 1; target_store_registers (regnum); } void -write_register_gen (int regnum, char *buf) +deprecated_write_register_gen (int regnum, char *buf) { gdb_assert (current_regcache != NULL); gdb_assert (current_regcache->descr->gdbarch == current_gdbarch); @@ -922,7 +960,7 @@ regcache_cooked_write (struct regcache *regcache, int regnum, const void *buf) into registers starting with the MYREGSTART'th byte of register data. */ void -write_register_bytes (int myregstart, char *myaddr, int inlen) +deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen) { int myregend = myregstart + inlen; int regnum; @@ -947,7 +985,7 @@ write_register_bytes (int myregstart, char *myaddr, int inlen) /* Is this register completely within the range the user is writing? */ else if (myregstart <= regstart && regend <= myregend) - write_register_gen (regnum, myaddr + (regstart - myregstart)); + deprecated_write_register_gen (regnum, myaddr + (regstart - myregstart)); /* The register partially overlaps the range being written. */ else @@ -960,9 +998,9 @@ write_register_bytes (int myregstart, char *myaddr, int inlen) /* We may be doing a partial update of an invalid register. Update it from the target before scribbling on it. */ - read_register_gen (regnum, regbuf); + deprecated_read_register_gen (regnum, regbuf); - memcpy (registers + overlapstart, + memcpy (&deprecated_registers[overlapstart], myaddr + (overlapstart - myregstart), overlapend - overlapstart); @@ -1063,91 +1101,13 @@ register_offset_hack (struct gdbarch *gdbarch, int regnum) return descr->register_offset[regnum]; } -static void -cooked_xfer_using_offset_hack (struct regcache *regcache, - int buf_start, int buf_len, void *in_b, - const void *out_b) -{ - struct regcache_descr *descr = regcache->descr; - struct gdbarch *gdbarch = descr->gdbarch; - bfd_byte *in_buf = in_b; - const bfd_byte *out_buf = out_b; - int buf_end = buf_start + buf_len; - int regnum; - char *reg_buf = alloca (descr->max_register_size); - - /* NOTE: cagney/2002-08-17: This code assumes that the register - offsets are strictly increasing and do not overlap. If this - isn't the case then the bug is in the target architecture and NOT - this code. */ - - /* NOTE: cagney/2002-08-17: This code assumes that only the - registers covered by BUF_START:BUF_LEN should be transfered. If, - for some reason, there is a gap between two registers, then that - gap isn't transfered. (The gap shouldn't be there but that is - another story.) */ - - /* Iterate through all registers looking for those that lie within - BUF_START:BUF_LEN. */ - - for (regnum = 0; regnum < descr->nr_cooked_registers; regnum++) - { - /* The register's location. */ - int reg_start = descr->register_offset[regnum]; - int reg_len = descr->sizeof_register[regnum]; - int reg_end = reg_start + reg_len; - - /* The START, END and LEN that falls within the current - register. */ - int xfer_start; - int xfer_end; - int xfer_len; - - /* start = max (reg_start, buf_start) */ - if (reg_start > buf_start) - xfer_start = reg_start; - else - xfer_start = buf_start; - - /* end = min (reg_end, buf_end) */ - if (reg_end < buf_end) - xfer_end = reg_end; - else - xfer_end = buf_end; - - /* The number of bytes to transfer. If there isn't anything to - transfer (the end is before the start) this will be -ve. */ - xfer_len = xfer_end - xfer_start; - - if (xfer_len > 0) - regcache_xfer_part (regcache, regnum, xfer_start - reg_start, - xfer_len, in_b, out_b, regcache_cooked_read, - regcache_cooked_write); - } -} - -void -regcache_cooked_read_using_offset_hack (struct regcache *regcache, - int buf_start, int buf_len, void *b) -{ - cooked_xfer_using_offset_hack (regcache, buf_start, buf_len, b, NULL); -} - -void -regcache_cooked_write_using_offset_hack (struct regcache *regcache, - int buf_start, int buf_len, - const void *b) -{ - cooked_xfer_using_offset_hack (regcache, buf_start, buf_len, NULL, b); -} - /* Return the contents of register REGNUM as an unsigned integer. */ ULONGEST read_register (int regnum) { char *buf = alloca (REGISTER_RAW_SIZE (regnum)); - read_register_gen (regnum, buf); + deprecated_read_register_gen (regnum, buf); return (extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum))); } @@ -1178,7 +1138,7 @@ LONGEST read_signed_register (int regnum) { void *buf = alloca (REGISTER_RAW_SIZE (regnum)); - read_register_gen (regnum, buf); + deprecated_read_register_gen (regnum, buf); return (extract_signed_integer (buf, REGISTER_RAW_SIZE (regnum))); } @@ -1212,7 +1172,7 @@ write_register (int regnum, LONGEST val) size = REGISTER_RAW_SIZE (regnum); buf = alloca (size); store_signed_integer (buf, size, (LONGEST) val); - write_register_gen (regnum, buf); + deprecated_write_register_gen (regnum, buf); } void @@ -1452,9 +1412,9 @@ static void build_regcache (void) { current_regcache = regcache_xmalloc (current_gdbarch); - current_regcache->passthrough_p = 1; - registers = deprecated_grub_regcache_for_registers (current_regcache); - register_valid = deprecated_grub_regcache_for_register_valid (current_regcache); + current_regcache->readonly_p = 0; + deprecated_registers = deprecated_grub_regcache_for_registers (current_regcache); + deprecated_register_valid = deprecated_grub_regcache_for_register_valid (current_regcache); } static void @@ -1479,7 +1439,7 @@ dump_endian_bytes (struct ui_file *file, enum bfd_endian endian, enum regcache_dump_what { - regcache_dump_none, regcache_dump_raw, regcache_dump_cooked + regcache_dump_none, regcache_dump_raw, regcache_dump_cooked, regcache_dump_groups }; static void @@ -1487,6 +1447,8 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, enum regcache_dump_what what_to_dump) { struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); + struct gdbarch *gdbarch = regcache->descr->gdbarch; + struct reggroup *const *groups = reggroups (gdbarch); int regnum; int footnote_nr = 0; int footnote_register_size = 0; @@ -1593,27 +1555,32 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, } /* Type. */ - if (regnum < 0) - fprintf_unfiltered (file, " %-20s", "Type"); - else - { - static const char blt[] = "builtin_type"; - const char *t = TYPE_NAME (register_type (regcache->descr->gdbarch, - regnum)); - if (t == NULL) - { - char *n; - if (!footnote_register_type_name_null) - footnote_register_type_name_null = ++footnote_nr; - xasprintf (&n, "*%d", footnote_register_type_name_null); - make_cleanup (xfree, n); - t = n; - } - /* Chop a leading builtin_type. */ - if (strncmp (t, blt, strlen (blt)) == 0) - t += strlen (blt); - fprintf_unfiltered (file, " %-20s", t); - } + { + const char *t; + if (regnum < 0) + t = "Type"; + else + { + static const char blt[] = "builtin_type"; + t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum)); + if (t == NULL) + { + char *n; + if (!footnote_register_type_name_null) + footnote_register_type_name_null = ++footnote_nr; + xasprintf (&n, "*%d", footnote_register_type_name_null); + make_cleanup (xfree, n); + t = n; + } + /* Chop a leading builtin_type. */ + if (strncmp (t, blt, strlen (blt)) == 0) + t += strlen (blt); + } + fprintf_unfiltered (file, " %-15s", t); + } + + /* Leading space always present. */ + fprintf_unfiltered (file, " "); /* Value, raw. */ if (what_to_dump == regcache_dump_raw) @@ -1647,6 +1614,26 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, } } + /* Group members. */ + if (what_to_dump == regcache_dump_groups) + { + if (regnum < 0) + fprintf_unfiltered (file, "Groups"); + else + { + int i; + const char *sep = ""; + for (i = 0; groups[i] != NULL; i++) + { + if (gdbarch_register_reggroup_p (gdbarch, regnum, groups[i])) + { + fprintf_unfiltered (file, "%s%s", sep, reggroup_name (groups[i])); + sep = ","; + } + } + } + } + fprintf_unfiltered (file, "\n"); } @@ -1696,14 +1683,20 @@ maintenance_print_cooked_registers (char *args, int from_tty) regcache_print (args, regcache_dump_cooked); } +static void +maintenance_print_register_groups (char *args, int from_tty) +{ + regcache_print (args, regcache_dump_groups); +} + void _initialize_regcache (void) { regcache_descr_handle = register_gdbarch_data (init_regcache_descr, xfree_regcache_descr); REGISTER_GDBARCH_SWAP (current_regcache); - register_gdbarch_swap (®isters, sizeof (registers), NULL); - register_gdbarch_swap (®ister_valid, sizeof (register_valid), NULL); + register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL); + register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL); register_gdbarch_swap (NULL, 0, build_regcache); add_com ("flushregs", class_maintenance, reg_flush_command, @@ -1728,5 +1721,10 @@ Takes an optional file parameter.", "Print the internal register configuration including cooked values.\ Takes an optional file parameter.", &maintenanceprintlist); + add_cmd ("register-groups", class_maintenance, + maintenance_print_register_groups, + "Print the internal register configuration including each register's group.\ +Takes an optional file parameter.", + &maintenanceprintlist); } diff --git a/gdb/regcache.h b/gdb/regcache.h index 4ddcda3..de6a321 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -94,29 +94,14 @@ extern void regcache_collect (int regnum, void *buf); /* The register's ``offset''. - NOTE: cagney/2002-08-17: The ``struct value'' and expression - evaluator treat the register cache as a large liner buffer. - Instead of reading/writing a register using its register number, - the code read/writes registers by specifying their offset into the - buffer and a number of bytes. The code also assumes that these - byte read/writes can cross register boundaries, adjacent registers - treated as a contiguous set of bytes. - - The below map that model onto the real register cache. New code - should go out of their way to avoid using these interfaces. - - FIXME: cagney/2002-08-17: The ``struct value'' and expression - evaluator should be fixed. Instead of using the { offset, length } - pair to describe a value within one or more registers, the code - should use a chain of { regnum, offset, len } tripples. */ + FIXME: cagney/2002-11-07: The get_saved_register() function, when + specifying the real location of a register, does so using that + registers offset in the register cache. That offset is then used + by valops.c to determine the location of the register. The code + should instead use the register's number and a location expression + to describe a value spread across multiple registers or memory. */ extern int register_offset_hack (struct gdbarch *gdbarch, int regnum); -extern void regcache_cooked_read_using_offset_hack (struct regcache *regcache, - int offset, int len, - void *buf); -extern void regcache_cooked_write_using_offset_hack (struct regcache *regcache, - int offset, int len, - const void *buf); /* The type of a register. This function is slightly more efficient @@ -144,16 +129,15 @@ extern struct type *register_type (struct gdbarch *gdbarch, int regnum); extern int max_register_size (struct gdbarch *gdbarch); -/* DEPRECATED: Character array containing an image of the inferior - programs' registers for the most recently referenced thread. */ +/* Save/restore a register cache. The registers saved/restored is + determined by the save_reggroup and restore_reggroup (although you + can't restore a register that wasn't saved as well :-). You can + only save to a read-only cache (default from regcache_xmalloc()) + from a live cache and you can only restore from a read-only cache + to a live cache. */ -extern char *registers; - -/* DEPRECATED: Character array containing the current state of each - register (unavailable<0, invalid=0, valid>0) for the most recently - referenced thread. */ - -extern signed char *register_valid; +extern void regcache_save (struct regcache *dst, struct regcache *src); +extern void regcache_restore (struct regcache *dst, struct regcache *src); /* Copy/duplicate the contents of a register cache. By default, the operation is pass-through. Writes to DST and reads from SRC will @@ -169,26 +153,59 @@ extern struct regcache *regcache_dup_no_passthrough (struct regcache *regcache); extern void regcache_cpy (struct regcache *dest, struct regcache *src); extern void regcache_cpy_no_passthrough (struct regcache *dest, struct regcache *src); +/* NOTE: cagney/2002-11-02: The below have been superseded by the + regcache_cooked_*() functions found above, and the frame_*() + functions found in "frame.h". Take care though, often more than a + simple substitution is required when updating the code. The + change, as far as practical, should avoid adding references to + global variables (e.g., current_regcache, current_frame, + current_gdbarch or selected_frame) and instead refer to the FRAME + or REGCACHE that has been passed into the containing function as + parameters. Consequently, the change typically involves modifying + the containing function so that it takes a FRAME or REGCACHE + parameter. In the case of an architecture vector method, there + should already be a non-deprecated variant that is parameterized + with FRAME or REGCACHE. */ + extern char *deprecated_grub_regcache_for_registers (struct regcache *); extern char *deprecated_grub_regcache_for_register_valid (struct regcache *); +extern void deprecated_read_register_gen (int regnum, char *myaddr); +extern void deprecated_write_register_gen (int regnum, char *myaddr); +extern void deprecated_read_register_bytes (int regbyte, char *myaddr, + int len); +extern void deprecated_write_register_bytes (int regbyte, char *myaddr, + int len); + +/* Character array containing the current state of each register + (unavailable<0, invalid=0, valid>0) for the most recently + referenced thread. This global is often found in close proximity + to code that is directly manipulating the deprecated_registers[] + array. In such cases, it should be possible to replace the lot + with a call to supply_register(). If you find yourself in dire + straits, still needing access to the cache status bit, the + regcache_valid_p() and set_register_cached() functions are + available. */ +extern signed char *deprecated_register_valid; + +/* Character array containing an image of the inferior programs' + registers for the most recently referenced thread. + + NOTE: cagney/2002-11-14: Target side code should be using + supply_register() and/or regcache_collect() while architecture side + code should use the more generic regcache methods. */ + +extern char *deprecated_registers; + +/* NOTE: cagney/2002-11-05: This function, and its co-conspirator + deprecated_registers[], have been superseeded by supply_register(). */ +extern void deprecated_registers_fetched (void); extern int register_cached (int regnum); extern void set_register_cached (int regnum, int state); -extern void register_changed (int regnum); - extern void registers_changed (void); -extern void registers_fetched (void); - -extern void read_register_bytes (int regbyte, char *myaddr, int len); - -extern void read_register_gen (int regnum, char *myaddr); - -extern void write_register_gen (int regnum, char *myaddr); - -extern void write_register_bytes (int regbyte, char *myaddr, int len); /* Rename to read_unsigned_register()? */ extern ULONGEST read_register (int regnum); diff --git a/gdb/remote-array.c b/gdb/remote-array.c index ed0c40e..da9bfc7 100644 --- a/gdb/remote-array.c +++ b/gdb/remote-array.c @@ -115,14 +115,9 @@ init_array_ops (void) Specify the serial device it is connected to (e.g. /dev/ttya)."; array_ops.to_open = array_open; array_ops.to_close = array_close; - array_ops.to_attach = NULL; - array_ops.to_post_attach = NULL; - array_ops.to_require_attach = NULL; array_ops.to_detach = array_detach; - array_ops.to_require_detach = NULL; array_ops.to_resume = array_resume; array_ops.to_wait = array_wait; - array_ops.to_post_wait = NULL; array_ops.to_fetch_registers = array_fetch_registers; array_ops.to_store_registers = array_store_registers; array_ops.to_prepare_to_store = array_prepare_to_store; @@ -130,47 +125,15 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; array_ops.to_files_info = array_files_info; array_ops.to_insert_breakpoint = array_insert_breakpoint; array_ops.to_remove_breakpoint = array_remove_breakpoint; - array_ops.to_terminal_init = 0; - array_ops.to_terminal_inferior = 0; - array_ops.to_terminal_ours_for_output = 0; - array_ops.to_terminal_ours = 0; - array_ops.to_terminal_info = 0; array_ops.to_kill = array_kill; - array_ops.to_load = 0; - array_ops.to_lookup_symbol = 0; array_ops.to_create_inferior = array_create_inferior; - array_ops.to_post_startup_inferior = NULL; - array_ops.to_acknowledge_created_inferior = NULL; - array_ops.to_clone_and_follow_inferior = NULL; - array_ops.to_post_follow_inferior_by_clone = NULL; - array_ops.to_insert_fork_catchpoint = NULL; - array_ops.to_remove_fork_catchpoint = NULL; - array_ops.to_insert_vfork_catchpoint = NULL; - array_ops.to_remove_vfork_catchpoint = NULL; - array_ops.to_has_forked = NULL; - array_ops.to_has_vforked = NULL; - array_ops.to_can_follow_vfork_prior_to_exec = NULL; - array_ops.to_post_follow_vfork = NULL; - array_ops.to_insert_exec_catchpoint = NULL; - array_ops.to_remove_exec_catchpoint = NULL; - array_ops.to_has_execd = NULL; - array_ops.to_reported_exec_events_per_exec_call = NULL; - array_ops.to_has_exited = NULL; array_ops.to_mourn_inferior = array_mourn_inferior; - array_ops.to_can_run = 0; - array_ops.to_notice_signals = 0; - array_ops.to_thread_alive = 0; - array_ops.to_stop = 0; - array_ops.to_pid_to_exec_file = NULL; array_ops.to_stratum = process_stratum; - array_ops.DONT_USE = 0; array_ops.to_has_all_memory = 1; array_ops.to_has_memory = 1; array_ops.to_has_stack = 1; array_ops.to_has_registers = 1; array_ops.to_has_execution = 1; - array_ops.to_sections = 0; - array_ops.to_sections_end = 0; array_ops.to_magic = OPS_MAGIC; }; diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index d9cf5e8..33e5c00 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -2143,14 +2143,9 @@ target e7000 /dev/ttya 9600\n\ target e7000 foobar"; e7000_ops.to_open = e7000_open; e7000_ops.to_close = e7000_close; - e7000_ops.to_attach = 0; - e7000_ops.to_post_attach = NULL; - e7000_ops.to_require_attach = NULL; e7000_ops.to_detach = e7000_detach; - e7000_ops.to_require_detach = NULL; e7000_ops.to_resume = e7000_resume; e7000_ops.to_wait = e7000_wait; - e7000_ops.to_post_wait = NULL; e7000_ops.to_fetch_registers = e7000_fetch_register; e7000_ops.to_store_registers = e7000_store_register; e7000_ops.to_prepare_to_store = e7000_prepare_to_store; @@ -2158,47 +2153,17 @@ target e7000 foobar"; e7000_ops.to_files_info = e7000_files_info; e7000_ops.to_insert_breakpoint = e7000_insert_breakpoint; e7000_ops.to_remove_breakpoint = e7000_remove_breakpoint; - e7000_ops.to_terminal_init = 0; - e7000_ops.to_terminal_inferior = 0; - e7000_ops.to_terminal_ours_for_output = 0; - e7000_ops.to_terminal_ours = 0; - e7000_ops.to_terminal_info = 0; e7000_ops.to_kill = e7000_kill; e7000_ops.to_load = e7000_load; - e7000_ops.to_lookup_symbol = 0; e7000_ops.to_create_inferior = e7000_create_inferior; - e7000_ops.to_post_startup_inferior = NULL; - e7000_ops.to_acknowledge_created_inferior = NULL; - e7000_ops.to_clone_and_follow_inferior = NULL; - e7000_ops.to_post_follow_inferior_by_clone = NULL; - e7000_ops.to_insert_fork_catchpoint = NULL; - e7000_ops.to_remove_fork_catchpoint = NULL; - e7000_ops.to_insert_vfork_catchpoint = NULL; - e7000_ops.to_remove_vfork_catchpoint = NULL; - e7000_ops.to_has_forked = NULL; - e7000_ops.to_has_vforked = NULL; - e7000_ops.to_can_follow_vfork_prior_to_exec = NULL; - e7000_ops.to_post_follow_vfork = NULL; - e7000_ops.to_insert_exec_catchpoint = NULL; - e7000_ops.to_remove_exec_catchpoint = NULL; - e7000_ops.to_has_execd = NULL; - e7000_ops.to_reported_exec_events_per_exec_call = NULL; - e7000_ops.to_has_exited = NULL; e7000_ops.to_mourn_inferior = e7000_mourn_inferior; - e7000_ops.to_can_run = 0; - e7000_ops.to_notice_signals = 0; - e7000_ops.to_thread_alive = 0; e7000_ops.to_stop = e7000_stop; - e7000_ops.to_pid_to_exec_file = NULL; e7000_ops.to_stratum = process_stratum; - e7000_ops.DONT_USE = 0; e7000_ops.to_has_all_memory = 1; e7000_ops.to_has_memory = 1; e7000_ops.to_has_stack = 1; e7000_ops.to_has_registers = 1; e7000_ops.to_has_execution = 1; - e7000_ops.to_sections = 0; - e7000_ops.to_sections_end = 0; e7000_ops.to_magic = OPS_MAGIC; }; diff --git a/gdb/remote-es.c b/gdb/remote-es.c index 24183cc..72e6171 100644 --- a/gdb/remote-es.c +++ b/gdb/remote-es.c @@ -623,7 +623,7 @@ es1800_fetch_register (int regno) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = (fromhex (p[k * 2 + 1]) * 16) + fromhex (p[k * 2 + 2]); + deprecated_registers[r++] = (fromhex (p[k * 2 + 1]) * 16) + fromhex (p[k * 2 + 2]); } } else @@ -666,7 +666,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = (fromhex (p[i + 0]) * 16) + fromhex (p[i + 1]); + deprecated_registers[r++] = (fromhex (p[i + 0]) * 16) + fromhex (p[i + 1]); i += 2; } } @@ -685,7 +685,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = (fromhex (p[i + 0])) * 16 + fromhex (p[i + 1]); + deprecated_registers[r++] = (fromhex (p[i + 0])) * 16 + fromhex (p[i + 1]); i += 2; } } @@ -725,7 +725,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); + deprecated_registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); } p = SR_buf; @@ -735,7 +735,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = + deprecated_registers[r++] = fromhex (SR_buf[k * 2 + 1]) * 16 + fromhex (SR_buf[k * 2 + 2]); } send_with_reply ("PC", buf, sizeof (buf)); @@ -746,7 +746,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); + deprecated_registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); } } else @@ -771,7 +771,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); + deprecated_registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); } /* fetch STATUS */ @@ -783,7 +783,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = + deprecated_registers[r++] = fromhex (SR_buf[k * 2 + 1]) * 16 + fromhex (SR_buf[k * 2 + 2]); } @@ -797,7 +797,7 @@ es1800_fetch_registers (void) { error ("Emulator reply is too short: %s", buf); } - registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); + deprecated_registers[r++] = fromhex (buf[k * 2 + 1]) * 16 + fromhex (buf[k * 2 + 2]); } } } @@ -827,7 +827,7 @@ es1800_store_register (int regno) int k; unsigned char *r; - r = (unsigned char *) registers; + r = (unsigned char *) deprecated_registers; if (regno == -1) /* write all registers */ { @@ -1981,61 +1981,17 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; es1800_ops.to_open = es1800_open; es1800_ops.to_close = es1800_close; es1800_ops.to_attach = es1800_attach; - es1800_ops.to_post_attach = NULL; - es1800_ops.to_require_attach = NULL; es1800_ops.to_detach = es1800_detach; - es1800_ops.to_require_detach = NULL; es1800_ops.to_resume = es1800_resume; - es1800_ops.to_wait = NULL; - es1800_ops.to_post_wait = NULL; - es1800_ops.to_fetch_registers = NULL; - es1800_ops.to_store_registers = NULL; es1800_ops.to_prepare_to_store = es1800_prepare_to_store; es1800_ops.to_xfer_memory = es1800_xfer_inferior_memory; es1800_ops.to_files_info = es1800_files_info; es1800_ops.to_insert_breakpoint = es1800_insert_breakpoint; es1800_ops.to_remove_breakpoint = es1800_remove_breakpoint; - es1800_ops.to_terminal_init = NULL; - es1800_ops.to_terminal_inferior = NULL; - es1800_ops.to_terminal_ours_for_output = NULL; - es1800_ops.to_terminal_ours = NULL; - es1800_ops.to_terminal_info = NULL; - es1800_ops.to_kill = NULL; es1800_ops.to_load = es1800_load; - es1800_ops.to_lookup_symbol = NULL; es1800_ops.to_create_inferior = es1800_create_inferior; - es1800_ops.to_post_startup_inferior = NULL; - es1800_ops.to_acknowledge_created_inferior = NULL; - es1800_ops.to_clone_and_follow_inferior = NULL; - es1800_ops.to_post_follow_inferior_by_clone = NULL; - es1800_ops.to_insert_fork_catchpoint = NULL; - es1800_ops.to_remove_fork_catchpoint = NULL; - es1800_ops.to_insert_vfork_catchpoint = NULL; - es1800_ops.to_remove_vfork_catchpoint = NULL; - es1800_ops.to_has_forked = NULL; - es1800_ops.to_has_vforked = NULL; - es1800_ops.to_can_follow_vfork_prior_to_exec = NULL; - es1800_ops.to_post_follow_vfork = NULL; - es1800_ops.to_insert_exec_catchpoint = NULL; - es1800_ops.to_remove_exec_catchpoint = NULL; - es1800_ops.to_has_execd = NULL; - es1800_ops.to_reported_exec_events_per_exec_call = NULL; - es1800_ops.to_has_exited = NULL; - es1800_ops.to_mourn_inferior = NULL; - es1800_ops.to_can_run = 0; - es1800_ops.to_notice_signals = 0; - es1800_ops.to_thread_alive = 0; - es1800_ops.to_stop = 0; - es1800_ops.to_pid_to_exec_file = NULL; es1800_ops.to_stratum = core_stratum; - es1800_ops.DONT_USE = 0; - es1800_ops.to_has_all_memory = 0; es1800_ops.to_has_memory = 1; - es1800_ops.to_has_stack = 0; - es1800_ops.to_has_registers = 0; - es1800_ops.to_has_execution = 0; - es1800_ops.to_sections = NULL; - es1800_ops.to_sections_end = NULL; es1800_ops.to_magic = OPS_MAGIC; } @@ -2051,15 +2007,10 @@ init_es1800_child_ops (void) es1800_child_ops.to_doc = "Remote debugging on the es1800 emulator via a serial line.\n\ Specify the serial device it is connected to (e.g. /dev/ttya)."; es1800_child_ops.to_open = es1800_child_open; - es1800_child_ops.to_close = NULL; es1800_child_ops.to_attach = es1800_attach; - es1800_child_ops.to_post_attach = NULL; - es1800_child_ops.to_require_attach = NULL; es1800_child_ops.to_detach = es1800_child_detach; - es1800_child_ops.to_require_detach = NULL; es1800_child_ops.to_resume = es1800_resume; es1800_child_ops.to_wait = es1800_wait; - es1800_child_ops.to_post_wait = NULL; es1800_child_ops.to_fetch_registers = es1800_fetch_register; es1800_child_ops.to_store_registers = es1800_store_register; es1800_child_ops.to_prepare_to_store = es1800_prepare_to_store; @@ -2067,47 +2018,16 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; es1800_child_ops.to_files_info = es1800_files_info; es1800_child_ops.to_insert_breakpoint = es1800_insert_breakpoint; es1800_child_ops.to_remove_breakpoint = es1800_remove_breakpoint; - es1800_child_ops.to_terminal_init = NULL; - es1800_child_ops.to_terminal_inferior = NULL; - es1800_child_ops.to_terminal_ours_for_output = NULL; - es1800_child_ops.to_terminal_ours = NULL; - es1800_child_ops.to_terminal_info = NULL; es1800_child_ops.to_kill = es1800_kill; es1800_child_ops.to_load = es1800_load; - es1800_child_ops.to_lookup_symbol = NULL; es1800_child_ops.to_create_inferior = es1800_create_inferior; - es1800_child_ops.to_post_startup_inferior = NULL; - es1800_child_ops.to_acknowledge_created_inferior = NULL; - es1800_child_ops.to_clone_and_follow_inferior = NULL; - es1800_child_ops.to_post_follow_inferior_by_clone = NULL; - es1800_child_ops.to_insert_fork_catchpoint = NULL; - es1800_child_ops.to_remove_fork_catchpoint = NULL; - es1800_child_ops.to_insert_vfork_catchpoint = NULL; - es1800_child_ops.to_remove_vfork_catchpoint = NULL; - es1800_child_ops.to_has_forked = NULL; - es1800_child_ops.to_has_vforked = NULL; - es1800_child_ops.to_can_follow_vfork_prior_to_exec = NULL; - es1800_child_ops.to_post_follow_vfork = NULL; - es1800_child_ops.to_insert_exec_catchpoint = NULL; - es1800_child_ops.to_remove_exec_catchpoint = NULL; - es1800_child_ops.to_has_execd = NULL; - es1800_child_ops.to_reported_exec_events_per_exec_call = NULL; - es1800_child_ops.to_has_exited = NULL; es1800_child_ops.to_mourn_inferior = es1800_mourn_inferior; - es1800_child_ops.to_can_run = 0; - es1800_child_ops.to_notice_signals = 0; - es1800_child_ops.to_thread_alive = 0; - es1800_child_ops.to_stop = 0; - es1800_child_ops.to_pid_to_exec_file = NULL; es1800_child_ops.to_stratum = process_stratum; - es1800_child_ops.DONT_USE = 0; es1800_child_ops.to_has_all_memory = 1; es1800_child_ops.to_has_memory = 1; es1800_child_ops.to_has_stack = 1; es1800_child_ops.to_has_registers = 1; es1800_child_ops.to_has_execution = 1; - es1800_child_ops.to_sections = NULL; - es1800_child_ops.to_sections_end = NULL; es1800_child_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index a1df0eb..abd590b 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -3443,7 +3443,7 @@ mips_load (char *file, int from_tty) /* Work around problem where PMON monitor updates the PC after a load to a different value than GDB thinks it has. The following ensures that the write_pc() WILL update the PC value: */ - register_valid[PC_REGNUM] = 0; + deprecated_register_valid[PC_REGNUM] = 0; } if (exec_bfd) write_pc (bfd_get_start_address (exec_bfd)); diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index 228e3d9..a85fbb1 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -598,7 +598,7 @@ arm_rdi_store_registers (int regno) } else { - read_register_gen (regno, (char *) rawreg); + deprecated_read_register_gen (regno, (char *) rawreg); /* RDI manipulates data in host byte order, so convert now. */ store_unsigned_integer (rawerreg, 4, rawreg[0]); diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 34a42ab..20ed516 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -643,7 +643,7 @@ remote_rdp_store_register (int regno) else { char tmp[ARM_MAX_REGISTER_RAW_SIZE]; - read_register_gen (regno, tmp); + deprecated_read_register_gen (regno, tmp); if (regno < 15) rdp_store_one_register (1 << regno, tmp); else if (regno == ARM_PC_REGNUM) @@ -1383,13 +1383,8 @@ init_remote_rdp_ops (void) remote_rdp_ops.to_open = remote_rdp_open; remote_rdp_ops.to_close = remote_rdp_close; remote_rdp_ops.to_attach = remote_rdp_attach; - remote_rdp_ops.to_post_attach = NULL; - remote_rdp_ops.to_require_attach = NULL; - remote_rdp_ops.to_detach = NULL; - remote_rdp_ops.to_require_detach = NULL; remote_rdp_ops.to_resume = remote_rdp_resume; remote_rdp_ops.to_wait = remote_rdp_wait; - remote_rdp_ops.to_post_wait = NULL; remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register; remote_rdp_ops.to_store_registers = remote_rdp_store_register; remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store; @@ -1397,47 +1392,16 @@ init_remote_rdp_ops (void) remote_rdp_ops.to_files_info = remote_rdp_files_info; remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint; remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint; - remote_rdp_ops.to_terminal_init = NULL; - remote_rdp_ops.to_terminal_inferior = NULL; - remote_rdp_ops.to_terminal_ours_for_output = NULL; - remote_rdp_ops.to_terminal_ours = NULL; - remote_rdp_ops.to_terminal_info = NULL; remote_rdp_ops.to_kill = remote_rdp_kill; remote_rdp_ops.to_load = generic_load; - remote_rdp_ops.to_lookup_symbol = NULL; remote_rdp_ops.to_create_inferior = remote_rdp_create_inferior; - remote_rdp_ops.to_post_startup_inferior = NULL; - remote_rdp_ops.to_acknowledge_created_inferior = NULL; - remote_rdp_ops.to_clone_and_follow_inferior = NULL; - remote_rdp_ops.to_post_follow_inferior_by_clone = NULL; - remote_rdp_ops.to_insert_fork_catchpoint = NULL; - remote_rdp_ops.to_remove_fork_catchpoint = NULL; - remote_rdp_ops.to_insert_vfork_catchpoint = NULL; - remote_rdp_ops.to_remove_vfork_catchpoint = NULL; - remote_rdp_ops.to_has_forked = NULL; - remote_rdp_ops.to_has_vforked = NULL; - remote_rdp_ops.to_can_follow_vfork_prior_to_exec = NULL; - remote_rdp_ops.to_post_follow_vfork = NULL; - remote_rdp_ops.to_insert_exec_catchpoint = NULL; - remote_rdp_ops.to_remove_exec_catchpoint = NULL; - remote_rdp_ops.to_has_execd = NULL; - remote_rdp_ops.to_reported_exec_events_per_exec_call = NULL; - remote_rdp_ops.to_has_exited = NULL; remote_rdp_ops.to_mourn_inferior = generic_mourn_inferior; - remote_rdp_ops.to_can_run = NULL; - remote_rdp_ops.to_notice_signals = 0; - remote_rdp_ops.to_thread_alive = 0; - remote_rdp_ops.to_stop = 0; - remote_rdp_ops.to_pid_to_exec_file = NULL; remote_rdp_ops.to_stratum = process_stratum; - remote_rdp_ops.DONT_USE = NULL; remote_rdp_ops.to_has_all_memory = 1; remote_rdp_ops.to_has_memory = 1; remote_rdp_ops.to_has_stack = 1; remote_rdp_ops.to_has_registers = 1; remote_rdp_ops.to_has_execution = 1; - remote_rdp_ops.to_sections = NULL; - remote_rdp_ops.to_sections_end = NULL; remote_rdp_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c index 053b97a..6797d05 100644 --- a/gdb/remote-sds.c +++ b/gdb/remote-sds.c @@ -509,7 +509,7 @@ static void sds_prepare_to_store (void) { /* Make sure the entire registers array is valid. */ - read_register_bytes (0, (char *) NULL, REGISTER_BYTES); + deprecated_read_register_bytes (0, (char *) NULL, REGISTER_BYTES); } /* Store register REGNO, or all registers if REGNO == -1, from the contents @@ -528,7 +528,7 @@ sds_store_registers (int regno) *p++ = 0; *p++ = 0; for (i = 0; i < 4 * 6; i++) - *p++ = registers[i + 4 * 32 + 8 * 32]; + *p++ = deprecated_registers[i + 4 * 32 + 8 * 32]; for (i = 0; i < 4 * 1; i++) *p++ = 0; for (i = 0; i < 4 * 4; i++) @@ -543,7 +543,7 @@ sds_store_registers (int regno) *p++ = 0; *p++ = 0; for (i = 0; i < 4 * 32; i++) - *p++ = registers[i]; + *p++ = deprecated_registers[i]; sds_send (buf, p - buf); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 221efe4..3e2a7cd 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -361,7 +361,7 @@ gdbsim_store_register (int regno) { char tmp[MAX_REGISTER_RAW_SIZE]; int nr_bytes; - read_register_gen (regno, tmp); + deprecated_read_register_gen (regno, tmp); nr_bytes = sim_store_register (gdbsim_desc, REGISTER_SIM_REGNO (regno), tmp, REGISTER_RAW_SIZE (regno)); @@ -897,14 +897,9 @@ init_gdbsim_ops (void) gdbsim_ops.to_doc = "Use the compiled-in simulator."; gdbsim_ops.to_open = gdbsim_open; gdbsim_ops.to_close = gdbsim_close; - gdbsim_ops.to_attach = NULL; - gdbsim_ops.to_post_attach = NULL; - gdbsim_ops.to_require_attach = NULL; gdbsim_ops.to_detach = gdbsim_detach; - gdbsim_ops.to_require_detach = NULL; gdbsim_ops.to_resume = gdbsim_resume; gdbsim_ops.to_wait = gdbsim_wait; - gdbsim_ops.to_post_wait = NULL; gdbsim_ops.to_fetch_registers = gdbsim_fetch_register; gdbsim_ops.to_store_registers = gdbsim_store_register; gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store; @@ -912,47 +907,17 @@ init_gdbsim_ops (void) gdbsim_ops.to_files_info = gdbsim_files_info; gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint; gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint; - gdbsim_ops.to_terminal_init = NULL; - gdbsim_ops.to_terminal_inferior = NULL; - gdbsim_ops.to_terminal_ours_for_output = NULL; - gdbsim_ops.to_terminal_ours = NULL; - gdbsim_ops.to_terminal_info = NULL; gdbsim_ops.to_kill = gdbsim_kill; gdbsim_ops.to_load = gdbsim_load; - gdbsim_ops.to_lookup_symbol = NULL; gdbsim_ops.to_create_inferior = gdbsim_create_inferior; - gdbsim_ops.to_post_startup_inferior = NULL; - gdbsim_ops.to_acknowledge_created_inferior = NULL; - gdbsim_ops.to_clone_and_follow_inferior = NULL; - gdbsim_ops.to_post_follow_inferior_by_clone = NULL; - gdbsim_ops.to_insert_fork_catchpoint = NULL; - gdbsim_ops.to_remove_fork_catchpoint = NULL; - gdbsim_ops.to_insert_vfork_catchpoint = NULL; - gdbsim_ops.to_remove_vfork_catchpoint = NULL; - gdbsim_ops.to_has_forked = NULL; - gdbsim_ops.to_has_vforked = NULL; - gdbsim_ops.to_can_follow_vfork_prior_to_exec = NULL; - gdbsim_ops.to_post_follow_vfork = NULL; - gdbsim_ops.to_insert_exec_catchpoint = NULL; - gdbsim_ops.to_remove_exec_catchpoint = NULL; - gdbsim_ops.to_has_execd = NULL; - gdbsim_ops.to_reported_exec_events_per_exec_call = NULL; - gdbsim_ops.to_has_exited = NULL; gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior; - gdbsim_ops.to_can_run = 0; - gdbsim_ops.to_notice_signals = 0; - gdbsim_ops.to_thread_alive = 0; gdbsim_ops.to_stop = gdbsim_stop; - gdbsim_ops.to_pid_to_exec_file = NULL; gdbsim_ops.to_stratum = process_stratum; - gdbsim_ops.DONT_USE = NULL; gdbsim_ops.to_has_all_memory = 1; gdbsim_ops.to_has_memory = 1; gdbsim_ops.to_has_stack = 1; gdbsim_ops.to_has_registers = 1; gdbsim_ops.to_has_execution = 1; - gdbsim_ops.to_sections = NULL; - gdbsim_ops.to_sections_end = NULL; gdbsim_ops.to_magic = OPS_MAGIC; #ifdef TARGET_REDEFINE_DEFAULT_OPS diff --git a/gdb/remote-st.c b/gdb/remote-st.c index c27ddeb..7c452a2 100644 --- a/gdb/remote-st.c +++ b/gdb/remote-st.c @@ -767,14 +767,9 @@ Arguments are the name of the device for the serial line,\n\ the speed to connect at in bits per second."; st2000_ops.to_open = st2000_open; st2000_ops.to_close = st2000_close; - st2000_ops.to_attach = 0; - st2000_run_ops.to_post_attach = NULL; - st2000_ops.to_require_attach = NULL; st2000_ops.to_detach = st2000_detach; - st2000_ops.to_require_detach = NULL; st2000_ops.to_resume = st2000_resume; st2000_ops.to_wait = st2000_wait; - st2000_ops.to_post_wait = NULL; st2000_ops.to_fetch_registers = st2000_fetch_register; st2000_ops.to_store_registers = st2000_store_register; st2000_ops.to_prepare_to_store = st2000_prepare_to_store; @@ -782,47 +777,15 @@ the speed to connect at in bits per second."; st2000_ops.to_files_info = st2000_files_info; st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint; st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint; /* Breakpoints */ - st2000_ops.to_terminal_init = 0; - st2000_ops.to_terminal_inferior = 0; - st2000_ops.to_terminal_ours_for_output = 0; - st2000_ops.to_terminal_ours = 0; - st2000_ops.to_terminal_info = 0; /* Terminal handling */ st2000_ops.to_kill = st2000_kill; - st2000_ops.to_load = 0; /* load */ - st2000_ops.to_lookup_symbol = 0; /* lookup_symbol */ st2000_ops.to_create_inferior = st2000_create_inferior; - st2000_ops.to_post_startup_inferior = NULL; - st2000_ops.to_acknowledge_created_inferior = NULL; - st2000_ops.to_clone_and_follow_inferior = NULL; - st2000_ops.to_post_follow_inferior_by_clone = NULL; - st2000_run_ops.to_insert_fork_catchpoint = NULL; - st2000_run_ops.to_remove_fork_catchpoint = NULL; - st2000_run_ops.to_insert_vfork_catchpoint = NULL; - st2000_run_ops.to_remove_vfork_catchpoint = NULL; - st2000_ops.to_has_forked = NULL; - st2000_ops.to_has_vforked = NULL; - st2000_run_ops.to_can_follow_vfork_prior_to_exec = NULL; - st2000_ops.to_post_follow_vfork = NULL; - st2000_run_ops.to_insert_exec_catchpoint = NULL; - st2000_run_ops.to_remove_exec_catchpoint = NULL; - st2000_run_ops.to_has_execd = NULL; - st2000_run_ops.to_reported_exec_events_per_exec_call = NULL; - st2000_run_ops.to_has_exited = NULL; st2000_ops.to_mourn_inferior = st2000_mourn_inferior; - st2000_ops.to_can_run = 0; /* can_run */ - st2000_ops.to_notice_signals = 0; /* notice_signals */ - st2000_ops.to_thread_alive = 0; /* thread alive */ - st2000_ops.to_stop = 0; /* to_stop */ - st2000_ops.to_pid_to_exec_file = NULL; st2000_ops.to_stratum = process_stratum; - st2000_ops.DONT_USE = 0; /* next */ st2000_ops.to_has_all_memory = 1; st2000_ops.to_has_memory = 1; st2000_ops.to_has_stack = 1; st2000_ops.to_has_registers = 1; st2000_ops.to_has_execution = 1; /* all mem, mem, stack, regs, exec */ - st2000_ops.to_sections = 0; - st2000_ops.to_sections_end = 0; /* Section pointers */ st2000_ops.to_magic = OPS_MAGIC; /* Always the last thing */ }; diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 5ec4df4..0bd8c52 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -466,7 +466,7 @@ static void vx_prepare_to_store (void) { /* Fetch all registers, if any of them are not yet fetched. */ - read_register_bytes (0, NULL, REGISTER_BYTES); + deprecated_read_register_bytes (0, NULL, REGISTER_BYTES); } /* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR @@ -820,7 +820,7 @@ net_get_symbols (ldtabl *pLoadTable) Returns status of symbol read on target side (0=success, -1=fail) Returns -1 and complain()s if rpc fails. */ -struct complaint cant_contact_target = +struct deprecated_complaint cant_contact_target = {"Lost contact with VxWorks target", 0, 0}; static int diff --git a/gdb/remote-vx68.c b/gdb/remote-vx68.c index 2ebaa63..e7f138d 100644 --- a/gdb/remote-vx68.c +++ b/gdb/remote-vx68.c @@ -30,7 +30,7 @@ #include "gdbcore.h" #include "command.h" #include "symtab.h" -#include "symfile.h" /* for struct complaint */ +#include "symfile.h" #include "regcache.h" #include "gdb_string.h" @@ -85,10 +85,13 @@ vx_read_register (int regno) net_read_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_GETREGS); - bcopy (&mc68k_greg_packet[MC68K_R_D0], registers, 16 * MC68K_GREG_SIZE); - bcopy (&mc68k_greg_packet[MC68K_R_SR], ®isters[REGISTER_BYTE (PS_REGNUM)], + bcopy (&mc68k_greg_packet[MC68K_R_D0], deprecated_registers, + 16 * MC68K_GREG_SIZE); + bcopy (&mc68k_greg_packet[MC68K_R_SR], + &deprecated_registers[REGISTER_BYTE (PS_REGNUM)], MC68K_GREG_SIZE); - bcopy (&mc68k_greg_packet[MC68K_R_PC], ®isters[REGISTER_BYTE (PC_REGNUM)], + bcopy (&mc68k_greg_packet[MC68K_R_PC], + &deprecated_registers[REGISTER_BYTE (PC_REGNUM)], MC68K_GREG_SIZE); /* Get floating-point registers, if the target system has them. @@ -100,23 +103,23 @@ vx_read_register (int regno) PTRACE_GETFPREGS); bcopy (&mc68k_fpreg_packet[MC68K_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], MC68K_FPREG_SIZE * 8); bcopy (&mc68k_fpreg_packet[MC68K_R_FPCR], - ®isters[REGISTER_BYTE (FPC_REGNUM)], + &deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); } else { - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], + bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], MC68K_FPREG_SIZE * 8); - bzero (®isters[REGISTER_BYTE (FPC_REGNUM)], + bzero (&deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); } /* Mark the register cache valid. */ - registers_fetched (); + deprecated_registers_fetched (); } /* Store a register or registers into the VxWorks target. @@ -131,10 +134,11 @@ vx_write_register (int regno) /* Store general-purpose registers. */ - bcopy (registers, &mc68k_greg_packet[MC68K_R_D0], 16 * MC68K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PS_REGNUM)], + bcopy (deprecated_registers, &mc68k_greg_packet[MC68K_R_D0], + 16 * MC68K_GREG_SIZE); + bcopy (&deprecated_registers[REGISTER_BYTE (PS_REGNUM)], &mc68k_greg_packet[MC68K_R_SR], MC68K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PC_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)], &mc68k_greg_packet[MC68K_R_PC], MC68K_GREG_SIZE); net_write_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_SETREGS); @@ -143,10 +147,10 @@ vx_write_register (int regno) if (target_has_fp) { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &mc68k_fpreg_packet[MC68K_R_FP0], MC68K_FPREG_SIZE * 8); - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], &mc68k_fpreg_packet[MC68K_R_FPCR], MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8)); diff --git a/gdb/remote-vxmips.c b/gdb/remote-vxmips.c index 8be4a2f..441bd9b 100644 --- a/gdb/remote-vxmips.c +++ b/gdb/remote-vxmips.c @@ -30,7 +30,7 @@ #include "gdbcore.h" #include "command.h" #include "symtab.h" -#include "symfile.h" /* for struct complaint */ +#include "symfile.h" #include "regcache.h" #include "gdb_string.h" @@ -103,18 +103,19 @@ vx_read_register (int regno) /* Copy the general registers. */ - bcopy (&mips_greg_packet[MIPS_R_GP0], ®isters[0], 32 * MIPS_GREG_SIZE); + bcopy (&mips_greg_packet[MIPS_R_GP0], &deprecated_registers[0], + 32 * MIPS_GREG_SIZE); /* Copy SR, LO, HI, and PC. */ bcopy (&mips_greg_packet[MIPS_R_SR], - ®isters[REGISTER_BYTE (PS_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (PS_REGNUM)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_LO], - ®isters[REGISTER_BYTE (LO_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (LO_REGNUM)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_HI], - ®isters[REGISTER_BYTE (HI_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (HI_REGNUM)], MIPS_GREG_SIZE); bcopy (&mips_greg_packet[MIPS_R_PC], - ®isters[REGISTER_BYTE (PC_REGNUM)], MIPS_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (PC_REGNUM)], MIPS_GREG_SIZE); /* If the target has floating point registers, fetch them. Otherwise, zero the floating point register values in @@ -129,26 +130,26 @@ vx_read_register (int regno) /* Copy the floating point registers. */ bcopy (&mips_fpreg_packet[MIPS_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], REGISTER_RAW_SIZE (FP0_REGNUM) * 32); /* Copy the floating point control/status register (fpcsr). */ bcopy (&mips_fpreg_packet[MIPS_R_FPCSR], - ®isters[REGISTER_BYTE (FCRCS_REGNUM)], + &deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)], REGISTER_RAW_SIZE (FCRCS_REGNUM)); } else { - bzero ((char *) ®isters[REGISTER_BYTE (FP0_REGNUM)], + bzero ((char *) &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], REGISTER_RAW_SIZE (FP0_REGNUM) * 32); - bzero ((char *) ®isters[REGISTER_BYTE (FCRCS_REGNUM)], + bzero ((char *) &deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)], REGISTER_RAW_SIZE (FCRCS_REGNUM)); } /* Mark the register cache valid. */ - registers_fetched (); + deprecated_registers_fetched (); } /* Store a register or registers into the VxWorks target. @@ -162,17 +163,18 @@ vx_write_register (int regno) /* Store general registers. */ - bcopy (®isters[0], &mips_greg_packet[MIPS_R_GP0], 32 * MIPS_GREG_SIZE); + bcopy (&deprecated_registers[0], &mips_greg_packet[MIPS_R_GP0], + 32 * MIPS_GREG_SIZE); /* Copy SR, LO, HI, and PC. */ - bcopy (®isters[REGISTER_BYTE (PS_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (PS_REGNUM)], &mips_greg_packet[MIPS_R_SR], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (LO_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (LO_REGNUM)], &mips_greg_packet[MIPS_R_LO], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (HI_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (HI_REGNUM)], &mips_greg_packet[MIPS_R_HI], MIPS_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (PC_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)], &mips_greg_packet[MIPS_R_PC], MIPS_GREG_SIZE); net_write_registers (mips_greg_packet, MIPS_GREG_PLEN, PTRACE_SETREGS); @@ -183,13 +185,13 @@ vx_write_register (int regno) { /* Copy the floating point data registers. */ - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &mips_fpreg_packet[MIPS_R_FP0], REGISTER_RAW_SIZE (FP0_REGNUM) * 32); /* Copy the floating point control/status register (fpcsr). */ - bcopy (®isters[REGISTER_BYTE (FCRCS_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FCRCS_REGNUM)], &mips_fpreg_packet[MIPS_R_FPCSR], REGISTER_RAW_SIZE (FCRCS_REGNUM)); diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c index 294e940..eb59b9f 100644 --- a/gdb/remote-vxsparc.c +++ b/gdb/remote-vxsparc.c @@ -30,7 +30,7 @@ #include "gdbcore.h" #include "command.h" #include "symtab.h" -#include "symfile.h" /* for struct complaint */ +#include "symfile.h" #include "regcache.h" #include "gdb_string.h" @@ -92,18 +92,19 @@ vx_read_register (int regno) as defined in "tm-sparc.h". */ bcopy (&sparc_greg_packet[SPARC_R_G0], - ®isters[REGISTER_BYTE (G0_REGNUM)], 32 * SPARC_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (G0_REGNUM)], + 32 * SPARC_GREG_SIZE); bcopy (&sparc_greg_packet[SPARC_R_Y], - ®isters[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); + &deprecated_registers[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); /* Now write the local and in registers to the register window spill area in the frame. VxWorks does not do this for the active frame automatically; it greatly simplifies debugging (FRAME_FIND_SAVED_REGS, in particular, depends on this). */ - sp = extract_address (®isters[REGISTER_BYTE (SP_REGNUM)], + sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)], REGISTER_RAW_SIZE (SP_REGNUM)); - write_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], + write_memory (sp, &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM)); /* If the target has floating point registers, fetch them. @@ -116,19 +117,23 @@ vx_read_register (int regno) net_read_registers (sparc_fpreg_packet, SPARC_FPREG_PLEN, PTRACE_GETFPREGS); bcopy (&sparc_fpreg_packet[SPARC_R_FP0], - ®isters[REGISTER_BYTE (FP0_REGNUM)], 32 * SPARC_FPREG_SIZE); + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + 32 * SPARC_FPREG_SIZE); bcopy (&sparc_fpreg_packet[SPARC_R_FSR], - ®isters[REGISTER_BYTE (FPS_REGNUM)], 1 * SPARC_FPREG_SIZE); + &deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + 1 * SPARC_FPREG_SIZE); } else { - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], 32 * SPARC_FPREG_SIZE); - bzero (®isters[REGISTER_BYTE (FPS_REGNUM)], 1 * SPARC_FPREG_SIZE); + bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + 32 * SPARC_FPREG_SIZE); + bzero (&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + 1 * SPARC_FPREG_SIZE); } /* Mark the register cache valid. */ - registers_fetched (); + deprecated_registers_fetched (); } /* Store a register or registers into the VxWorks target. @@ -160,9 +165,9 @@ vx_write_register (int regno) } if (in_gp_regs) { - bcopy (®isters[REGISTER_BYTE (G0_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (G0_REGNUM)], &sparc_greg_packet[SPARC_R_G0], 32 * SPARC_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (Y_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (Y_REGNUM)], &sparc_greg_packet[SPARC_R_Y], 6 * SPARC_GREG_SIZE); net_write_registers (sparc_greg_packet, SPARC_GREG_PLEN, PTRACE_SETREGS); @@ -172,9 +177,9 @@ vx_write_register (int regno) if (regno < 0 || (L0_REGNUM <= regno && regno <= I7_REGNUM)) { - sp = extract_address (®isters[REGISTER_BYTE (SP_REGNUM)], + sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)], REGISTER_RAW_SIZE (SP_REGNUM)); - write_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], + write_memory (sp, &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM)); } } @@ -183,9 +188,9 @@ vx_write_register (int regno) if (in_fp_regs && target_has_fp) { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &sparc_fpreg_packet[SPARC_R_FP0], 32 * SPARC_FPREG_SIZE); - bcopy (®isters[REGISTER_BYTE (FPS_REGNUM)], + bcopy (&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], &sparc_fpreg_packet[SPARC_R_FSR], 1 * SPARC_FPREG_SIZE); net_write_registers (sparc_fpreg_packet, SPARC_FPREG_PLEN, diff --git a/gdb/remote.c b/gdb/remote.c index 1584d6b..d47dad7 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3528,7 +3528,8 @@ remote_prepare_to_store (void) /* NOTE: This isn't rs->sizeof_g_packet because here, we are forcing the register cache to read its and not the target registers. */ - read_register_bytes (0, (char *) NULL, REGISTER_BYTES); /* OK use. */ + deprecated_read_register_bytes (0, (char *) NULL, + REGISTER_BYTES); /* OK use. */ break; case PACKET_ENABLE: break; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 53b9dd3..26f5e4c 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -966,7 +966,7 @@ rs6000_pop_frame (void) } /* Make sure that all registers are valid. */ - read_register_bytes (0, NULL, REGISTER_BYTES); + deprecated_read_register_bytes (0, NULL, REGISTER_BYTES); /* Figure out previous %pc value. If the function is frameless, it is still in the link register, otherwise walk the frames and retrieve the @@ -995,7 +995,8 @@ rs6000_pop_frame (void) addr = prev_sp + fdata.gpr_offset; for (ii = fdata.saved_gpr; ii <= 31; ++ii) { - read_memory (addr, ®isters[REGISTER_BYTE (ii)], wordsize); + read_memory (addr, &deprecated_registers[REGISTER_BYTE (ii)], + wordsize); addr += wordsize; } } @@ -1005,7 +1006,7 @@ rs6000_pop_frame (void) addr = prev_sp + fdata.fpr_offset; for (ii = fdata.saved_fpr; ii <= 31; ++ii) { - read_memory (addr, ®isters[REGISTER_BYTE (ii + FP0_REGNUM)], 8); + read_memory (addr, &deprecated_registers[REGISTER_BYTE (ii + FP0_REGNUM)], 8); addr += 8; } } @@ -1122,7 +1123,7 @@ rs6000_push_arguments (int nargs, struct value **args, CORE_ADDR sp, printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg), len); ++f_argno; @@ -1134,8 +1135,9 @@ rs6000_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* Argument takes more than one register. */ while (argbytes < len) { - memset (®isters[REGISTER_BYTE (ii + 3)], 0, reg_size); - memcpy (®isters[REGISTER_BYTE (ii + 3)], + memset (&deprecated_registers[REGISTER_BYTE (ii + 3)], 0, + reg_size); + memcpy (&deprecated_registers[REGISTER_BYTE (ii + 3)], ((char *) VALUE_CONTENTS (arg)) + argbytes, (len - argbytes) > reg_size ? reg_size : len - argbytes); @@ -1151,8 +1153,8 @@ rs6000_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { /* Argument can fit in one register. No problem. */ int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0; - memset (®isters[REGISTER_BYTE (ii + 3)], 0, reg_size); - memcpy ((char *)®isters[REGISTER_BYTE (ii + 3)] + adj, + memset (&deprecated_registers[REGISTER_BYTE (ii + 3)], 0, reg_size); + memcpy ((char *)&deprecated_registers[REGISTER_BYTE (ii + 3)] + adj, VALUE_CONTENTS (arg), len); } ++argno; @@ -1234,7 +1236,7 @@ ran_out_of_registers_for_arguments: printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg), len); ++f_argno; @@ -2014,7 +2016,7 @@ e500_store_return_value (struct type *type, char *valbuf) memcpy (reg_val_buf, valbuf + copied, reg_size); copied += reg_size; - write_register_gen (regnum, reg_val_buf); + deprecated_write_register_gen (regnum, reg_val_buf); i++; } } @@ -2030,19 +2032,19 @@ rs6000_store_return_value (struct type *type, char *valbuf) Say a double_double_double type could be returned in FPR1/FPR2/FPR3 triple. */ - write_register_bytes (REGISTER_BYTE (FP0_REGNUM + 1), valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM + 1), valbuf, + TYPE_LENGTH (type)); else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type)) - write_register_bytes (REGISTER_BYTE (tdep->ppc_vr0_regnum + 2), - valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (tdep->ppc_vr0_regnum + 2), + valbuf, TYPE_LENGTH (type)); } else /* Everything else is returned in GPR3 and up. */ - write_register_bytes (REGISTER_BYTE (gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + 3), - valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + 3), + valbuf, TYPE_LENGTH (type)); } /* Extract from an array REGBUF containing the (raw) register state diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index f19e4dd..94defe5 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1150,8 +1150,8 @@ s390_store_return_value (struct type *valtype, char *valbuf) { if (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8) - write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM), valbuf, - TYPE_LENGTH (valtype)); + deprecated_write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM), + valbuf, TYPE_LENGTH (valtype)); else error ("GDB is unable to return `long double' values " "on this architecture."); @@ -1161,8 +1161,8 @@ s390_store_return_value (struct type *valtype, char *valbuf) value = s390_promote_integer_argument (valtype, valbuf, reg_buff, &arglen); /* Everything else is returned in GPR2 and up. */ - write_register_bytes (REGISTER_BYTE (S390_GP0_REGNUM + 2), value, - arglen); + deprecated_write_register_bytes (REGISTER_BYTE (S390_GP0_REGNUM + 2), + value, arglen); } } static int @@ -1575,9 +1575,9 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { /* When we store a single-precision value in an FP register, it occupies the leftmost bits. */ - write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM + fr), - VALUE_CONTENTS (arg), - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM + fr), + VALUE_CONTENTS (arg), + TYPE_LENGTH (type)); fr += 2; } else if (is_simple_arg (type) @@ -1595,10 +1595,10 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, else if (is_double_arg (type) && gr <= 5) { - write_register_gen (S390_GP0_REGNUM + gr, - VALUE_CONTENTS (arg)); - write_register_gen (S390_GP0_REGNUM + gr + 1, - VALUE_CONTENTS (arg) + 4); + deprecated_write_register_gen (S390_GP0_REGNUM + gr, + VALUE_CONTENTS (arg)); + deprecated_write_register_gen (S390_GP0_REGNUM + gr + 1, + VALUE_CONTENTS (arg) + 4); gr += 2; } else diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index c5e5bf4..3d6c488 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1874,7 +1874,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, if (addrp) *addrp = REGISTER_BYTE (live_regnum); if (raw_buffer) - read_register_gen (live_regnum, raw_buffer); + deprecated_read_register_gen (live_regnum, raw_buffer); } /* Extract from an array REGBUF containing the (raw) register state @@ -2223,7 +2223,8 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (float_arg_index <= tdep->FLOAT_ARGLAST_REGNUM) { /* Goes in FR0...FR11 */ - write_register_gen (FP0_REGNUM + float_arg_index, val); + deprecated_write_register_gen (FP0_REGNUM + float_arg_index, + val); fp_args[float_arg_index] = 1; /* Skip the corresponding general argument register. */ int_argreg ++; @@ -2266,7 +2267,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, call the gdbarch function to do register writes, and that will properly know how to deal with pseudoregs. */ - write_register_gen (regnum, val); + deprecated_write_register_gen (regnum, val); fp_args[double_arg_index] = 1; fp_args[double_arg_index + 1] = 1; /* Skip the corresponding general argument register. */ @@ -2472,20 +2473,20 @@ sh_default_store_return_value (struct type *type, char *valbuf) valbuf, TYPE_LENGTH (type)); else memcpy (buf, valbuf, TYPE_LENGTH (type)); - write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, - REGISTER_RAW_SIZE (R0_REGNUM)); + deprecated_write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, + REGISTER_RAW_SIZE (R0_REGNUM)); } else - write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf, + TYPE_LENGTH (type)); } static void sh3e_sh4_store_return_value (struct type *type, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_FLT) - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), - valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), + valbuf, TYPE_LENGTH (type)); else sh_default_store_return_value (type, valbuf); } @@ -2501,7 +2502,7 @@ sh64_store_return_value (struct type *type, char *valbuf) if (len == 4) { /* Return value stored in FP0_REGNUM */ - write_register_gen (FP0_REGNUM, valbuf); + deprecated_write_register_gen (FP0_REGNUM, valbuf); } if (len == 8) { @@ -2524,10 +2525,10 @@ sh64_store_return_value (struct type *type, char *valbuf) offset = REGISTER_RAW_SIZE (return_register) - len; memcpy (buf + offset, valbuf, len); - write_register_gen (return_register, buf); + deprecated_write_register_gen (return_register, buf); } else - write_register_gen (return_register, valbuf); + deprecated_write_register_gen (return_register, valbuf); } } @@ -4289,10 +4290,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, 16); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4); - set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info); + set_gdbarch_deprecated_do_registers_info (gdbarch, sh_do_registers_info); set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc); set_gdbarch_frame_chain (gdbarch, sh_frame_chain); - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info); set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value); set_gdbarch_push_arguments (gdbarch, sh_push_arguments); @@ -4516,7 +4517,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write); - set_gdbarch_do_registers_info (gdbarch, sh64_do_registers_info); + set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info); set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs); set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc); set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info); diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 35cb578..13b9580 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -648,7 +648,8 @@ sol_thread_store_registers (int regno) { /* Not writing all the regs */ /* save new register value */ char* old_value = (char*) alloca (REGISTER_SIZE); - memcpy (old_value, ®isters[REGISTER_BYTE (regno)], REGISTER_SIZE); + memcpy (old_value, &deprecated_registers[REGISTER_BYTE (regno)], + REGISTER_SIZE); val = p_td_thr_getgregs (&thandle, gregset); if (val != TD_OK) @@ -660,7 +661,8 @@ sol_thread_store_registers (int regno) td_err_string (val)); /* restore new register value */ - memcpy (®isters[REGISTER_BYTE (regno)], old_value, REGISTER_SIZE); + memcpy (&deprecated_registers[REGISTER_BYTE (regno)], old_value, + REGISTER_SIZE); #if 0 /* thread_db doesn't seem to handle this right */ @@ -1540,7 +1542,6 @@ init_sol_thread_ops (void) sol_thread_ops.to_longname = "Solaris threads and pthread."; sol_thread_ops.to_doc = "Solaris threads and pthread support."; sol_thread_ops.to_open = sol_thread_open; - sol_thread_ops.to_close = 0; sol_thread_ops.to_attach = sol_thread_attach; sol_thread_ops.to_detach = sol_thread_detach; sol_thread_ops.to_resume = sol_thread_resume; @@ -1559,8 +1560,6 @@ init_sol_thread_ops (void) sol_thread_ops.to_terminal_save_ours = terminal_save_ours; sol_thread_ops.to_terminal_info = child_terminal_info; sol_thread_ops.to_kill = sol_thread_kill_inferior; - sol_thread_ops.to_load = 0; - sol_thread_ops.to_lookup_symbol = 0; sol_thread_ops.to_create_inferior = sol_thread_create_inferior; sol_thread_ops.to_mourn_inferior = sol_thread_mourn_inferior; sol_thread_ops.to_can_run = sol_thread_can_run; @@ -1576,8 +1575,6 @@ init_sol_thread_ops (void) sol_thread_ops.to_has_registers = 1; sol_thread_ops.to_has_execution = 1; sol_thread_ops.to_has_thread_control = tc_none; - sol_thread_ops.to_sections = 0; - sol_thread_ops.to_sections_end = 0; sol_thread_ops.to_find_memory_regions = sol_find_memory_regions; sol_thread_ops.to_make_corefile_notes = sol_make_note_section; sol_thread_ops.to_magic = OPS_MAGIC; @@ -1594,30 +1591,16 @@ init_sol_core_ops (void) sol_core_ops.to_close = sol_core_close; sol_core_ops.to_attach = sol_thread_attach; sol_core_ops.to_detach = sol_core_detach; - /* sol_core_ops.to_resume = 0; */ - /* sol_core_ops.to_wait = 0; */ sol_core_ops.to_fetch_registers = sol_thread_fetch_registers; - /* sol_core_ops.to_store_registers = 0; */ - /* sol_core_ops.to_prepare_to_store = 0; */ sol_core_ops.to_xfer_memory = sol_thread_xfer_memory; sol_core_ops.to_files_info = sol_core_files_info; sol_core_ops.to_insert_breakpoint = ignore; sol_core_ops.to_remove_breakpoint = ignore; - /* sol_core_ops.to_terminal_init = 0; */ - /* sol_core_ops.to_terminal_inferior = 0; */ - /* sol_core_ops.to_terminal_ours_for_output = 0; */ - /* sol_core_ops.to_terminal_ours = 0; */ - /* sol_core_ops.to_terminal_info = 0; */ - /* sol_core_ops.to_kill = 0; */ - /* sol_core_ops.to_load = 0; */ - /* sol_core_ops.to_lookup_symbol = 0; */ sol_core_ops.to_create_inferior = sol_thread_create_inferior; sol_core_ops.to_stratum = core_stratum; - sol_core_ops.to_has_all_memory = 0; sol_core_ops.to_has_memory = 1; sol_core_ops.to_has_stack = 1; sol_core_ops.to_has_registers = 1; - sol_core_ops.to_has_execution = 0; sol_core_ops.to_has_thread_control = tc_none; sol_core_ops.to_thread_alive = sol_thread_alive; sol_core_ops.to_pid_to_str = solaris_pid_to_str; @@ -1626,8 +1609,6 @@ init_sol_core_ops (void) <n> in procinfo list" where <n> is the pid of the process that produced the core file. Disable it for now. */ /* sol_core_ops.to_find_new_threads = sol_find_new_threads; */ - sol_core_ops.to_sections = 0; - sol_core_ops.to_sections_end = 0; sol_core_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index e892fe8..b2c6d41 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -73,31 +73,34 @@ fetch_inferior_registers (int regno) to the stack pointer. */ if (regno < O7_REGNUM /* including -1 */ || regno >= Y_REGNUM - || (!register_valid[SP_REGNUM] && regno < I7_REGNUM)) + || (!deprecated_register_valid[SP_REGNUM] && regno < I7_REGNUM)) { if (0 != ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, 0)) perror ("ptrace_getregs"); - registers[REGISTER_BYTE (0)] = 0; - memcpy (®isters[REGISTER_BYTE (1)], &inferior_registers.r_g1, - 15 * REGISTER_RAW_SIZE (G0_REGNUM)); - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; - *(int *) ®isters[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc; + deprecated_registers[REGISTER_BYTE (0)] = 0; + memcpy (&deprecated_registers[REGISTER_BYTE (1)], + &inferior_registers.r_g1, 15 * REGISTER_RAW_SIZE (G0_REGNUM)); + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)] + = inferior_registers.r_ps; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)] + = inferior_registers.r_pc; + *(int *) &deprecated_registers[REGISTER_BYTE (NPC_REGNUM)] + = inferior_registers.r_npc; *(int *) ®isters[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y; for (i = G0_REGNUM; i <= O7_REGNUM; i++) - register_valid[i] = 1; - register_valid[Y_REGNUM] = 1; - register_valid[PS_REGNUM] = 1; - register_valid[PC_REGNUM] = 1; - register_valid[NPC_REGNUM] = 1; + deprecated_register_valid[i] = 1; + deprecated_register_valid[Y_REGNUM] = 1; + deprecated_register_valid[PS_REGNUM] = 1; + deprecated_register_valid[PC_REGNUM] = 1; + deprecated_register_valid[NPC_REGNUM] = 1; /* If we don't set these valid, read_register_bytes() rereads all the regs every time it is called! FIXME. */ - register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */ + deprecated_register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */ + deprecated_register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */ + deprecated_register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */ } /* Floating point registers */ @@ -109,35 +112,34 @@ fetch_inferior_registers (int regno) (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0)) perror ("ptrace_getfpregs"); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fpu_fr); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], - &inferior_fp_registers.Fpu_fsr, - sizeof (FPU_FSR_TYPE)); + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + &inferior_fp_registers, sizeof inferior_fp_registers.fpu_fr); + memcpy (&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + &inferior_fp_registers.Fpu_fsr, sizeof (FPU_FSR_TYPE)); for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) - register_valid[i] = 1; - register_valid[FPS_REGNUM] = 1; + deprecated_register_valid[i] = 1; + deprecated_register_valid[FPS_REGNUM] = 1; } /* These regs are saved on the stack by the kernel. Only read them all (16 ptrace calls!) if we really need them. */ if (regno == -1) { - CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)]; - target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], + CORE_ADDR sp = *(unsigned int *) & deprecated_registers[REGISTER_BYTE (SP_REGNUM)]; + target_read_memory (sp, &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM)); for (i = L0_REGNUM; i <= I7_REGNUM; i++) - register_valid[i] = 1; + deprecated_register_valid[i] = 1; } else if (regno >= L0_REGNUM && regno <= I7_REGNUM) { - CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)]; + CORE_ADDR sp = *(unsigned int *) & deprecated_registers[REGISTER_BYTE (SP_REGNUM)]; i = REGISTER_BYTE (regno); - if (register_valid[regno]) + if (deprecated_register_valid[regno]) printf_unfiltered ("register %d valid and read\n", regno); target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM), - ®isters[i], REGISTER_RAW_SIZE (regno)); - register_valid[regno] = 1; + &deprecated_registers[i], REGISTER_RAW_SIZE (regno)); + deprecated_register_valid[regno] = 1; } } @@ -195,22 +197,22 @@ store_inferior_registers (int regno) if (wanna_store & STACK_REGS) { - CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)]; + CORE_ADDR sp = *(unsigned int *) & deprecated_registers[REGISTER_BYTE (SP_REGNUM)]; if (regno < 0 || regno == SP_REGNUM) { - if (!register_valid[L0_REGNUM + 5]) + if (!deprecated_register_valid[L0_REGNUM + 5]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], + &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM)); } else { - if (!register_valid[regno]) + if (!deprecated_register_valid[regno]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM), - ®isters[REGISTER_BYTE (regno)], + &deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); } @@ -218,20 +220,21 @@ store_inferior_registers (int regno) if (wanna_store & INT_REGS) { - if (!register_valid[G1_REGNUM]) + if (!deprecated_register_valid[G1_REGNUM]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); - memcpy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE (G1_REGNUM)], + memcpy (&inferior_registers.r_g1, + &deprecated_registers[REGISTER_BYTE (G1_REGNUM)], 15 * REGISTER_RAW_SIZE (G1_REGNUM)); inferior_registers.r_ps = - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)]; + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)]; inferior_registers.r_pc = - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; inferior_registers.r_npc = - *(int *) ®isters[REGISTER_BYTE (NPC_REGNUM)]; + *(int *) &deprecated_registers[REGISTER_BYTE (NPC_REGNUM)]; inferior_registers.r_y = - *(int *) ®isters[REGISTER_BYTE (Y_REGNUM)]; + *(int *) &deprecated_registers[REGISTER_BYTE (Y_REGNUM)]; if (0 != ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers, 0)) @@ -240,12 +243,14 @@ store_inferior_registers (int regno) if (wanna_store & FP_REGS) { - if (!register_valid[FP0_REGNUM + 9]) + if (!deprecated_register_valid[FP0_REGNUM + 9]) internal_error (__FILE__, __LINE__, "failed internal consistency check"); - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (&inferior_fp_registers, + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], sizeof inferior_fp_registers.fpu_fr); memcpy (&inferior_fp_registers.Fpu_fsr, - ®isters[REGISTER_BYTE (FPS_REGNUM)], sizeof (FPU_FSR_TYPE)); + &deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + sizeof (FPU_FSR_TYPE)); if (0 != ptrace (PTRACE_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0)) @@ -277,15 +282,15 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, #define gregs ((struct regs *)core_reg_sect) /* G0 *always* holds 0. */ - *(int *) ®isters[REGISTER_BYTE (0)] = 0; + *(int *) &deprecated_registers[REGISTER_BYTE (0)] = 0; /* The globals and output registers. */ - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, + memcpy (&deprecated_registers[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; - *(int *) ®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; - *(int *) ®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; + *(int *) &deprecated_registers[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; + *(int *) &deprecated_registers[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; /* My best guess at where to get the locals and input registers is exactly where they usually are, right above @@ -295,8 +300,9 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, { int sp; - sp = *(int *) ®isters[REGISTER_BYTE (SP_REGNUM)]; - if (0 != target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], + sp = *(int *) &deprecated_registers[REGISTER_BYTE (SP_REGNUM)]; + if (0 != target_read_memory (sp, + &deprecated_registers[REGISTER_BYTE (L0_REGNUM)], 16 * REGISTER_RAW_SIZE (L0_REGNUM))) { /* fprintf_unfiltered so user can still use gdb */ @@ -313,10 +319,10 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, #define fpuregs ((struct fpu *) core_reg_sect) if (core_reg_size >= sizeof (struct fpu)) { - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs->fpu_regs, - sizeof (fpuregs->fpu_regs)); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr, - sizeof (FPU_FSR_TYPE)); + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + fpuregs->fpu_regs, sizeof (fpuregs->fpu_regs)); + memcpy (&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)], + &fpuregs->fpu_fsr, sizeof (FPU_FSR_TYPE)); } else fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n"); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 033cc81..af43c9f 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -315,7 +315,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) it later. */ if (fi->next->next != NULL && (fi->next->next->signal_handler_caller - || frame_in_dummy (fi->next->next)) + || deprecated_frame_in_dummy (fi->next->next)) && frameless_look_for_prologue (fi->next)) { /* A frameless function interrupted by a signal did not change @@ -488,7 +488,7 @@ sparc_frame_saved_pc (struct frame_info *frame) else if (frame->extra_info->in_prologue || (frame->next != NULL && (frame->next->signal_handler_caller || - frame_in_dummy (frame->next)) && + deprecated_frame_in_dummy (frame->next)) && frameless_look_for_prologue (frame))) { /* A frameless function interrupted by a signal did not save @@ -956,7 +956,7 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, *lval = lval_register; addr = REGISTER_BYTE (regnum); if (raw_buffer != NULL) - read_register_gen (regnum, raw_buffer); + deprecated_read_register_gen (regnum, raw_buffer); } if (addrp != NULL) *addrp = addr; @@ -990,32 +990,34 @@ sparc_push_dummy_frame (void) if (GDB_TARGET_IS_SPARC64) { /* PC, NPC, CCR, FSR, FPRS, Y, ASI */ - read_register_bytes (REGISTER_BYTE (PC_REGNUM), ®ister_temp[0], - REGISTER_RAW_SIZE (PC_REGNUM) * 7); - read_register_bytes (REGISTER_BYTE (PSTATE_REGNUM), - ®ister_temp[7 * SPARC_INTREG_SIZE], - REGISTER_RAW_SIZE (PSTATE_REGNUM)); + deprecated_read_register_bytes (REGISTER_BYTE (PC_REGNUM), + ®ister_temp[0], + REGISTER_RAW_SIZE (PC_REGNUM) * 7); + deprecated_read_register_bytes (REGISTER_BYTE (PSTATE_REGNUM), + ®ister_temp[7 * SPARC_INTREG_SIZE], + REGISTER_RAW_SIZE (PSTATE_REGNUM)); /* FIXME: not sure what needs to be saved here. */ } else { /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */ - read_register_bytes (REGISTER_BYTE (Y_REGNUM), ®ister_temp[0], - REGISTER_RAW_SIZE (Y_REGNUM) * 8); + deprecated_read_register_bytes (REGISTER_BYTE (Y_REGNUM), + ®ister_temp[0], + REGISTER_RAW_SIZE (Y_REGNUM) * 8); } - read_register_bytes (REGISTER_BYTE (O0_REGNUM), - ®ister_temp[8 * SPARC_INTREG_SIZE], - SPARC_INTREG_SIZE * 8); + deprecated_read_register_bytes (REGISTER_BYTE (O0_REGNUM), + ®ister_temp[8 * SPARC_INTREG_SIZE], + SPARC_INTREG_SIZE * 8); - read_register_bytes (REGISTER_BYTE (G0_REGNUM), - ®ister_temp[16 * SPARC_INTREG_SIZE], - SPARC_INTREG_SIZE * 8); + deprecated_read_register_bytes (REGISTER_BYTE (G0_REGNUM), + ®ister_temp[16 * SPARC_INTREG_SIZE], + SPARC_INTREG_SIZE * 8); if (SPARC_HAS_FPU) - read_register_bytes (REGISTER_BYTE (FP0_REGNUM), - ®ister_temp[24 * SPARC_INTREG_SIZE], - FP_REGISTER_BYTES); + deprecated_read_register_bytes (REGISTER_BYTE (FP0_REGNUM), + ®ister_temp[24 * SPARC_INTREG_SIZE], + FP_REGISTER_BYTES); sp -= DUMMY_STACK_SIZE; @@ -1237,28 +1239,28 @@ sparc_pop_frame (void) if (fsr[FP0_REGNUM]) { read_memory (fsr[FP0_REGNUM], raw_buffer, FP_REGISTER_BYTES); - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), - raw_buffer, FP_REGISTER_BYTES); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), + raw_buffer, FP_REGISTER_BYTES); } if (!(GDB_TARGET_IS_SPARC64)) { if (fsr[FPS_REGNUM]) { read_memory (fsr[FPS_REGNUM], raw_buffer, SPARC_INTREG_SIZE); - write_register_gen (FPS_REGNUM, raw_buffer); + deprecated_write_register_gen (FPS_REGNUM, raw_buffer); } if (fsr[CPS_REGNUM]) { read_memory (fsr[CPS_REGNUM], raw_buffer, SPARC_INTREG_SIZE); - write_register_gen (CPS_REGNUM, raw_buffer); + deprecated_write_register_gen (CPS_REGNUM, raw_buffer); } } } if (fsr[G1_REGNUM]) { read_memory (fsr[G1_REGNUM], raw_buffer, 7 * SPARC_INTREG_SIZE); - write_register_bytes (REGISTER_BYTE (G1_REGNUM), raw_buffer, - 7 * SPARC_INTREG_SIZE); + deprecated_write_register_bytes (REGISTER_BYTE (G1_REGNUM), raw_buffer, + 7 * SPARC_INTREG_SIZE); } if (frame->extra_info->flat) @@ -1310,11 +1312,11 @@ sparc_pop_frame (void) /* Restore the out registers. Among other things this writes the new stack pointer. */ - write_register_bytes (REGISTER_BYTE (O0_REGNUM), raw_buffer, - SPARC_INTREG_SIZE * 8); + deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), raw_buffer, + SPARC_INTREG_SIZE * 8); - write_register_bytes (REGISTER_BYTE (L0_REGNUM), reg_temp, - SPARC_INTREG_SIZE * 16); + deprecated_write_register_bytes (REGISTER_BYTE (L0_REGNUM), reg_temp, + SPARC_INTREG_SIZE * 16); } if (!(GDB_TARGET_IS_SPARC64)) @@ -1609,37 +1611,37 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) for (regi = 0; regi <= R_I7; regi++) if ((regno == -1) || (regno == regi)) - read_register_gen (regi, (char *) (regp + regi) + offset); + deprecated_read_register_gen (regi, (char *) (regp + regi) + offset); if ((regno == -1) || (regno == PC_REGNUM)) - read_register_gen (PC_REGNUM, (char *) (regp + R_PC) + offset); + deprecated_read_register_gen (PC_REGNUM, (char *) (regp + R_PC) + offset); if ((regno == -1) || (regno == NPC_REGNUM)) - read_register_gen (NPC_REGNUM, (char *) (regp + R_nPC) + offset); + deprecated_read_register_gen (NPC_REGNUM, (char *) (regp + R_nPC) + offset); if ((regno == -1) || (regno == Y_REGNUM)) - read_register_gen (Y_REGNUM, (char *) (regp + R_Y) + offset); + deprecated_read_register_gen (Y_REGNUM, (char *) (regp + R_Y) + offset); if (GDB_TARGET_IS_SPARC64) { #ifdef R_CCR if (regno == -1 || regno == CCR_REGNUM) - read_register_gen (CCR_REGNUM, ((char *) (regp + R_CCR)) + offset); + deprecated_read_register_gen (CCR_REGNUM, ((char *) (regp + R_CCR)) + offset); #endif #ifdef R_FPRS if (regno == -1 || regno == FPRS_REGNUM) - read_register_gen (FPRS_REGNUM, ((char *) (regp + R_FPRS)) + offset); + deprecated_read_register_gen (FPRS_REGNUM, ((char *) (regp + R_FPRS)) + offset); #endif #ifdef R_ASI if (regno == -1 || regno == ASI_REGNUM) - read_register_gen (ASI_REGNUM, ((char *) (regp + R_ASI)) + offset); + deprecated_read_register_gen (ASI_REGNUM, ((char *) (regp + R_ASI)) + offset); #endif } else /* sparc32 */ { #ifdef R_PS if (regno == -1 || regno == PS_REGNUM) - read_register_gen (PS_REGNUM, ((char *) (regp + R_PS)) + offset); + deprecated_read_register_gen (PS_REGNUM, ((char *) (regp + R_PS)) + offset); #endif /* For 64-bit hosts, R_WIM and R_TBR may not be defined. @@ -1655,18 +1657,18 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) #if defined (R_WIM) if (regno == -1 || regno == WIM_REGNUM) - read_register_gen (WIM_REGNUM, ((char *) (regp + R_WIM)) + offset); + deprecated_read_register_gen (WIM_REGNUM, ((char *) (regp + R_WIM)) + offset); #else if (regno == -1 || regno == WIM_REGNUM) - read_register_gen (WIM_REGNUM, NULL); + deprecated_read_register_gen (WIM_REGNUM, NULL); #endif #if defined (R_TBR) if (regno == -1 || regno == TBR_REGNUM) - read_register_gen (TBR_REGNUM, ((char *) (regp + R_TBR)) + offset); + deprecated_read_register_gen (TBR_REGNUM, ((char *) (regp + R_TBR)) + offset); #else if (regno == -1 || regno == TBR_REGNUM) - read_register_gen (TBR_REGNUM, NULL); + deprecated_read_register_gen (TBR_REGNUM, NULL); #endif } } @@ -1727,7 +1729,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) { if ((regno == -1) || (regno == regi)) { - from = (char *) ®isters[REGISTER_BYTE (regi)]; + from = (char *) &deprecated_registers[REGISTER_BYTE (regi)]; to = (char *) &fpregsetp->pr_fr.pr_regs[regi - FP0_REGNUM]; memcpy (to, from, REGISTER_RAW_SIZE (regi)); } @@ -1736,7 +1738,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) if (!(GDB_TARGET_IS_SPARC64)) /* FIXME: does Sparc64 have this register? */ if ((regno == -1) || (regno == FPS_REGNUM)) { - from = (char *)®isters[REGISTER_BYTE (FPS_REGNUM)]; + from = (char *)&deprecated_registers[REGISTER_BYTE (FPS_REGNUM)]; to = (char *) &fpregsetp->pr_fsr; memcpy (to, from, REGISTER_RAW_SIZE (FPS_REGNUM)); } @@ -1858,7 +1860,7 @@ decode_asi (int val) Pretty print various registers. */ /* FIXME: Would be nice if this did some fancy things for 32 bit sparc. */ -void +static void sparc_print_register_hook (int regno) { ULONGEST val; @@ -2028,6 +2030,146 @@ sparc_print_register_hook (int regno) #undef BITS } + +static void +sparc_print_registers (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame, + int regnum, int print_all, + void (*print_register_hook) (int)) +{ + int i; + const int numregs = NUM_REGS + NUM_PSEUDO_REGS; + char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); + char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + + for (i = 0; i < numregs; i++) + { + /* Decide between printing all regs, non-float / vector regs, or + specific reg. */ + if (regnum == -1) + { + if (!print_all) + { + if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + continue; + if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) + continue; + } + } + else + { + if (i != regnum) + continue; + } + + /* If the register name is empty, it is undefined for this + processor, so don't display anything. */ + if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') + continue; + + fputs_filtered (REGISTER_NAME (i), file); + print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); + + /* Get the data in raw format. */ + if (! frame_register_read (frame, i, raw_buffer)) + { + fprintf_filtered (file, "*value not available*\n"); + continue; + } + + /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. + The function frame_register_read() should have returned the + pre-cooked register so no conversion is necessary. */ + /* Convert raw data to virtual format if necessary. */ + if (REGISTER_CONVERTIBLE (i)) + { + REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), + raw_buffer, virtual_buffer); + } + else + { + memcpy (virtual_buffer, raw_buffer, + 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) + { + int j; + + val_print (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++) + { + int idx; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + idx = j; + else + idx = REGISTER_RAW_SIZE (i) - 1 - j; + fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); + } + fprintf_filtered (file, ")"); + } + else + { + /* Print the register in hex. */ + val_print (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) + { + fprintf_filtered (file, "\t"); + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + file, 0, 1, 0, Val_pretty_default); + } + } + + /* Some sparc specific info. */ + if (print_register_hook != NULL) + print_register_hook (i); + + fprintf_filtered (file, "\n"); + } +} + +static void +sparc_print_registers_info (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame, + int regnum, int print_all) +{ + sparc_print_registers (gdbarch, file, frame, regnum, print_all, + sparc_print_register_hook); +} + +void +sparc_do_registers_info (int regnum, int all) +{ + sparc_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + regnum, all); +} + +static void +sparclet_print_registers_info (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame, + int regnum, int print_all) +{ + sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL); +} + +void +sparclet_do_registers_info (int regnum, int all) +{ + sparclet_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + regnum, all); +} + int gdb_print_insn_sparc (bfd_vma memaddr, disassemble_info *info) @@ -2099,7 +2241,7 @@ sparc32_push_arguments (int nargs, struct value **args, CORE_ADDR sp, for (j = 0; j < m_arg->len && oregnum < 6; j += SPARC_INTREG_SIZE, oregnum++) - write_register_gen (O0_REGNUM + oregnum, m_arg->contents + j); + deprecated_write_register_gen (O0_REGNUM + oregnum, m_arg->contents + j); } return sp; @@ -2155,18 +2297,19 @@ sparc_store_return_value (struct type *type, char *valbuf) memset (buffer, 0, REGISTER_RAW_SIZE (regno)); memcpy (buffer + REGISTER_RAW_SIZE (regno) - TYPE_LENGTH (type), valbuf, TYPE_LENGTH (type)); - write_register_gen (regno, buffer); + deprecated_write_register_gen (regno, buffer); } else - write_register_bytes (REGISTER_BYTE (regno), valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (regno), valbuf, + TYPE_LENGTH (type)); } extern void sparclet_store_return_value (struct type *type, char *valbuf) { /* Other values are returned in register %o0. */ - write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf, + TYPE_LENGTH (type)); } @@ -2427,9 +2570,9 @@ sparc64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, default: internal_error (__FILE__, __LINE__, "bad switch"); } - write_register_bytes (REGISTER_BYTE (fpreg), - VALUE_CONTENTS (args[i]), - len); + deprecated_write_register_bytes (REGISTER_BYTE (fpreg), + VALUE_CONTENTS (args[i]), + len); } } else /* all other args go into the first six 'o' registers */ @@ -2440,7 +2583,7 @@ sparc64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { int oreg = O0_REGNUM + register_counter; - write_register_gen (oreg, VALUE_CONTENTS (copyarg) + j); + deprecated_write_register_gen (oreg, VALUE_CONTENTS (copyarg) + j); register_counter += 1; } } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index f96eef7..fcd6046 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -202,46 +202,46 @@ static const char vb_name[] = "_vb$"; #define BELIEVE_PCC_PROMOTION_TYPE 0 #endif -static struct complaint invalid_cpp_abbrev_complaint = +static struct deprecated_complaint invalid_cpp_abbrev_complaint = {"invalid C++ abbreviation `%s'", 0, 0}; -static struct complaint invalid_cpp_type_complaint = +static struct deprecated_complaint invalid_cpp_type_complaint = {"C++ abbreviated type name unknown at symtab pos %d", 0, 0}; -static struct complaint member_fn_complaint = +static struct deprecated_complaint member_fn_complaint = {"member function type missing, got '%c'", 0, 0}; -static struct complaint const_vol_complaint = +static struct deprecated_complaint const_vol_complaint = {"const/volatile indicator missing, got '%c'", 0, 0}; -static struct complaint error_type_complaint = +static struct deprecated_complaint error_type_complaint = {"couldn't parse type; debugger out of date?", 0, 0}; -static struct complaint invalid_member_complaint = +static struct deprecated_complaint invalid_member_complaint = {"invalid (minimal) member type data format at symtab pos %d.", 0, 0}; -static struct complaint range_type_base_complaint = +static struct deprecated_complaint range_type_base_complaint = {"base type %d of range type is not defined", 0, 0}; -static struct complaint reg_value_complaint = +static struct deprecated_complaint reg_value_complaint = {"register number %d too large (max %d) in symbol %s", 0, 0}; -static struct complaint vtbl_notfound_complaint = +static struct deprecated_complaint vtbl_notfound_complaint = {"virtual function table pointer not found when defining class `%s'", 0, 0}; -static struct complaint unrecognized_cplus_name_complaint = +static struct deprecated_complaint unrecognized_cplus_name_complaint = {"Unknown C++ symbol name `%s'", 0, 0}; -static struct complaint rs6000_builtin_complaint = +static struct deprecated_complaint rs6000_builtin_complaint = {"Unknown builtin type %d", 0, 0}; -static struct complaint unresolved_sym_chain_complaint = +static struct deprecated_complaint unresolved_sym_chain_complaint = {"%s: common block `%s' from global_sym_chain unresolved", 0, 0}; -static struct complaint stabs_general_complaint = +static struct deprecated_complaint stabs_general_complaint = {"%s", 0, 0}; -static struct complaint lrs_general_complaint = +static struct deprecated_complaint lrs_general_complaint = {"%s", 0, 0}; /* Make a list of forward references which haven't been defined. */ @@ -311,7 +311,7 @@ dbx_lookup_type (int typenums[2]) if (filenum < 0 || filenum >= n_this_object_header_files) { - static struct complaint msg = + static struct deprecated_complaint msg = {"\ Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.", 0, 0}; @@ -618,11 +618,11 @@ static int read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, struct objfile *objfile) { - static struct complaint msg_unknown = + static struct deprecated_complaint msg_unknown = {"\ Unsupported token in stabs string %s.\n", 0, 0}; - static struct complaint msg_notfound = + static struct deprecated_complaint msg_notfound = {"\ Unable to find base type for %s.\n", 0, 0}; @@ -692,7 +692,7 @@ read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, /* Bad visibility format. Complain and treat it as public. */ { - static struct complaint msg = + static struct deprecated_complaint msg = { "Unknown visibility `%c' for baseclass", 0, 0}; complain (&msg, new->visibility); @@ -810,7 +810,7 @@ read_cfront_member_functions (struct field_info *fip, char **pp, ref_func = lookup_symbol (fname, 0, VAR_NAMESPACE, 0, 0); /* demangled name */ if (!ref_func) { - static struct complaint msg = + static struct deprecated_complaint msg = {"\ Unable to find function symbol for %s\n", 0, 0}; @@ -2435,7 +2435,7 @@ again: { /* Complain and keep going, so compilers can invent new cross-reference types. */ - static struct complaint msg = + static struct deprecated_complaint msg = {"Unrecognized cross-reference type `%c'", 0, 0}; complain (&msg, (*pp)[0]); code = TYPE_CODE_STRUCT; @@ -2660,7 +2660,7 @@ again: ++*pp; else { - static struct complaint msg = { + static struct deprecated_complaint msg = { "Prototyped function type didn't end arguments with `#':\n%s", 0, 0 }; @@ -4018,7 +4018,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type, default: /* Unknown character. Complain and treat it as non-virtual. */ { - static struct complaint msg = + static struct deprecated_complaint msg = { "Unknown virtual character `%c' for baseclass", 0, 0}; complain (&msg, **pp); @@ -4037,7 +4037,7 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type, /* Bad visibility format. Complain and treat it as public. */ { - static struct complaint msg = + static struct deprecated_complaint msg = { "Unknown visibility `%c' for baseclass", 0, 0 }; @@ -4210,7 +4210,7 @@ read_cfront_static_fields (struct field_info *fip, char **pp, struct type *type, ref_static = lookup_symbol (sname, 0, VAR_NAMESPACE, 0, 0); /*demangled_name */ if (!ref_static) { - static struct complaint msg = + static struct deprecated_complaint msg = {"\ Unable to find symbol for static data field %s\n", 0, 0}; @@ -4389,7 +4389,7 @@ attach_fields_to_type (struct field_info *fip, register struct type *type, default: /* Unknown visibility. Complain and treat it as public. */ { - static struct complaint msg = + static struct deprecated_complaint msg = { "Unknown visibility `%c' for field", 0, 0}; complain (&msg, fip->list->visibility); @@ -4402,7 +4402,7 @@ attach_fields_to_type (struct field_info *fip, register struct type *type, } -static struct complaint multiply_defined_struct = +static struct deprecated_complaint multiply_defined_struct = {"struct/union type gets multiply defined: %s%s", 0, 0}; @@ -5214,7 +5214,7 @@ common_block_start (char *name, struct objfile *objfile) { if (common_block_name != NULL) { - static struct complaint msg = + static struct deprecated_complaint msg = { "Invalid symbol data: common block within common block", 0, 0}; @@ -5244,7 +5244,7 @@ common_block_end (struct objfile *objfile) if (common_block_name == NULL) { - static struct complaint msg = + static struct deprecated_complaint msg = {"ECOMM symbol unmatched by BCOMM", 0, 0}; complain (&msg); return; @@ -5359,7 +5359,7 @@ cleanup_undefined_types (void) if (typename == NULL) { - static struct complaint msg = + static struct deprecated_complaint msg = {"need a type name", 0, 0}; complain (&msg); break; @@ -5384,7 +5384,7 @@ cleanup_undefined_types (void) default: { - static struct complaint msg = + static struct deprecated_complaint msg = {"\ GDB internal error. cleanup_undefined_types with bad type %d.", 0, 0}; complain (&msg, TYPE_CODE (*type)); diff --git a/gdb/stabsread.h b/gdb/stabsread.h index d470d47..1371f6c 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -128,8 +128,8 @@ EXTERN int n_this_object_header_files; EXTERN int n_allocated_this_object_header_files; -extern struct complaint unknown_symtype_complaint; -extern struct complaint unknown_symchar_complaint; +extern struct deprecated_complaint unknown_symtype_complaint; +extern struct deprecated_complaint unknown_symchar_complaint; extern struct type *read_type (char **, struct objfile *); diff --git a/gdb/stack.c b/gdb/stack.c index 3ed82e6..74e1711 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -352,7 +352,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args) to check for a bp_call_dummy breakpoint. */ if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame)) #else - if (frame_in_dummy (fi)) + if (deprecated_frame_in_dummy (fi)) #endif { annotate_frame_begin (level == -1 ? 0 : level, fi->pc); @@ -396,7 +396,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args) find_pc_line (fi->pc, fi->next != NULL && !fi->next->signal_handler_caller - && !frame_in_dummy (fi->next)); + && !deprecated_frame_in_dummy (fi->next)); location_print = (source == LOCATION || source == LOC_AND_ADDRESS @@ -796,7 +796,7 @@ frame_info (char *addr_exp, int from_tty) sal = find_pc_line (fi->pc, fi->next != NULL && !fi->next->signal_handler_caller - && !frame_in_dummy (fi->next)); + && !deprecated_frame_in_dummy (fi->next)); func = get_frame_function (fi); s = find_pc_symtab (fi->pc); if (func) diff --git a/gdb/sun3-nat.c b/gdb/sun3-nat.c index 988ed37..1df7858 100644 --- a/gdb/sun3-nat.c +++ b/gdb/sun3-nat.c @@ -36,7 +36,7 @@ fetch_inferior_registers (int regno) struct regs inferior_registers; struct fp_status inferior_fp_registers; - registers_fetched (); + deprecated_registers_fetched (); ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_registers); @@ -45,15 +45,15 @@ fetch_inferior_registers (int regno) ptrace (PTRACE_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & inferior_fp_registers); - memcpy (registers, &inferior_registers, 16 * 4); + memcpy (deprecated_registers, &inferior_registers, 16 * 4); if (FP0_REGNUM >= 0) - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fps_regs); + memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], + &inferior_fp_registers, sizeof inferior_fp_registers.fps_regs); - *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; + *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; + *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; if (FP0_REGNUM >= 0) - memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)], + memcpy (&deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], &inferior_fp_registers.fps_control, sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); @@ -69,17 +69,18 @@ store_inferior_registers (int regno) struct regs inferior_registers; struct fp_status inferior_fp_registers; - memcpy (&inferior_registers, registers, 16 * 4); + memcpy (&inferior_registers, deprecated_registers, 16 * 4); if (FP0_REGNUM >= 0) - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (&inferior_fp_registers, + &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], sizeof inferior_fp_registers.fps_regs); - inferior_registers.r_ps = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)]; + inferior_registers.r_ps = *(int *) &&deprecated_registers[REGISTER_BYTE (PS_REGNUM)]; + inferior_registers.r_pc = *(int *) &&deprecated_registers[REGISTER_BYTE (PC_REGNUM)]; if (FP0_REGNUM >= 0) memcpy (&inferior_fp_registers.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], + &&deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); @@ -116,7 +117,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size < sizeof (struct regs)) error ("Can't find registers in core file"); - memcpy (registers, (char *) regs, 16 * 4); + memcpy (&deprecated_registers, (char *) regs, 16 * 4); supply_register (PS_REGNUM, (char *) ®s->r_ps); supply_register (PC_REGNUM, (char *) ®s->r_pc); @@ -130,10 +131,10 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, { if (FP0_REGNUM >= 0) { - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], + memcpy (&&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], fpustruct->f_fpstatus.fps_regs, sizeof fpustruct->f_fpstatus.fps_regs); - memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)], + memcpy (&&deprecated_registers[REGISTER_BYTE (FPC_REGNUM)], &fpustruct->f_fpstatus.fps_control, sizeof fpustruct->f_fpstatus - sizeof fpustruct->f_fpstatus.fps_regs); diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c index d686777..fb52754 100644 --- a/gdb/symm-nat.c +++ b/gdb/symm-nat.c @@ -68,29 +68,29 @@ store_inferior_registers (int regno) to the registers array to solve this properly. */ mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); - regs.pr_eax = *(int *) ®isters[REGISTER_BYTE (0)]; - regs.pr_ebx = *(int *) ®isters[REGISTER_BYTE (5)]; - regs.pr_ecx = *(int *) ®isters[REGISTER_BYTE (2)]; - regs.pr_edx = *(int *) ®isters[REGISTER_BYTE (1)]; - regs.pr_esi = *(int *) ®isters[REGISTER_BYTE (6)]; - regs.pr_edi = *(int *) ®isters[REGISTER_BYTE (7)]; - regs.pr_esp = *(int *) ®isters[REGISTER_BYTE (14)]; - regs.pr_ebp = *(int *) ®isters[REGISTER_BYTE (15)]; - regs.pr_eip = *(int *) ®isters[REGISTER_BYTE (16)]; - regs.pr_flags = *(int *) ®isters[REGISTER_BYTE (17)]; + regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)]; + regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)]; + regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)]; + regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)]; + regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)]; + regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)]; + regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)]; + regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)]; + regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)]; + regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)]; for (i = 0; i < 31; i++) { regs.pr_fpa.fpa_regs[i] = - *(int *) ®isters[REGISTER_BYTE (FP1_REGNUM + i)]; + *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)]; } - memcpy (regs.pr_fpu.fpu_stack[0], ®isters[REGISTER_BYTE (ST0_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[1], ®isters[REGISTER_BYTE (ST1_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[2], ®isters[REGISTER_BYTE (ST2_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[3], ®isters[REGISTER_BYTE (ST3_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[4], ®isters[REGISTER_BYTE (ST4_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[5], ®isters[REGISTER_BYTE (ST5_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[6], ®isters[REGISTER_BYTE (ST6_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[7], ®isters[REGISTER_BYTE (ST7_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10); + memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10); mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); } @@ -100,32 +100,32 @@ fetch_inferior_registers (int regno) int i; struct pt_regset regs; - registers_fetched (); + deprecated_registers_fetched (); mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); - *(int *) ®isters[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax; - *(int *) ®isters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx; - *(int *) ®isters[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx; - *(int *) ®isters[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx; - *(int *) ®isters[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi; - *(int *) ®isters[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi; - *(int *) ®isters[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp; - *(int *) ®isters[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp; - *(int *) ®isters[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip; - *(int *) ®isters[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags; + *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax; + *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx; + *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx; + *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx; + *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi; + *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi; + *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp; + *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp; + *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip; + *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags; for (i = 0; i < FPA_NREGS; i++) { - *(int *) ®isters[REGISTER_BYTE (FP1_REGNUM + i)] = + *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] = regs.pr_fpa.fpa_regs[i]; } - memcpy (®isters[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); - memcpy (®isters[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); - memcpy (®isters[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); - memcpy (®isters[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); - memcpy (®isters[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); - memcpy (®isters[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); - memcpy (®isters[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); - memcpy (®isters[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); + memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); } /* FIXME: This should be merged with i387-tdep.c as well. */ diff --git a/gdb/symtab.c b/gdb/symtab.c index 3f2c1ff..e267190 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -154,7 +154,6 @@ struct symbol *lookup_symbol_aux_minsyms (int block_index, const namespace_enum namespace, struct symtab **symtab); - 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 */ @@ -845,6 +844,52 @@ lookup_symbol_aux (const char *name, const char *mangled_name, if (sym != NULL) return sym; +#if 0 + /* NOTE: carlton/2002-11-05: At the time that this code was + #ifdeffed out, the value of 'block' was always NULL at this + point, hence the bemused comments below. */ + + /* FIXME: this code is never executed--block is always NULL at this + point. What is it trying to do, anyway? We already should have + checked the STATIC_BLOCK above (it is the superblock of top-level + blocks). Why is VAR_NAMESPACE special-cased? */ + /* Don't need to mess with the psymtabs; if we have a block, + that file is read in. If we don't, then we deal later with + all the psymtab stuff that needs checking. */ + /* Note (RT): The following never-executed code looks unnecessary to me also. + * If we change the code to use the original (passed-in) + * value of 'block', we could cause it to execute, but then what + * would it do? The STATIC_BLOCK of the symtab containing the passed-in + * 'block' was already searched by the above code. And the STATIC_BLOCK's + * of *other* symtabs (those files not containing 'block' lexically) + * should not contain 'block' address-wise. So we wouldn't expect this + * code to find any 'sym''s that were not found above. I vote for + * deleting the following paragraph of code. + */ + if (namespace == VAR_NAMESPACE && block != NULL) + { + struct block *b; + /* Find the right symtab. */ + ALL_SYMTABS (objfile, s) + { + bv = BLOCKVECTOR (s); + b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); + if (BLOCK_START (b) <= BLOCK_START (block) + && BLOCK_END (b) > BLOCK_START (block)) + { + sym = lookup_block_symbol (b, name, mangled_name, VAR_NAMESPACE); + if (sym) + { + block_found = b; + if (symtab != NULL) + *symtab = s; + return fixup_symbol_section (sym, objfile); + } + } + } + } +#endif /* 0 */ + /* C++: If requested to do so by the caller, check to see if NAME is a field of `this'. */ if (is_a_field_of_this) @@ -1930,95 +1975,6 @@ find_pc_symtab (CORE_ADDR pc) } -#if 0 - -/* Find the closest symbol value (of any sort -- function or variable) - for a given address value. Slow but complete. (currently unused, - mainly because it is too slow. We could fix it if each symtab and - psymtab had contained in it the addresses ranges of each of its - sections, which also would be required to make things like "info - line *0x2345" cause psymtabs to be converted to symtabs). */ - -struct symbol * -find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp, - CORE_ADDR *symaddrp) -{ - struct symtab *symtab, *best_symtab; - struct objfile *objfile; - struct dict_iterator iter; - register struct symbol *sym; - register CORE_ADDR sym_addr; - struct block *block; - int blocknum; - - /* Info on best symbol seen so far */ - - register CORE_ADDR best_sym_addr = 0; - struct symbol *best_sym = 0; - - /* FIXME -- we should pull in all the psymtabs, too! */ - ALL_SYMTABS (objfile, symtab) - { - /* Search the global and static blocks in this symtab for - the closest symbol-address to the desired address. */ - - for (blocknum = GLOBAL_BLOCK; blocknum <= STATIC_BLOCK; blocknum++) - { - QUIT; - block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), blocknum); - ALL_BLOCK_SYMBOLS (block, iter, sym) - { - switch (SYMBOL_CLASS (sym)) - { - case LOC_STATIC: - case LOC_LABEL: - sym_addr = SYMBOL_VALUE_ADDRESS (sym); - break; - - case LOC_INDIRECT: - sym_addr = SYMBOL_VALUE_ADDRESS (sym); - /* An indirect symbol really lives at *sym_addr, - * so an indirection needs to be done. - * However, I am leaving this commented out because it's - * expensive, and it's possible that symbolization - * could be done without an active process (in - * case this read_memory will fail). RT - sym_addr = read_memory_unsigned_integer - (sym_addr, TARGET_PTR_BIT / TARGET_CHAR_BIT); - */ - break; - - case LOC_BLOCK: - sym_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); - break; - - default: - continue; - } - - if (sym_addr <= addr) - if (sym_addr > best_sym_addr) - { - /* Quit if we found an exact match. */ - best_sym = sym; - best_sym_addr = sym_addr; - best_symtab = symtab; - if (sym_addr == addr) - goto done; - } - } - } - } - -done: - if (symtabp) - *symtabp = best_symtab; - if (symaddrp) - *symaddrp = best_sym_addr; - return best_sym; -} -#endif /* 0 */ - /* Find the source file and line number for a given PC value and SECTION. Return a structure containing a symtab pointer, a line number, and a pc range for the entire source line. @@ -3246,29 +3202,6 @@ print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym, printf_filtered (";\n"); } - else - { -#if 0 - /* Tiemann says: "info methods was never implemented." */ - char *demangled_name; - c_type_print_base (TYPE_FN_FIELD_TYPE (t, block), gdb_stdout, 0, 0); - c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (t, block), - gdb_stdout, 0); - if (TYPE_FN_FIELD_STUB (t, block)) - check_stub_method (TYPE_DOMAIN_TYPE (type), j, block); - demangled_name = - cplus_demangle (TYPE_FN_FIELD_PHYSNAME (t, block), - DMGL_ANSI | DMGL_PARAMS); - if (demangled_name == NULL) - fprintf_filtered (stream, "<badly mangled name %s>", - TYPE_FN_FIELD_PHYSNAME (t, block)); - else - { - fputs_filtered (demangled_name, stream); - xfree (demangled_name); - } -#endif - } } /* This help function for symtab_symbol_info() prints information @@ -3354,15 +3287,6 @@ types_info (char *regexp, int from_tty) symtab_symbol_info (regexp, TYPES_NAMESPACE, from_tty); } -#if 0 -/* Tiemann says: "info methods was never implemented." */ -static void -methods_info (char *regexp) -{ - symtab_symbol_info (regexp, METHODS_NAMESPACE, 0, from_tty); -} -#endif /* 0 */ - /* Breakpoint all functions matching regular expression. */ void @@ -4306,14 +4230,8 @@ _initialize_symtab (void) there is much disagreement "info types" can be fixed). */ add_info ("types", types_info, "All type names, or those matching REGEXP."); -#if 0 - add_info ("methods", methods_info, - "All method names, or those matching REGEXP::REGEXP.\n\ -If the class qualifier is omitted, it is assumed to be the current scope.\n\ -If the first REGEXP is omitted, then all methods matching the second REGEXP\n\ -are listed."); -#endif - add_info ("sources", sources_info, "Source files in the program."); + add_info ("sources", sources_info, + "Source files in the program."); add_com ("rbreak", class_breakpoint, rbreak_command, "Set a breakpoint for all functions matching REGEXP."); diff --git a/gdb/symtab.h b/gdb/symtab.h index 4ceb0cc..2b1b7ea 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1141,13 +1141,6 @@ extern struct symtab_and_line find_pc_line (CORE_ADDR, int); extern struct symtab_and_line find_pc_sect_line (CORE_ADDR, asection *, int); -/* Given an address, return the nearest symbol at or below it in memory. - Optionally return the symtab it's from through 2nd arg, and the - address in inferior memory of the symbol through 3rd arg. */ - -extern struct symbol *find_addr_symbol (CORE_ADDR, struct symtab **, - CORE_ADDR *); - /* Given a symtab and line number, return the pc there. */ extern int find_line_pc (struct symtab *, int, CORE_ADDR *); diff --git a/gdb/target.c b/gdb/target.c index 75d022f..51ace74 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -666,6 +666,7 @@ update_current_target (void) 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 @@ -1733,7 +1734,7 @@ debug_print_register (const char * func, int regno) { int i; unsigned char *buf = alloca (MAX_REGISTER_RAW_SIZE); - read_register_gen (regno, buf); + deprecated_read_register_gen (regno, buf); fprintf_unfiltered (gdb_stdlog, " = "); for (i = 0; i < REGISTER_RAW_SIZE (regno); i++) { diff --git a/gdb/target.h b/gdb/target.h index 18b95b0..5cdb76f 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -328,6 +328,16 @@ struct target_ops void *), void *); char * (*to_make_corefile_notes) (bfd *, int *); + + /* Return the thread-local address at OFFSET in the + thread-local storage for the thread PTID and the shared library + or executable file given by OBJFILE. If that block of + thread-local storage hasn't been allocated yet, this function + may return an error. */ + CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid, + struct objfile *objfile, + CORE_ADDR offset); + int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -1039,6 +1049,12 @@ extern void (*target_new_objfile_hook) (struct objfile *); #define target_make_corefile_notes(BFD, SIZE_P) \ (current_target.to_make_corefile_notes) (BFD, SIZE_P) +/* Thread-local values. */ +#define target_get_thread_local_address \ + (current_target.to_get_thread_local_address) +#define target_get_thread_local_address_p() \ + (target_get_thread_local_address != NULL) + /* Hook to call target-dependent code after reading in a new symbol table. */ #ifndef TARGET_SYMFILE_POSTREAD diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a54cbdd..9704d5c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2002-11-08 Jeff Johnston <jjohnstn@redhat.com> + + * lib/mi-support.exp (mi_gdb_start): Verify the startup message + for mi1 and current mi is in correct format. New mi startup message + should be in mi console format. This is part of fix for PR gdb/604. + +2002-09-18 Fernando Nasser <fnasser@redhat.com> + + * gdb.asm/asm-source.exp: Adjust patter to new disassembler routine + which explicitly prints the zero offset as "+0". + 2002-11-14 David Carlton <carlton@math.stanford.edu> * carlton_runnamespace: New file. diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index deb4b5f..641a7c1 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -289,7 +289,7 @@ gdb_test "print globalvar" ".* = 11" "look at global variable" gdb_test "print staticvar" ".* = 5" "look at static variable" # See if we can look at a static function -gdb_test "disassem foostatic" ".*<foostatic>:.*End of assembler dump." \ +gdb_test "disassem foostatic" ".*<foostatic\\+0>:.*End of assembler dump." \ "look at static function" remote_exec build "rm -f ${subdir}/arch.inc" diff --git a/gdb/testsuite/gdb.chill/ChangeLog b/gdb/testsuite/gdb.chill/ChangeLog index f4f49b1..ea0068f 100644 --- a/gdb/testsuite/gdb.chill/ChangeLog +++ b/gdb/testsuite/gdb.chill/ChangeLog @@ -1,3 +1,8 @@ +2002-11-09 Klee Dienes <kdienes@apple.com> + + * chexp.exp: Mark as obsolete. + * pr-5016.exp: Remove stray trailing newline. + 2002-08-01 Andrew Cagney <cagney@redhat.com> * builtins.exp, callch.exp, chillvars.exp: Make files obsolete. diff --git a/gdb/testsuite/gdb.chill/chexp.exp b/gdb/testsuite/gdb.chill/chexp.exp index 820ef83..aca5632 100644 --- a/gdb/testsuite/gdb.chill/chexp.exp +++ b/gdb/testsuite/gdb.chill/chexp.exp @@ -1,450 +1,450 @@ -# Copyright 1992, 1994, 1995, 1998 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -# This file was written by Fred Fish. (fnf@cygnus.com) - -if $tracelevel then { - strace $tracelevel -} - -set prms_id 0 -set bug_id 0 - -# Set the current language to chill. This counts as a test. If it -# fails, then we skip the other tests. - -proc set_lang_chill {} { - global gdb_prompt - - send_gdb "set language chill\n" - gdb_expect { - -re ".*$gdb_prompt $" {} - timeout { fail "set language chill (timeout)" ; return 0 } - } - - send_gdb "show language\n" - gdb_expect { - -re ".* source language is \"chill\".*$gdb_prompt $" { - pass "set language to \"chill\"" - return 1 - } - -re ".*$gdb_prompt $" { - fail "setting language to \"chill\"" - return 0 - } - timeout { - fail "can't show language (timeout)" - return 0 - } - } -} - -proc test_integer_literals_accepted {} { - global gdb_prompt - - # Test various decimal values. - - gdb_test "p 123" " = 123" - gdb_test "p -123" " = -123" - gdb_test "p D'123" " = 123" - gdb_test "p d'123" " = 123" - gdb_test "p -D'123" " = -123" - gdb_test "p -d'123" " = -123" - gdb_test "p 12_345" " = 12345" - gdb_test "p __1_2_3__" " = 123" - gdb_test "p/d 123" " = D'123" - - # Test various binary values. - - gdb_test "p B'111" " = 7" - gdb_test "p b'111" " = 7" - gdb_test "p -B'111" " = -7" - gdb_test "p B'0111" " = 7" - gdb_test "p b'0111" " = 7" - gdb_test "p -b'0111" " = -7" - gdb_test "p B'_0_1_1_1_" " = 7" - gdb_test "p b'_0_1_1_1_" " = 7" - gdb_test "p -b'_0_1_1_1_" " = -7" - gdb_test "p/t B'111" " = B'111" - - # Test various octal values. - - gdb_test "p O'123" " = 83" - gdb_test "p o'123" " = 83" - gdb_test "p -o'0123" " = -83" - gdb_test "p O'0123" " = 83" - gdb_test "p o'0123" " = 83" - gdb_test "p -o'123" " = -83" - gdb_test "p O'_1_2_3_" " = 83" - gdb_test "p o'_1_2_3_" " = 83" - gdb_test "p -o'_1_2_3_" " = -83" - gdb_test "p/o O'123" " = O'123" - - # Test various hexadecimal values. - - gdb_test "p H'123" " = 291" - gdb_test "p h'123" " = 291" - gdb_test "p -h'123" " = -291" - gdb_test "p H'0123" " = 291" - gdb_test "p h'0123" " = 291" - gdb_test "p -h'0123" " = -291" - gdb_test "p H'_1_2_3_" " = 291" - gdb_test "p h'_1_2_3_" " = 291" - gdb_test "p -h'_1_2_3_" " = -291" - gdb_test "p H'ABC" " = 2748" - gdb_test "p H'abc" " = 2748" - gdb_test "p H'AbC" " = 2748" - gdb_test "p H'_A_b_C_" " = 2748" - gdb_test "p H'_D_e_F_" " = 3567" - gdb_test "p H'_d_E_f_" " = 3567" - gdb_test "p/x H'123" " = H'123" -} - -proc test_character_literals_accepted {} { - global gdb_prompt - - # Test various decimal values. - - gdb_test "p 'a'" " = 'a'" - gdb_test "p/x 'a'" " = H'61" - gdb_test "p/d 'a'" " = D'97" - gdb_test "p/t 'a'" " = B'1100001" - # gdb_test "p '^(97)'" " = 'a'" (not in GNU Chill) - gdb_test "p C'61'" " = 'a'" - gdb_test "p c'61'" " = 'a'" - gdb_test "p/x C'FF'" " = H'ff" - # gdb_test "p/x '^(H'FF)'" " = H'ff" (not in GNU Chill) - # gdb_test "p/x '^(D'255)'" " = H'ff" (not in GNU Chill) -} - -proc test_integer_literals_rejected {} { - global gdb_prompt - - # These are valid integer literals in Z.200, but not GNU-Chill. - - test_print_reject "p _" - test_print_reject "p __" - - test_print_reject "p D'" - test_print_reject "p D'_" - test_print_reject "p D'__" - - test_print_reject "p B'" - test_print_reject "p B'_" - test_print_reject "p B'__" - - test_print_reject "p O'" - test_print_reject "p O'_" - test_print_reject "p O'__" - - test_print_reject "p H'" - test_print_reject "p H'_" - test_print_reject "p H'__" - - # Test various decimal values. - - test_print_reject "p D'DEADBEEF" - test_print_reject "p D'123DEADBEEF" - - # Test various binary values. - - test_print_reject "p B'2" "Too-large digit in bitstring or integer." - test_print_reject "p B'12" "Too-large digit in bitstring or integer." - - # Test various octal values. - - test_print_reject "p O'9" "Too-large digit in bitstring or integer." - test_print_reject "p O'79" "Too-large digit in bitstring or integer." - - # Test various hexadecimal values. - - test_print_reject "p H'G" "Invalid character in bitstring or integer." - test_print_reject "p H'AG" "Invalid character in bitstring or integer." -} - -proc test_boolean_literals_accepted {} { - global gdb_prompt - - # Test the only possible values for a boolean, TRUE and FALSE. - - gdb_test "p TRUE" " = TRUE" - gdb_test "p FALSE" " = FALSE" -} - -proc test_float_literals_accepted {} { - global gdb_prompt - - # Test various floating point formats - - gdb_test "p .44 < .45" " = TRUE" - gdb_test "p .44 > .45" " = FALSE" - gdb_test "p 0.44 < 0.45" " = TRUE" - gdb_test "p 0.44 > 0.45" " = FALSE" - gdb_test "p 44. < 45." " = TRUE" - gdb_test "p 44. > 45." " = FALSE" - gdb_test "p 44.0 < 45.0" " = TRUE" - gdb_test "p 44.0 > 45.0" " = FALSE" - gdb_test "p 10D20 < 10D21" " = TRUE" - gdb_test "p 10D20 > 10D21" " = FALSE" - gdb_test "p 10d20 < 10d21" " = TRUE" - gdb_test "p 10d20 > 10d21" " = FALSE" - gdb_test "p 10E20 < 10E21" " = TRUE" - gdb_test "p 10E20 > 10E21" " = FALSE" - gdb_test "p 10e20 < 10e21" " = TRUE" - gdb_test "p 10e20 > 10e21" " = FALSE" - gdb_test "p 10.D20 < 10.D21" " = TRUE" - gdb_test "p 10.D20 > 10.D21" " = FALSE" - gdb_test "p 10.d20 < 10.d21" " = TRUE" - gdb_test "p 10.d20 > 10.d21" " = FALSE" - gdb_test "p 10.E20 < 10.E21" " = TRUE" - gdb_test "p 10.E20 > 10.E21" " = FALSE" - gdb_test "p 10.e20 < 10.e21" " = TRUE" - gdb_test "p 10.e20 > 10.e21" " = FALSE" - gdb_test "p 10.0D20 < 10.0D21" " = TRUE" - gdb_test "p 10.0D20 > 10.0D21" " = FALSE" - gdb_test "p 10.0d20 < 10.0d21" " = TRUE" - gdb_test "p 10.0d20 > 10.0d21" " = FALSE" - gdb_test "p 10.0E20 < 10.0E21" " = TRUE" - gdb_test "p 10.0E20 > 10.0E21" " = FALSE" - gdb_test "p 10.0e20 < 10.0e21" " = TRUE" - gdb_test "p 10.0e20 > 10.0e21" " = FALSE" - gdb_test "p 10.0D+20 < 10.0D+21" " = TRUE" - gdb_test "p 10.0D+20 > 10.0D+21" " = FALSE" - gdb_test "p 10.0d+20 < 10.0d+21" " = TRUE" - gdb_test "p 10.0d+20 > 10.0d+21" " = FALSE" - gdb_test "p 10.0E+20 < 10.0E+21" " = TRUE" - gdb_test "p 10.0E+20 > 10.0E+21" " = FALSE" - gdb_test "p 10.0e+20 < 10.0e+21" " = TRUE" - gdb_test "p 10.0e+20 > 10.0e+21" " = FALSE" - gdb_test "p 10.0D-11 < 10.0D-10" " = TRUE" - gdb_test "p 10.0D-11 > 10.0D-10" " = FALSE" - gdb_test "p 10.0d-11 < 10.0d-10" " = TRUE" - gdb_test "p 10.0d-11 > 10.0d-10" " = FALSE" - gdb_test "p 10.0E-11 < 10.0E-10" " = TRUE" - gdb_test "p 10.0E-11 > 10.0E-10" " = FALSE" - gdb_test "p 10.0e-11 < 10.0e-10" " = TRUE" - gdb_test "p 10.0e-11 > 10.0e-10" " = FALSE" - # looks funny, but apparently legal - gdb_test "p _.1e+10 < _.1e+11" " = TRUE" - gdb_test "p _.1e+10 > _.1e+11" " = FALSE" - gdb_test "p __.1e-12 < __.1e-11" " = TRUE" - gdb_test "p __.1e-12 > __.1e-11" " = FALSE" -} - -proc test_convenience_variables {} { - global gdb_prompt - - gdb_test "set \$foo := 101" " := 101\[\r\]*" \ - "Set a new convenience variable" - - gdb_test "print \$foo" " = 101" \ - "Print contents of new convenience variable" - - gdb_test "set \$foo := 301" " := 301\[\r\]*" \ - "Set convenience variable to a new value" - - gdb_test "print \$foo" " = 301" \ - "Print new contents of convenience variable" - - gdb_test "set \$_ := 11" " := 11\[\r\]*" \ - "Set convenience variable \$_" - - gdb_test "print \$_" " = 11" \ - "Print contents of convenience variable \$_" - - gdb_test "print \$foo + 10" " = 311" \ - "Use convenience variable in arithmetic expression" - - gdb_test "print (\$foo := 32) + 4" " = 36" \ - "Use convenience variable assignment in arithmetic expression" - - gdb_test "print \$bar" " = void" \ - "Print contents of uninitialized convenience variable" -} - -proc test_value_history {} { - global gdb_prompt - - gdb_test "print 101" "\\\$1 = 101" \ - "Set value-history\[1\] using \$1" - - gdb_test "print 102" "\\\$2 = 102" \ - "Set value-history\[2\] using \$2" - - gdb_test "print 103" "\\\$3 = 103" \ - "Set value-history\[3\] using \$3" - - gdb_test "print \$\$" "\\\$4 = 102" \ - "Print value-history\[MAX-1\] using inplicit index \$\$" - - gdb_test "print \$\$" "\\\$5 = 103" \ - "Print value-history\[MAX-1\] again using implicit index \$\$" - - gdb_test "print \$" "\\\$6 = 103" \ - "Print value-history\[MAX\] using implicit index \$" - - gdb_test "print \$\$2" "\\\$7 = 102" \ - "Print value-history\[MAX-2\] using explicit index \$\$2" - - gdb_test "print \$0" "\\\$8 = 102" \ - "Print value-history\[MAX\] using explicit index \$0" - - gdb_test "print 108" "\\\$9 = 108" "" - - gdb_test "print \$\$0" "\\\$10 = 108" \ - "Print value-history\[MAX\] using explicit index \$\$0" - - gdb_test "print \$1" "\\\$11 = 101" \ - "Print value-history\[1\] using explicit index \$1" - - gdb_test "print \$2" "\\\$12 = 102" \ - "Print value-history\[2\] using explicit index \$2" - - gdb_test "print \$3" "\\\$13 = 103" \ - "Print value-history\[3\] using explicit index \$3" - - gdb_test "print \$-3" "\\\$14 = 100" \ - "Print (value-history\[MAX\] - 3) using implicit index \$" - - gdb_test "print \$1 + 3" "\\\$15 = 104" \ - "Use value-history element in arithmetic expression" -} - -proc test_arithmetic_expressions {} { - global gdb_prompt - - # Test unary minus with various operands - -# gdb_test "p -(TRUE)" " = -1" "unary minus applied to bool" -# gdb_test "p -('a')" " = xxx" "unary minus applied to char" - gdb_test "p -(1)" " = -1" "unary minus applied to int" - gdb_test "p -(1.0)" " = -1" "unary minus applied to real" - - # Test addition with various operands - - gdb_test "p TRUE + 1" " = 2" "bool plus int" - gdb_test "p 'a' + 1" " = 98" "char plus int" - gdb_test "p 1 + 1" " = 2" "int plus int" - gdb_test "p 1.0 + 1" " = 2" "real plus int" - gdb_test "p 1.0 + 2.0" " = 3" "real plus real" - - # Test subtraction with various operands - - gdb_test "p TRUE - 1" " = 0" "bool minus int" - gdb_test "p 'b' - 1" " = 97" "char minus int" - gdb_test "p 3 - 1" " = 2" "int minus int" - gdb_test "p 3.0 - 1" " = 2" "real minus int" - gdb_test "p 5.0 - 2.0" " = 3" "real minus real" - - # Test multiplication with various operands - - gdb_test "p TRUE * 1" " = 1" "bool times int" - gdb_test "p 'a' * 2" " = 194" "char times int" - gdb_test "p 2 * 3" " = 6" "int times int" - gdb_test "p 2.0 * 3" " = 6" "real times int" - gdb_test "p 2.0 * 3.0" " = 6" "real times real" - - # Test division with various operands - - gdb_test "p TRUE / 1" " = 1" "bool divided by int" - gdb_test "p 'a' / 2" " = 48" "char divided by int" - gdb_test "p 6 / 3" " = 2" "int divided by int" - gdb_test "p 6.0 / 3" " = 2" "real divided by int" - gdb_test "p 6.0 / 3.0" " = 2" "real divided by real" - - # Test modulo with various operands - - gdb_test "p TRUE MOD 1" " = 0" "bool modulo int" - gdb_test "p 'a' MOD 2" " = 1" "char modulo int" - gdb_test "p -5 MOD 3" " = 1" "negative int modulo int" - gdb_test "p 5 MOD 1" " = 0" "int modulo int" - gdb_test "p 5 MOD 2" " = 1" "int modulo int" - gdb_test "p 5 MOD 3" " = 2" "int modulo int" - gdb_test "p 5 MOD 4" " = 1" "int modulo int" - gdb_test "p 5 MOD 5" " = 0" "int modulo int" - gdb_test "p 0 MOD 1" " = 0" "int modulo int" - gdb_test "p 0 MOD 2" " = 0" "int modulo int" - gdb_test "p 0 MOD 3" " = 0" "int modulo int" - gdb_test "p 0 MOD 4" " = 0" "int modulo int" - gdb_test "p -5 MOD 1" " = 0" "int modulo int" - gdb_test "p -5 MOD 2" " = 1" "int modulo int" - gdb_test "p -5 MOD 3" " = 1" "int modulo int" - gdb_test "p -5 MOD 4" " = 3" "int modulo int" - gdb_test "p -5 MOD 5" " = 0" "int modulo int" - gdb_test "p -5 MOD 5" " = 0" "int modulo int" - test_print_reject "p 6.0 MOD 3" \ - "Integer-only operation on floating point number.*" - test_print_reject "p 6.0 MOD 3.0" \ - "Integer-only operation on floating point number.*" - test_print_reject "p -5 MOD -1" \ - "Second operand of MOD must be greater than zero.*" - test_print_reject "p -5 MOD 0" \ - "Second operand of MOD must be greater than zero.*" - - # Test remainder with various operands - - gdb_test "p TRUE REM 1" " = 0" "bool remainder int" - gdb_test "p 'a' REM 2" " = 1" "char remainder int" - gdb_test "p 5 REM 5" " = 0" "int remainder int" - gdb_test "p 5 REM 4" " = 1" "int remainder int" - gdb_test "p 5 REM 3" " = 2" "int remainder int" - gdb_test "p 5 REM 2" " = 1" "int remainder int" - gdb_test "p 5 REM 1" " = 0" "int remainder int" - gdb_test "p 5 REM -1" " = 0" "int remainder int" - gdb_test "p 5 REM -2" " = 1" "int remainder int" - gdb_test "p 5 REM -3" " = 2" "int remainder int" - gdb_test "p 5 REM -4" " = 1" "int remainder int" - gdb_test "p 5 REM -5" " = 0" "int remainder int" - gdb_test "p -5 REM 5" " = 0" "int remainder int" - gdb_test "p -5 REM 4" " = -1" "int remainder int" - gdb_test "p -5 REM 3" " = -2" "int remainder int" - gdb_test "p -5 REM 2" " = -1" "int remainder int" - gdb_test "p -5 REM 1" " = 0" "int remainder int" - gdb_test "p -5 REM -1" " = 0" "int remainder int" - gdb_test "p -5 REM -2" " = -1" "int remainder int" - gdb_test "p -5 REM -3" " = -2" "int remainder int" - gdb_test "p -5 REM -4" " = -1" "int remainder int" - gdb_test "p -5 REM -5" " = 0" "int remainder int" - gdb_test "p 6 REM 3" " = 0" "int remainder int" - test_print_reject "p 6.0 REM 3" \ - "Integer-only operation on floating point number.*" - test_print_reject "p 6.0 REM 3.0" \ - "Integer-only operation on floating point number.*" -} - -# Start with a fresh gdb. - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir - -gdb_test "set print sevenbit-strings" "" - -if [set_lang_chill] then { - test_value_history - test_convenience_variables - test_integer_literals_accepted - test_integer_literals_rejected - test_boolean_literals_accepted - test_character_literals_accepted - test_float_literals_accepted - test_arithmetic_expressions -} else { - warning "$test_name tests suppressed." 0 -} +# OBSOLETE # Copyright 1992, 1994, 1995, 1998 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 Fred Fish. (fnf@cygnus.com) +# OBSOLETE +# OBSOLETE if $tracelevel then { +# OBSOLETE strace $tracelevel +# OBSOLETE } +# OBSOLETE +# OBSOLETE set prms_id 0 +# OBSOLETE set bug_id 0 +# OBSOLETE +# OBSOLETE # Set the current language to chill. This counts as a test. If it +# OBSOLETE # fails, then we skip the other tests. +# OBSOLETE +# OBSOLETE proc set_lang_chill {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE send_gdb "set language chill\n" +# OBSOLETE gdb_expect { +# OBSOLETE -re ".*$gdb_prompt $" {} +# OBSOLETE timeout { fail "set language chill (timeout)" ; return 0 } +# OBSOLETE } +# OBSOLETE +# OBSOLETE send_gdb "show language\n" +# OBSOLETE gdb_expect { +# OBSOLETE -re ".* source language is \"chill\".*$gdb_prompt $" { +# OBSOLETE pass "set language to \"chill\"" +# OBSOLETE return 1 +# OBSOLETE } +# OBSOLETE -re ".*$gdb_prompt $" { +# OBSOLETE fail "setting language to \"chill\"" +# OBSOLETE return 0 +# OBSOLETE } +# OBSOLETE timeout { +# OBSOLETE fail "can't show language (timeout)" +# OBSOLETE return 0 +# OBSOLETE } +# OBSOLETE } +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_integer_literals_accepted {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # Test various decimal values. +# OBSOLETE +# OBSOLETE gdb_test "p 123" " = 123" +# OBSOLETE gdb_test "p -123" " = -123" +# OBSOLETE gdb_test "p D'123" " = 123" +# OBSOLETE gdb_test "p d'123" " = 123" +# OBSOLETE gdb_test "p -D'123" " = -123" +# OBSOLETE gdb_test "p -d'123" " = -123" +# OBSOLETE gdb_test "p 12_345" " = 12345" +# OBSOLETE gdb_test "p __1_2_3__" " = 123" +# OBSOLETE gdb_test "p/d 123" " = D'123" +# OBSOLETE +# OBSOLETE # Test various binary values. +# OBSOLETE +# OBSOLETE gdb_test "p B'111" " = 7" +# OBSOLETE gdb_test "p b'111" " = 7" +# OBSOLETE gdb_test "p -B'111" " = -7" +# OBSOLETE gdb_test "p B'0111" " = 7" +# OBSOLETE gdb_test "p b'0111" " = 7" +# OBSOLETE gdb_test "p -b'0111" " = -7" +# OBSOLETE gdb_test "p B'_0_1_1_1_" " = 7" +# OBSOLETE gdb_test "p b'_0_1_1_1_" " = 7" +# OBSOLETE gdb_test "p -b'_0_1_1_1_" " = -7" +# OBSOLETE gdb_test "p/t B'111" " = B'111" +# OBSOLETE +# OBSOLETE # Test various octal values. +# OBSOLETE +# OBSOLETE gdb_test "p O'123" " = 83" +# OBSOLETE gdb_test "p o'123" " = 83" +# OBSOLETE gdb_test "p -o'0123" " = -83" +# OBSOLETE gdb_test "p O'0123" " = 83" +# OBSOLETE gdb_test "p o'0123" " = 83" +# OBSOLETE gdb_test "p -o'123" " = -83" +# OBSOLETE gdb_test "p O'_1_2_3_" " = 83" +# OBSOLETE gdb_test "p o'_1_2_3_" " = 83" +# OBSOLETE gdb_test "p -o'_1_2_3_" " = -83" +# OBSOLETE gdb_test "p/o O'123" " = O'123" +# OBSOLETE +# OBSOLETE # Test various hexadecimal values. +# OBSOLETE +# OBSOLETE gdb_test "p H'123" " = 291" +# OBSOLETE gdb_test "p h'123" " = 291" +# OBSOLETE gdb_test "p -h'123" " = -291" +# OBSOLETE gdb_test "p H'0123" " = 291" +# OBSOLETE gdb_test "p h'0123" " = 291" +# OBSOLETE gdb_test "p -h'0123" " = -291" +# OBSOLETE gdb_test "p H'_1_2_3_" " = 291" +# OBSOLETE gdb_test "p h'_1_2_3_" " = 291" +# OBSOLETE gdb_test "p -h'_1_2_3_" " = -291" +# OBSOLETE gdb_test "p H'ABC" " = 2748" +# OBSOLETE gdb_test "p H'abc" " = 2748" +# OBSOLETE gdb_test "p H'AbC" " = 2748" +# OBSOLETE gdb_test "p H'_A_b_C_" " = 2748" +# OBSOLETE gdb_test "p H'_D_e_F_" " = 3567" +# OBSOLETE gdb_test "p H'_d_E_f_" " = 3567" +# OBSOLETE gdb_test "p/x H'123" " = H'123" +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_character_literals_accepted {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # Test various decimal values. +# OBSOLETE +# OBSOLETE gdb_test "p 'a'" " = 'a'" +# OBSOLETE gdb_test "p/x 'a'" " = H'61" +# OBSOLETE gdb_test "p/d 'a'" " = D'97" +# OBSOLETE gdb_test "p/t 'a'" " = B'1100001" +# OBSOLETE # gdb_test "p '^(97)'" " = 'a'" (not in GNU Chill) +# OBSOLETE gdb_test "p C'61'" " = 'a'" +# OBSOLETE gdb_test "p c'61'" " = 'a'" +# OBSOLETE gdb_test "p/x C'FF'" " = H'ff" +# OBSOLETE # gdb_test "p/x '^(H'FF)'" " = H'ff" (not in GNU Chill) +# OBSOLETE # gdb_test "p/x '^(D'255)'" " = H'ff" (not in GNU Chill) +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_integer_literals_rejected {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # These are valid integer literals in Z.200, but not GNU-Chill. +# OBSOLETE +# OBSOLETE test_print_reject "p _" +# OBSOLETE test_print_reject "p __" +# OBSOLETE +# OBSOLETE test_print_reject "p D'" +# OBSOLETE test_print_reject "p D'_" +# OBSOLETE test_print_reject "p D'__" +# OBSOLETE +# OBSOLETE test_print_reject "p B'" +# OBSOLETE test_print_reject "p B'_" +# OBSOLETE test_print_reject "p B'__" +# OBSOLETE +# OBSOLETE test_print_reject "p O'" +# OBSOLETE test_print_reject "p O'_" +# OBSOLETE test_print_reject "p O'__" +# OBSOLETE +# OBSOLETE test_print_reject "p H'" +# OBSOLETE test_print_reject "p H'_" +# OBSOLETE test_print_reject "p H'__" +# OBSOLETE +# OBSOLETE # Test various decimal values. +# OBSOLETE +# OBSOLETE test_print_reject "p D'DEADBEEF" +# OBSOLETE test_print_reject "p D'123DEADBEEF" +# OBSOLETE +# OBSOLETE # Test various binary values. +# OBSOLETE +# OBSOLETE test_print_reject "p B'2" "Too-large digit in bitstring or integer." +# OBSOLETE test_print_reject "p B'12" "Too-large digit in bitstring or integer." +# OBSOLETE +# OBSOLETE # Test various octal values. +# OBSOLETE +# OBSOLETE test_print_reject "p O'9" "Too-large digit in bitstring or integer." +# OBSOLETE test_print_reject "p O'79" "Too-large digit in bitstring or integer." +# OBSOLETE +# OBSOLETE # Test various hexadecimal values. +# OBSOLETE +# OBSOLETE test_print_reject "p H'G" "Invalid character in bitstring or integer." +# OBSOLETE test_print_reject "p H'AG" "Invalid character in bitstring or integer." +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_boolean_literals_accepted {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # Test the only possible values for a boolean, TRUE and FALSE. +# OBSOLETE +# OBSOLETE gdb_test "p TRUE" " = TRUE" +# OBSOLETE gdb_test "p FALSE" " = FALSE" +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_float_literals_accepted {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # Test various floating point formats +# OBSOLETE +# OBSOLETE gdb_test "p .44 < .45" " = TRUE" +# OBSOLETE gdb_test "p .44 > .45" " = FALSE" +# OBSOLETE gdb_test "p 0.44 < 0.45" " = TRUE" +# OBSOLETE gdb_test "p 0.44 > 0.45" " = FALSE" +# OBSOLETE gdb_test "p 44. < 45." " = TRUE" +# OBSOLETE gdb_test "p 44. > 45." " = FALSE" +# OBSOLETE gdb_test "p 44.0 < 45.0" " = TRUE" +# OBSOLETE gdb_test "p 44.0 > 45.0" " = FALSE" +# OBSOLETE gdb_test "p 10D20 < 10D21" " = TRUE" +# OBSOLETE gdb_test "p 10D20 > 10D21" " = FALSE" +# OBSOLETE gdb_test "p 10d20 < 10d21" " = TRUE" +# OBSOLETE gdb_test "p 10d20 > 10d21" " = FALSE" +# OBSOLETE gdb_test "p 10E20 < 10E21" " = TRUE" +# OBSOLETE gdb_test "p 10E20 > 10E21" " = FALSE" +# OBSOLETE gdb_test "p 10e20 < 10e21" " = TRUE" +# OBSOLETE gdb_test "p 10e20 > 10e21" " = FALSE" +# OBSOLETE gdb_test "p 10.D20 < 10.D21" " = TRUE" +# OBSOLETE gdb_test "p 10.D20 > 10.D21" " = FALSE" +# OBSOLETE gdb_test "p 10.d20 < 10.d21" " = TRUE" +# OBSOLETE gdb_test "p 10.d20 > 10.d21" " = FALSE" +# OBSOLETE gdb_test "p 10.E20 < 10.E21" " = TRUE" +# OBSOLETE gdb_test "p 10.E20 > 10.E21" " = FALSE" +# OBSOLETE gdb_test "p 10.e20 < 10.e21" " = TRUE" +# OBSOLETE gdb_test "p 10.e20 > 10.e21" " = FALSE" +# OBSOLETE gdb_test "p 10.0D20 < 10.0D21" " = TRUE" +# OBSOLETE gdb_test "p 10.0D20 > 10.0D21" " = FALSE" +# OBSOLETE gdb_test "p 10.0d20 < 10.0d21" " = TRUE" +# OBSOLETE gdb_test "p 10.0d20 > 10.0d21" " = FALSE" +# OBSOLETE gdb_test "p 10.0E20 < 10.0E21" " = TRUE" +# OBSOLETE gdb_test "p 10.0E20 > 10.0E21" " = FALSE" +# OBSOLETE gdb_test "p 10.0e20 < 10.0e21" " = TRUE" +# OBSOLETE gdb_test "p 10.0e20 > 10.0e21" " = FALSE" +# OBSOLETE gdb_test "p 10.0D+20 < 10.0D+21" " = TRUE" +# OBSOLETE gdb_test "p 10.0D+20 > 10.0D+21" " = FALSE" +# OBSOLETE gdb_test "p 10.0d+20 < 10.0d+21" " = TRUE" +# OBSOLETE gdb_test "p 10.0d+20 > 10.0d+21" " = FALSE" +# OBSOLETE gdb_test "p 10.0E+20 < 10.0E+21" " = TRUE" +# OBSOLETE gdb_test "p 10.0E+20 > 10.0E+21" " = FALSE" +# OBSOLETE gdb_test "p 10.0e+20 < 10.0e+21" " = TRUE" +# OBSOLETE gdb_test "p 10.0e+20 > 10.0e+21" " = FALSE" +# OBSOLETE gdb_test "p 10.0D-11 < 10.0D-10" " = TRUE" +# OBSOLETE gdb_test "p 10.0D-11 > 10.0D-10" " = FALSE" +# OBSOLETE gdb_test "p 10.0d-11 < 10.0d-10" " = TRUE" +# OBSOLETE gdb_test "p 10.0d-11 > 10.0d-10" " = FALSE" +# OBSOLETE gdb_test "p 10.0E-11 < 10.0E-10" " = TRUE" +# OBSOLETE gdb_test "p 10.0E-11 > 10.0E-10" " = FALSE" +# OBSOLETE gdb_test "p 10.0e-11 < 10.0e-10" " = TRUE" +# OBSOLETE gdb_test "p 10.0e-11 > 10.0e-10" " = FALSE" +# OBSOLETE # looks funny, but apparently legal +# OBSOLETE gdb_test "p _.1e+10 < _.1e+11" " = TRUE" +# OBSOLETE gdb_test "p _.1e+10 > _.1e+11" " = FALSE" +# OBSOLETE gdb_test "p __.1e-12 < __.1e-11" " = TRUE" +# OBSOLETE gdb_test "p __.1e-12 > __.1e-11" " = FALSE" +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_convenience_variables {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE gdb_test "set \$foo := 101" " := 101\[\r\]*" \ +\# OBSOLETE "Set a new convenience variable" +# OBSOLETE +# OBSOLETE gdb_test "print \$foo" " = 101" \ +\# OBSOLETE "Print contents of new convenience variable" +# OBSOLETE +# OBSOLETE gdb_test "set \$foo := 301" " := 301\[\r\]*" \ +\# OBSOLETE "Set convenience variable to a new value" +# OBSOLETE +# OBSOLETE gdb_test "print \$foo" " = 301" \ +\# OBSOLETE "Print new contents of convenience variable" +# OBSOLETE +# OBSOLETE gdb_test "set \$_ := 11" " := 11\[\r\]*" \ +\# OBSOLETE "Set convenience variable \$_" +# OBSOLETE +# OBSOLETE gdb_test "print \$_" " = 11" \ +\# OBSOLETE "Print contents of convenience variable \$_" +# OBSOLETE +# OBSOLETE gdb_test "print \$foo + 10" " = 311" \ +\# OBSOLETE "Use convenience variable in arithmetic expression" +# OBSOLETE +# OBSOLETE gdb_test "print (\$foo := 32) + 4" " = 36" \ +\# OBSOLETE "Use convenience variable assignment in arithmetic expression" +# OBSOLETE +# OBSOLETE gdb_test "print \$bar" " = void" \ +\# OBSOLETE "Print contents of uninitialized convenience variable" +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_value_history {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE gdb_test "print 101" "\\\$1 = 101" \ +\# OBSOLETE "Set value-history\[1\] using \$1" +# OBSOLETE +# OBSOLETE gdb_test "print 102" "\\\$2 = 102" \ +\# OBSOLETE "Set value-history\[2\] using \$2" +# OBSOLETE +# OBSOLETE gdb_test "print 103" "\\\$3 = 103" \ +\# OBSOLETE "Set value-history\[3\] using \$3" +# OBSOLETE +# OBSOLETE gdb_test "print \$\$" "\\\$4 = 102" \ +\# OBSOLETE "Print value-history\[MAX-1\] using inplicit index \$\$" +# OBSOLETE +# OBSOLETE gdb_test "print \$\$" "\\\$5 = 103" \ +\# OBSOLETE "Print value-history\[MAX-1\] again using implicit index \$\$" +# OBSOLETE +# OBSOLETE gdb_test "print \$" "\\\$6 = 103" \ +\# OBSOLETE "Print value-history\[MAX\] using implicit index \$" +# OBSOLETE +# OBSOLETE gdb_test "print \$\$2" "\\\$7 = 102" \ +\# OBSOLETE "Print value-history\[MAX-2\] using explicit index \$\$2" +# OBSOLETE +# OBSOLETE gdb_test "print \$0" "\\\$8 = 102" \ +\# OBSOLETE "Print value-history\[MAX\] using explicit index \$0" +# OBSOLETE +# OBSOLETE gdb_test "print 108" "\\\$9 = 108" "" +# OBSOLETE +# OBSOLETE gdb_test "print \$\$0" "\\\$10 = 108" \ +\# OBSOLETE "Print value-history\[MAX\] using explicit index \$\$0" +# OBSOLETE +# OBSOLETE gdb_test "print \$1" "\\\$11 = 101" \ +\# OBSOLETE "Print value-history\[1\] using explicit index \$1" +# OBSOLETE +# OBSOLETE gdb_test "print \$2" "\\\$12 = 102" \ +\# OBSOLETE "Print value-history\[2\] using explicit index \$2" +# OBSOLETE +# OBSOLETE gdb_test "print \$3" "\\\$13 = 103" \ +\# OBSOLETE "Print value-history\[3\] using explicit index \$3" +# OBSOLETE +# OBSOLETE gdb_test "print \$-3" "\\\$14 = 100" \ +\# OBSOLETE "Print (value-history\[MAX\] - 3) using implicit index \$" +# OBSOLETE +# OBSOLETE gdb_test "print \$1 + 3" "\\\$15 = 104" \ +\# OBSOLETE "Use value-history element in arithmetic expression" +# OBSOLETE } +# OBSOLETE +# OBSOLETE proc test_arithmetic_expressions {} { +# OBSOLETE global gdb_prompt +# OBSOLETE +# OBSOLETE # Test unary minus with various operands +# OBSOLETE +# OBSOLETE # gdb_test "p -(TRUE)" " = -1" "unary minus applied to bool" +# OBSOLETE # gdb_test "p -('a')" " = xxx" "unary minus applied to char" +# OBSOLETE gdb_test "p -(1)" " = -1" "unary minus applied to int" +# OBSOLETE gdb_test "p -(1.0)" " = -1" "unary minus applied to real" +# OBSOLETE +# OBSOLETE # Test addition with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE + 1" " = 2" "bool plus int" +# OBSOLETE gdb_test "p 'a' + 1" " = 98" "char plus int" +# OBSOLETE gdb_test "p 1 + 1" " = 2" "int plus int" +# OBSOLETE gdb_test "p 1.0 + 1" " = 2" "real plus int" +# OBSOLETE gdb_test "p 1.0 + 2.0" " = 3" "real plus real" +# OBSOLETE +# OBSOLETE # Test subtraction with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE - 1" " = 0" "bool minus int" +# OBSOLETE gdb_test "p 'b' - 1" " = 97" "char minus int" +# OBSOLETE gdb_test "p 3 - 1" " = 2" "int minus int" +# OBSOLETE gdb_test "p 3.0 - 1" " = 2" "real minus int" +# OBSOLETE gdb_test "p 5.0 - 2.0" " = 3" "real minus real" +# OBSOLETE +# OBSOLETE # Test multiplication with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE * 1" " = 1" "bool times int" +# OBSOLETE gdb_test "p 'a' * 2" " = 194" "char times int" +# OBSOLETE gdb_test "p 2 * 3" " = 6" "int times int" +# OBSOLETE gdb_test "p 2.0 * 3" " = 6" "real times int" +# OBSOLETE gdb_test "p 2.0 * 3.0" " = 6" "real times real" +# OBSOLETE +# OBSOLETE # Test division with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE / 1" " = 1" "bool divided by int" +# OBSOLETE gdb_test "p 'a' / 2" " = 48" "char divided by int" +# OBSOLETE gdb_test "p 6 / 3" " = 2" "int divided by int" +# OBSOLETE gdb_test "p 6.0 / 3" " = 2" "real divided by int" +# OBSOLETE gdb_test "p 6.0 / 3.0" " = 2" "real divided by real" +# OBSOLETE +# OBSOLETE # Test modulo with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE MOD 1" " = 0" "bool modulo int" +# OBSOLETE gdb_test "p 'a' MOD 2" " = 1" "char modulo int" +# OBSOLETE gdb_test "p -5 MOD 3" " = 1" "negative int modulo int" +# OBSOLETE gdb_test "p 5 MOD 1" " = 0" "int modulo int" +# OBSOLETE gdb_test "p 5 MOD 2" " = 1" "int modulo int" +# OBSOLETE gdb_test "p 5 MOD 3" " = 2" "int modulo int" +# OBSOLETE gdb_test "p 5 MOD 4" " = 1" "int modulo int" +# OBSOLETE gdb_test "p 5 MOD 5" " = 0" "int modulo int" +# OBSOLETE gdb_test "p 0 MOD 1" " = 0" "int modulo int" +# OBSOLETE gdb_test "p 0 MOD 2" " = 0" "int modulo int" +# OBSOLETE gdb_test "p 0 MOD 3" " = 0" "int modulo int" +# OBSOLETE gdb_test "p 0 MOD 4" " = 0" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 1" " = 0" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 2" " = 1" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 3" " = 1" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 4" " = 3" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 5" " = 0" "int modulo int" +# OBSOLETE gdb_test "p -5 MOD 5" " = 0" "int modulo int" +# OBSOLETE test_print_reject "p 6.0 MOD 3" \ +\# OBSOLETE "Integer-only operation on floating point number.*" +# OBSOLETE test_print_reject "p 6.0 MOD 3.0" \ +\# OBSOLETE "Integer-only operation on floating point number.*" +# OBSOLETE test_print_reject "p -5 MOD -1" \ +\# OBSOLETE "Second operand of MOD must be greater than zero.*" +# OBSOLETE test_print_reject "p -5 MOD 0" \ +\# OBSOLETE "Second operand of MOD must be greater than zero.*" +# OBSOLETE +# OBSOLETE # Test remainder with various operands +# OBSOLETE +# OBSOLETE gdb_test "p TRUE REM 1" " = 0" "bool remainder int" +# OBSOLETE gdb_test "p 'a' REM 2" " = 1" "char remainder int" +# OBSOLETE gdb_test "p 5 REM 5" " = 0" "int remainder int" +# OBSOLETE gdb_test "p 5 REM 4" " = 1" "int remainder int" +# OBSOLETE gdb_test "p 5 REM 3" " = 2" "int remainder int" +# OBSOLETE gdb_test "p 5 REM 2" " = 1" "int remainder int" +# OBSOLETE gdb_test "p 5 REM 1" " = 0" "int remainder int" +# OBSOLETE gdb_test "p 5 REM -1" " = 0" "int remainder int" +# OBSOLETE gdb_test "p 5 REM -2" " = 1" "int remainder int" +# OBSOLETE gdb_test "p 5 REM -3" " = 2" "int remainder int" +# OBSOLETE gdb_test "p 5 REM -4" " = 1" "int remainder int" +# OBSOLETE gdb_test "p 5 REM -5" " = 0" "int remainder int" +# OBSOLETE gdb_test "p -5 REM 5" " = 0" "int remainder int" +# OBSOLETE gdb_test "p -5 REM 4" " = -1" "int remainder int" +# OBSOLETE gdb_test "p -5 REM 3" " = -2" "int remainder int" +# OBSOLETE gdb_test "p -5 REM 2" " = -1" "int remainder int" +# OBSOLETE gdb_test "p -5 REM 1" " = 0" "int remainder int" +# OBSOLETE gdb_test "p -5 REM -1" " = 0" "int remainder int" +# OBSOLETE gdb_test "p -5 REM -2" " = -1" "int remainder int" +# OBSOLETE gdb_test "p -5 REM -3" " = -2" "int remainder int" +# OBSOLETE gdb_test "p -5 REM -4" " = -1" "int remainder int" +# OBSOLETE gdb_test "p -5 REM -5" " = 0" "int remainder int" +# OBSOLETE gdb_test "p 6 REM 3" " = 0" "int remainder int" +# OBSOLETE test_print_reject "p 6.0 REM 3" \ +\# OBSOLETE "Integer-only operation on floating point number.*" +# OBSOLETE test_print_reject "p 6.0 REM 3.0" \ +\# OBSOLETE "Integer-only operation on floating point number.*" +# OBSOLETE } +# OBSOLETE +# OBSOLETE # Start with a fresh gdb. +# OBSOLETE +# OBSOLETE gdb_exit +# OBSOLETE gdb_start +# OBSOLETE gdb_reinitialize_dir $srcdir/$subdir +# OBSOLETE +# OBSOLETE gdb_test "set print sevenbit-strings" "" +# OBSOLETE +# OBSOLETE if [set_lang_chill] then { +# OBSOLETE test_value_history +# OBSOLETE test_convenience_variables +# OBSOLETE test_integer_literals_accepted +# OBSOLETE test_integer_literals_rejected +# OBSOLETE test_boolean_literals_accepted +# OBSOLETE test_character_literals_accepted +# OBSOLETE test_float_literals_accepted +# OBSOLETE test_arithmetic_expressions +# OBSOLETE } else { +# OBSOLETE warning "$test_name tests suppressed." 0 +# OBSOLETE } diff --git a/gdb/testsuite/gdb.chill/pr-5016.exp b/gdb/testsuite/gdb.chill/pr-5016.exp index f01c1bf..1d3a5d4 100644 --- a/gdb/testsuite/gdb.chill/pr-5016.exp +++ b/gdb/testsuite/gdb.chill/pr-5016.exp @@ -60,4 +60,3 @@ # OBSOLETE } # OBSOLETE # OBSOLETE do_tests - diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog index 0a89d16..8b4426b 100644 --- a/gdb/testsuite/gdb.mi/ChangeLog +++ b/gdb/testsuite/gdb.mi/ChangeLog @@ -1,3 +1,34 @@ +2002-11-05 Jeff Johnston <jjohnstn@redhat.com> + + * gdb792.cc: New file to test patch for PR gdb/792. + * gdb792.exp: Ditto. + +2002-11-04 Elena Zannoni <ezannoni@redhat.com> + + * mi-console.exp: Use mi_runto, mi_run_to_main, mi_next_to, + mi_step_to wherever possible. Update copyright notices. + * mi-disassemble.exp: Ditto. + * mi-eval.exp: Ditto. + * mi-read-memory.exp: Ditto. + * mi-regs.exp: Ditto. + * mi-return.exp: Ditto. + * mi-stack.exp: Ditto. + * mi-stepi.exp: Ditto. + * mi-var-block.exp: Ditto. + * mi-var-cmd.exp: Ditto. + * mi-watch.exp: Ditto. + * mi1-console.exp: Ditto. + * mi1-disassemble.exp: Ditto. + * mi1-eval.exp: Ditto. + * mi1-read-memory.exp: Ditto. + * mi1-regs.exp: Ditto. + * mi1-return.exp: Ditto. + * mi1-stack.exp: Ditto. + * mi1-stepi.exp: Ditto. + * mi1-var-block.exp: Ditto. + * mi1-var-cmd.exp: Ditto. + * mi1-watch.exp: Ditto. + 2002-10-23 Jeff Johnston <jjohnstn@redhat.com> * mi-var-cmd.exp: Add tests to verify that a -var-assign that changes diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp index f8bb36e..f611aa7 100644 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ b/gdb/testsuite/gdb.mi/mi-console.exp @@ -51,22 +51,7 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -# Halt in main -mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \ - "break-insert operation" -mi_run_cmd -gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } -} +mi_run_to_main # Next over the hello() call which will produce lots of output send_gdb "47-exec-next\n" diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp index 6f33d67..46f00dd 100644 --- a/gdb/testsuite/gdb.mi/mi-disassemble.exp +++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,51 +43,6 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{.*,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - proc test_disassembly_only {} { global mi_gdb_prompt global hex @@ -212,8 +167,7 @@ proc test_disassembly_bogus_args {} { } -test_breakpoints_creation_and_listing -test_running_the_program +mi_run_to_main test_disassembly_only test_disassembly_mixed test_disassembly_bogus_args diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp index 2c01410..536dd79 100644 --- a/gdb/testsuite/gdb.mi/mi-eval.exp +++ b/gdb/testsuite/gdb.mi/mi-eval.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,47 +46,8 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } - - send_gdb "101-exec-next\n" - gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \ - { pass "next in callee4" } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"} - timeout {fail "next in callee4 (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"} - timeout {fail "next in callee4 (timeout 1)"} - } - -} - -test_running_the_program +mi_runto callee4 +mi_next_to "callee4" "" "basics.c" "9" "next at callee4" mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" diff --git a/gdb/testsuite/gdb.mi/mi-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp index b4f0c35..573c896 100644 --- a/gdb/testsuite/gdb.mi/mi-read-memory.exp +++ b/gdb/testsuite/gdb.mi/mi-read-memory.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,21 +46,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb mi_run_to_main - -#mi_next "do initialization" -send_gdb "101-exec-next\n" -gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \ - { pass "do initialization" } - -re ".*$mi_gdb_prompt$" {fail "do initialization (2)"} - timeout {fail "do initialization (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "do initialization (1)"} - timeout {fail "do initialization (timeout 1)"} -} +mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" mi_gdb_test "1-data-read-memory" \ "1\\^error,msg=\".*\"" \ diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp index c427677..a6a6406 100644 --- a/gdb/testsuite/gdb.mi/mi-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-regs.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,51 +45,6 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - proc sparc_register_tests_no_exec { } { # Test the generic IDT chip. mi_gdb_test "111-data-list-register-values" \ @@ -164,8 +119,7 @@ proc sparc_register_tests { } { if [istarget "sparc-*-*"] then { sparc_register_tests_no_exec - test_breakpoints_creation_and_listing - test_running_the_program + mi_run_to_main sparc_register_tests } else { verbose "mi-regs.exp tests ignored for this target" diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp index 1e7c863..ca37e9f 100644 --- a/gdb/testsuite/gdb.mi/mi-return.exp +++ b/gdb/testsuite/gdb.mi/mi-return.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,33 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_to_callee4 {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" { - fail "run to callee4 (2)" - } - timeout { - fail "run to callee4 (timeout)" - } - } - - mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -} proc test_return_simple {} { global mi_gdb_prompt @@ -87,7 +60,12 @@ proc test_return_simple {} { } } -test_running_to_callee4 +mi_runto callee4 + +mi_gdb_test "205-break-delete" \ + "205\\^done.*" \ + "delete all breakpoints" + test_return_simple mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index 4c682e2..92c651d 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -1,4 +1,4 @@ -# Copyright 2000 Free Software Foundation, Inc. +# Copyright 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,22 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} -} - - proc test_stack_frame_listing {} { global mi_gdb_prompt global hex @@ -208,6 +192,7 @@ gdb_expect { } +mi_runto callee4 test_stack_frame_listing test_stack_args_listing test_stack_locals_listing diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp index e0de2f2..44e6442 100644 --- a/gdb/testsuite/gdb.mi/mi-stepi.exp +++ b/gdb/testsuite/gdb.mi/mi-stepi.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,29 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_to_main {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } -} - proc test_stepi_nexti {} { global mi_gdb_prompt global hex @@ -102,7 +79,7 @@ proc test_stepi_nexti {} { } } -test_running_to_main +mi_run_to_main test_stepi_nexti mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index 506275c..a0b456a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. # # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,19 +42,7 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -mi_gdb_test "200-break-insert do_block_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_block_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"} - timeout {fail "run to do_block_tests (timeout 2)"} -} +mi_runto do_block_tests # Test: c_variable-3.2 # Desc: create cb and foo @@ -67,15 +55,7 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test" # Be paranoid and assume 3.2 created foo @@ -91,15 +71,7 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo2 = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test" # Test: c_variable-3.4 # Desc: check foo, cb changed @@ -108,15 +80,7 @@ mi_gdb_test "-var-update *" \ "update all vars: cb foo changed" # step to "foo = 321;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test" # Test: c_variable-3.5 # Desc: create inner block foo @@ -125,13 +89,7 @@ mi_gdb_test "-var-create inner_foo * foo" \ "create local variable inner_foo" # step to "foo2 = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test" # Test: c_variable-3.6 # Desc: create foo2 @@ -163,13 +121,7 @@ mi_gdb_test "-var-delete inner_foo" \ "delete var inner_foo" # step to "foo = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test" # Test: c_variable-3.8 # Desc: check that foo2 out of scope (known gdb problem) @@ -180,14 +132,7 @@ mi_gdb_test "-var-update foo2" \ clear_xfail *-*-* # step to "cb = 21;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} - +mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test" # Test: c_variable-3.9 # Desc: check that only cb is in scope (known gdb problem) diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 1902793..7d02b36 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. # # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -70,19 +70,7 @@ mi_gdb_test "113-var-create argc * argc" \ "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ "create out of scope variable" -mi_gdb_test "200-break-insert do_locals_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_locals_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_locals_tests (2)"} - timeout {fail "run to do_locals_tests (timeout 2)"} -} +mi_runto do_locals_tests # Test: c_variable-1.4 # Desc: create local variables diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp index 25db598..ba24399 100644 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ b/gdb/testsuite/gdb.mi/mi-watch.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -115,31 +115,6 @@ proc test_rwatch_creation_and_listing {} { "delete read watchpoint" } -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } -} - proc test_watchpoint_triggering {} { global mi_gdb_prompt global hex @@ -181,7 +156,7 @@ proc test_watchpoint_triggering {} { } } -test_running_the_program +mi_runto callee4 test_watchpoint_creation_and_listing #test_rwatch_creation_and_listing #test_awatch_creation_and_listing diff --git a/gdb/testsuite/gdb.mi/mi1-console.exp b/gdb/testsuite/gdb.mi/mi1-console.exp index 5a6d6f2..25af50a 100644 --- a/gdb/testsuite/gdb.mi/mi1-console.exp +++ b/gdb/testsuite/gdb.mi/mi1-console.exp @@ -51,22 +51,7 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -# Halt in main -mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \ - "break-insert operation" -mi_run_cmd -gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } -} +mi_run_to_main # Next over the hello() call which will produce lots of output send_gdb "47-exec-next\n" diff --git a/gdb/testsuite/gdb.mi/mi1-disassemble.exp b/gdb/testsuite/gdb.mi/mi1-disassemble.exp index 65af76d..7292a35 100644 --- a/gdb/testsuite/gdb.mi/mi1-disassemble.exp +++ b/gdb/testsuite/gdb.mi/mi1-disassemble.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,51 +43,6 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{.*,body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - proc test_disassembly_only {} { global mi_gdb_prompt global hex @@ -212,8 +167,7 @@ proc test_disassembly_bogus_args {} { } -test_breakpoints_creation_and_listing -test_running_the_program +mi_run_to_main test_disassembly_only test_disassembly_mixed test_disassembly_bogus_args diff --git a/gdb/testsuite/gdb.mi/mi1-eval.exp b/gdb/testsuite/gdb.mi/mi1-eval.exp index 898c7b7..330e00d 100644 --- a/gdb/testsuite/gdb.mi/mi1-eval.exp +++ b/gdb/testsuite/gdb.mi/mi1-eval.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,47 +46,8 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } - - send_gdb "101-exec-next\n" - gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \ - { pass "next in callee4" } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"} - timeout {fail "next in callee4 (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"} - timeout {fail "next in callee4 (timeout 1)"} - } - -} - -test_running_the_program +mi_runto callee4 +mi_next_to "callee4" "" "basics.c" "9" "next at callee4" mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" diff --git a/gdb/testsuite/gdb.mi/mi1-read-memory.exp b/gdb/testsuite/gdb.mi/mi1-read-memory.exp index 2796078..9a0acf4 100644 --- a/gdb/testsuite/gdb.mi/mi1-read-memory.exp +++ b/gdb/testsuite/gdb.mi/mi1-read-memory.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,19 +48,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb mi_run_to_main #mi_next "do initialization" -send_gdb "101-exec-next\n" -gdb_expect { - -re "101\\^running\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \ - { pass "do initialization" } - -re ".*$mi_gdb_prompt$" {fail "do initialization (2)"} - timeout {fail "do initialization (timeout 2)"} - } - } - -re ".*$mi_gdb_prompt$" {fail "do initialization (1)"} - timeout {fail "do initialization (timeout 1)"} -} + +mi_next_to "main" "" "mi-read-memory.c" "20" "next at main" mi_gdb_test "1-data-read-memory" \ "1\\^error,msg=\".*\"" \ diff --git a/gdb/testsuite/gdb.mi/mi1-regs.exp b/gdb/testsuite/gdb.mi/mi1-regs.exp index b4baa18..bf59907 100644 --- a/gdb/testsuite/gdb.mi/mi1-regs.exp +++ b/gdb/testsuite/gdb.mi/mi1-regs.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,51 +45,6 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_breakpoints_creation_and_listing {} { - global mi_gdb_prompt - global srcfile - global hex - - # Insert some breakpoints and list them - # Also, disable some so they do not interfere with other tests - # Tests: - # -break-insert - # -break-list - # -break-disable - # -break-info - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_gdb_test "204-break-list" \ - "204\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\\\]\}" \ - "list of breakpoints" -} - -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args - # Tests: - # -exec-run - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # FIXME: We are accepting a duplicate file and line info temporarely. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" {fail "run to main (2)"} - timeout {fail "run to main (timeout 2)"} - } -} - proc sparc_register_tests_no_exec { } { # Test the generic IDT chip. mi_gdb_test "111-data-list-register-values" \ @@ -164,8 +119,7 @@ proc sparc_register_tests { } { if [istarget "sparc-*-*"] then { sparc_register_tests_no_exec - test_breakpoints_creation_and_listing - test_running_the_program + mi_run_to_main sparc_register_tests } else { verbose "mi-regs.exp tests ignored for this target" diff --git a/gdb/testsuite/gdb.mi/mi1-return.exp b/gdb/testsuite/gdb.mi/mi1-return.exp index 0fcbbfe..539a61c 100644 --- a/gdb/testsuite/gdb.mi/mi1-return.exp +++ b/gdb/testsuite/gdb.mi/mi1-return.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,33 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_to_callee4 {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" { - fail "run to callee4 (2)" - } - timeout { - fail "run to callee4 (timeout)" - } - } - - mi_gdb_test "205-break-delete" \ - "205\\^done.*" \ - "delete all breakpoints" - -} proc test_return_simple {} { global mi_gdb_prompt @@ -87,7 +60,12 @@ proc test_return_simple {} { } } -test_running_to_callee4 +mi_runto callee4 + +mi_gdb_test "205-break-delete" \ + "205\\^done.*" \ + "delete all breakpoints" + test_return_simple mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi1-stack.exp b/gdb/testsuite/gdb.mi/mi1-stack.exp index 45b8b83..b8c7cab 100644 --- a/gdb/testsuite/gdb.mi/mi1-stack.exp +++ b/gdb/testsuite/gdb.mi/mi1-stack.exp @@ -1,4 +1,4 @@ -# Copyright 2000 Free Software Foundation, Inc. +# Copyright 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,22 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} - -mi_gdb_test "200-break-insert callee4" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" { - pass "run to callee4" - } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} -} - - proc test_stack_frame_listing {} { global mi_gdb_prompt global hex @@ -208,6 +192,7 @@ gdb_expect { } +mi_runto callee4 test_stack_frame_listing test_stack_args_listing test_stack_locals_listing diff --git a/gdb/testsuite/gdb.mi/mi1-stepi.exp b/gdb/testsuite/gdb.mi/mi1-stepi.exp index 5634479..a706637 100644 --- a/gdb/testsuite/gdb.mi/mi1-stepi.exp +++ b/gdb/testsuite/gdb.mi/mi1-stepi.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,29 +46,6 @@ mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -proc test_running_to_main {} { - global mi_gdb_prompt - global hex - - mi_gdb_test "200-break-insert main" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \ - "break-insert operation" - - mi_run_cmd - - gdb_expect { - -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" { - pass "run to main" - } - -re ".*$mi_gdb_prompt$" { - fail "run to main (2)" - } - timeout { - fail "run to main (timeout)" - } - } -} - proc test_stepi_nexti {} { global mi_gdb_prompt global hex @@ -102,7 +79,7 @@ proc test_stepi_nexti {} { } } -test_running_to_main +mi_run_to_main test_stepi_nexti mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi1-var-block.exp b/gdb/testsuite/gdb.mi/mi1-var-block.exp index 1478280..0ff9356 100644 --- a/gdb/testsuite/gdb.mi/mi1-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi1-var-block.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. # # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,19 +42,7 @@ mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} -mi_gdb_test "200-break-insert do_block_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_block_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"} - timeout {fail "run to do_block_tests (timeout 2)"} -} +mi_runto do_block_tests # Test: c_variable-3.2 # Desc: create cb and foo @@ -67,15 +55,7 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test" # Be paranoid and assume 3.2 created foo @@ -91,15 +71,7 @@ mi_gdb_test "-var-create foo * foo" \ "create local variable foo" # step to "foo2 = 123;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test" # Test: c_variable-3.4 # Desc: check foo, cb changed @@ -108,15 +80,7 @@ mi_gdb_test "-var-update *" \ "update all vars: cb foo changed" # step to "foo = 321;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { - fail "step at do_block_tests (timeout)" - } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test" # Test: c_variable-3.5 # Desc: create inner block foo @@ -125,13 +89,7 @@ mi_gdb_test "-var-create inner_foo * foo" \ "create local variable inner_foo" # step to "foo2 = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test" # Test: c_variable-3.6 # Desc: create foo2 @@ -163,13 +121,7 @@ mi_gdb_test "-var-delete inner_foo" \ "delete var inner_foo" # step to "foo = 0;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} +mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test" # Test: c_variable-3.8 # Desc: check that foo2 out of scope (known gdb problem) @@ -180,14 +132,7 @@ mi_gdb_test "-var-update foo2" \ clear_xfail *-*-* # step to "cb = 21;" -send_gdb "-exec-step\n" -gdb_expect { - -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" { - pass "step at do_block_tests" - } - timeout { fail "step at do_block_tests (timeout)" } -} - +mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test" # Test: c_variable-3.9 # Desc: check that only cb is in scope (known gdb problem) diff --git a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp index 0f0d522..c6a88b6 100644 --- a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. # # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -70,19 +70,7 @@ mi_gdb_test "113-var-create argc * argc" \ "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ "create out of scope variable" -mi_gdb_test "200-break-insert do_locals_tests" \ - "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \ - "break-insert operation" - -mi_run_cmd -# The running part has been checked already by mi_run_cmd -gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" { - pass "run to do_locals_tests" - } - -re ".*$mi_gdb_prompt$" {fail "run to do_locals_tests (2)"} - timeout {fail "run to do_locals_tests (timeout 2)"} -} +mi_runto do_locals_tests # Test: c_variable-1.4 # Desc: create local variables diff --git a/gdb/testsuite/gdb.mi/mi1-watch.exp b/gdb/testsuite/gdb.mi/mi1-watch.exp index 937eb2c..dfb97ae 100644 --- a/gdb/testsuite/gdb.mi/mi1-watch.exp +++ b/gdb/testsuite/gdb.mi/mi1-watch.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -115,31 +115,6 @@ proc test_rwatch_creation_and_listing {} { "delete read watchpoint" } -proc test_running_the_program {} { - global mi_gdb_prompt - global hex - - # Run the program without args, then specify srgs and rerun the program - # Tests: - # -exec-run - - mi_gdb_test "300-break-insert callee4" \ - "300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \ - "insert breakpoint at callee4" - - # mi_gdb_test cannot be used for asynchronous commands because there are - # two prompts involved and this can lead to a race condition. - # The following is equivalent to a send_gdb "000-exec-run\n" - mi_run_cmd - # The running part has been checked already by mi_run_cmd - gdb_expect { - -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \ - { pass "run to callee4" } - -re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"} - timeout {fail "run to callee4 (timeout 2)"} - } -} - proc test_watchpoint_triggering {} { global mi_gdb_prompt global hex @@ -181,7 +156,7 @@ proc test_watchpoint_triggering {} { } } -test_running_the_program +mi_runto callee4 test_watchpoint_creation_and_listing #test_rwatch_creation_and_listing #test_awatch_creation_and_listing diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 0395afa..de775b6 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -123,7 +123,26 @@ proc mi_gdb_start { } { return 1; } gdb_expect { - -re ".*$mi_gdb_prompt$" { + -re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" { + # We have a new format mi startup prompt. If we are + # running mi1, then this is an error as we should be + # using the old-style prompt. + if { $MIFLAGS == "-i=mi1" } { + perror "(mi startup) Got unexpected new mi prompt." + remote_close host; + return -1; + } + verbose "GDB initialized." + } + -re "\[^~\].*$mi_gdb_prompt$" { + # We have an old format mi startup prompt. If we are + # not running mi1, then this is an error as we should be + # using the new-style prompt. + if { $MIFLAGS != "-i=mi1" } { + perror "(mi startup) Got unexpected old mi prompt." + remote_close host; + return -1; + } verbose "GDB initialized." } -re ".*$gdb_prompt $" { diff --git a/gdb/thread-db.c b/gdb/thread-db.c index d38db74..9338c57 100644 --- a/gdb/thread-db.c +++ b/gdb/thread-db.c @@ -32,6 +32,7 @@ #include "objfiles.h" #include "target.h" #include "regcache.h" +#include "solib-svr4.h" #ifndef LIBTHREAD_DB_SO #define LIBTHREAD_DB_SO "libthread_db.so.1" @@ -108,6 +109,11 @@ static td_err_e (*td_thr_setgregs_p) (const td_thrhandle_t *th, prgregset_t gregs); static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, int event); +static td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th, + void *map_address, + size_t offset, + void **address); + /* Location of the thread creation event breakpoint. The code at this location in the child process will be called by the pthread library whenever a new thread is created. By setting a special breakpoint @@ -348,6 +354,7 @@ thread_db_load (void) td_ta_set_event_p = dlsym (handle, "td_ta_set_event"); td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg"); td_thr_event_enable_p = dlsym (handle, "td_thr_event_enable"); + td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr"); return 1; } @@ -829,7 +836,7 @@ thread_db_store_registers (int regno) { char raw[MAX_REGISTER_RAW_SIZE]; - read_register_gen (regno, raw); + deprecated_read_register_gen (regno, raw); thread_db_fetch_registers (-1); supply_register (regno, raw); } @@ -1003,6 +1010,97 @@ thread_db_pid_to_str (ptid_t ptid) return normal_pid_to_str (ptid); } +/* Get the address of the thread local variable in OBJFILE which is + stored at OFFSET within the thread local storage for thread PTID. */ + +static CORE_ADDR +thread_db_get_thread_local_address (ptid_t ptid, struct objfile *objfile, + CORE_ADDR offset) +{ + if (is_thread (ptid)) + { + int objfile_is_library = (objfile->flags & OBJF_SHARED); + td_err_e err; + td_thrhandle_t th; + void *address; + CORE_ADDR lm; + + /* glibc doesn't provide the needed interface. */ + if (! td_thr_tls_get_addr_p) + error ("Cannot find thread-local variables in this thread library."); + + /* Get the address of the link map for this objfile. */ + lm = svr4_fetch_objfile_link_map (objfile); + + /* Whoops, we couldn't find one. Bail out. */ + if (!lm) + { + if (objfile_is_library) + error ("Cannot find shared library `%s' link_map in dynamic" + " linker's module list", objfile->name); + else + error ("Cannot find executable file `%s' link_map in dynamic" + " linker's module list", objfile->name); + } + + /* Get info about the thread. */ + err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th); + if (err != TD_OK) + error ("Cannot find thread %ld: %s", + (long) GET_THREAD (ptid), thread_db_err_str (err)); + + /* Finally, get the address of the variable. */ + err = td_thr_tls_get_addr_p (&th, (void *) lm, offset, &address); + +#ifdef THREAD_DB_HAS_TD_NOTALLOC + /* The memory hasn't been allocated, yet. */ + if (err == TD_NOTALLOC) + { + /* Now, if libthread_db provided the initialization image's + address, we *could* try to build a non-lvalue value from + the initialization image. */ + if (objfile_is_library) + error ("The inferior has not yet allocated storage for" + " thread-local variables in\n" + "the shared library `%s'\n" + "for the thread %ld", + objfile->name, (long) GET_THREAD (ptid)); + else + error ("The inferior has not yet allocated storage for" + " thread-local variables in\n" + "the executable `%s'\n" + "for the thread %ld", + objfile->name, (long) GET_THREAD (ptid)); + } +#endif + + /* Something else went wrong. */ + if (err != TD_OK) + { + if (objfile_is_library) + error ("Cannot find thread-local storage for thread %ld, " + "shared library %s:\n%s", + (long) GET_THREAD (ptid), + objfile->name, + thread_db_err_str (err)); + else + error ("Cannot find thread-local storage for thread %ld, " + "executable file %s:\n%s", + (long) GET_THREAD (ptid), + objfile->name, + thread_db_err_str (err)); + } + + /* Cast assuming host == target. Joy. */ + return (CORE_ADDR) address; + } + + if (target_beneath->to_get_thread_local_address) + return target_beneath->to_get_thread_local_address (ptid, objfile, offset); + + error ("Cannot find thread-local values on this target."); +} + static void init_thread_db_ops (void) { @@ -1025,6 +1123,8 @@ init_thread_db_ops (void) thread_db_ops.to_pid_to_str = thread_db_pid_to_str; thread_db_ops.to_stratum = thread_stratum; thread_db_ops.to_has_thread_control = tc_schedlock; + thread_db_ops.to_get_thread_local_address + = thread_db_get_thread_local_address; thread_db_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 8fdc4bc..df138d0 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,25 @@ +2002-11-10 Andrew Cagney <ac131313@redhat.com> + + * tuiStack.c (tuiShowFrameInfo): Replace frame_in_dummy with + deprecated_frame_in_dummy. + +2002-10-26 Stephane Carrez <stcarrez@nerim.fr> + + * tuiIO.c (tui_prep_terminal): Save the prompt registered in readline. + (tui_redisplay_readline): Use the last saved prompt. + (tui_rl_saved_prompt): New. + +2002-10-25 Stephane Carrez <stcarrez@nerim.fr> + + Fix PR gdb/787 + * tuiWin.c (ACS_LRCORNER, ACS_LLCORNER, ACS_ULCORNER, ACS_URCORNER, + ACS_HLINE, ACS_VLINE): Define if they don't exist. + +2002-10-25 Stephane Carrez <stcarrez@nerim.fr> + + Fix PR gdb/478 + * tuiIO.c (tui_initialize_io): Use setvbuf since this is portable. + 2002-10-02 Elena Zannoni <ezannoni@redhat.com> * tui-hooks.c (selected_frame_level_changed_hook): Use the one diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c index f70df8f..b9b373c 100644 --- a/gdb/tui/tuiIO.c +++ b/gdb/tui/tuiIO.c @@ -124,6 +124,10 @@ static FILE *tui_old_rl_outstream; static int tui_readline_pipe[2]; #endif +/* The last gdb prompt that was registered in readline. + This may be the main gdb prompt or a secondary prompt. */ +static char *tui_rl_saved_prompt; + static unsigned int _tuiHandleResizeDuringIO (unsigned int); static void @@ -194,7 +198,7 @@ tui_redisplay_readline (void) if (tui_current_key_mode == tui_single_key_mode) prompt = ""; else - prompt = get_prompt (); + prompt = tui_rl_saved_prompt; c_pos = -1; c_line = -1; @@ -256,10 +260,15 @@ tui_redisplay_readline (void) } /* Readline callback to prepare the terminal. It is called once - each time we enter readline. There is nothing to do in curses mode. */ + each time we enter readline. Terminal is already setup in curses mode. */ static void tui_prep_terminal (void) { + /* Save the prompt registered in readline to correctly display it. + (we can't use gdb_prompt() due to secondary prompts and can't use + rl_prompt because it points to an alloca buffer). */ + xfree (tui_rl_saved_prompt); + tui_rl_saved_prompt = xstrdup (rl_prompt); } /* Readline callback to restore the terminal. It is called once @@ -600,7 +609,7 @@ tui_initialize_io () fprintf_unfiltered (gdb_stderr, "Cannot redirect readline output"); exit (1); } - setlinebuf (tui_rl_outstream); + setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0); #ifdef O_NONBLOCK (void) fcntl (tui_readline_pipe[0], F_SETFL, O_NONBLOCK); diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index 1d3856d..506cdab 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -352,7 +352,7 @@ tuiShowFrameInfo (struct frame_info *fi) sal = find_pc_line (fi->pc, (fi->next != (struct frame_info *) NULL && !fi->next->signal_handler_caller && - !frame_in_dummy (fi->next))); + !deprecated_frame_in_dummy (fi->next))); sourceAlreadyDisplayed = sal.symtab != 0 && tuiSourceIsDisplayed (sal.symtab->filename); diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 38283b5..484c60a 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -96,6 +96,25 @@ static void _parseScrollingArgs (char *, TuiWinInfoPtr *, int *); ** PUBLIC FUNCTIONS ***************************************/ +#ifndef ACS_LRCORNER +# define ACS_LRCORNER '+' +#endif +#ifndef ACS_LLCORNER +# define ACS_LLCORNER '+' +#endif +#ifndef ACS_ULCORNER +# define ACS_ULCORNER '+' +#endif +#ifndef ACS_URCORNER +# define ACS_URCORNER '+' +#endif +#ifndef ACS_HLINE +# define ACS_HLINE '-' +#endif +#ifndef ACS_VLINE +# define ACS_VLINE '|' +#endif + /* Possible values for tui-border-kind variable. */ static const char *tui_border_kind_enums[] = { "space", diff --git a/gdb/utils.c b/gdb/utils.c index 24a2819..06fb593 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2704,31 +2704,73 @@ string_to_core_addr (const char *my_string) char * gdb_realpath (const char *filename) { + /* Method 1: The system has a compile time upper bound on a filename + path. Use that and realpath() to canonicalize the name. This is + the most common case. Note that, if there isn't a compile time + upper bound, you want to avoid realpath() at all costs. */ #if defined(HAVE_REALPATH) + { # if defined (PATH_MAX) - char buf[PATH_MAX]; + char buf[PATH_MAX]; # define USE_REALPATH # elif defined (MAXPATHLEN) - char buf[MAXPATHLEN]; -# define USE_REALPATH -# elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) - char *buf = alloca ((size_t)pathconf ("/", _PC_PATH_MAX)); + char buf[MAXPATHLEN]; # define USE_REALPATH # endif +# if defined (USE_REALPATH) + const char *rp = realpath (filename, buf); + if (rp == NULL) + rp = filename; + return xstrdup (rp); + } +# endif #endif /* HAVE_REALPATH */ -#if defined(USE_REALPATH) - char *rp = realpath (filename, buf); - return xstrdup (rp ? rp : filename); -#elif defined(HAVE_CANONICALIZE_FILE_NAME) - char *rp = canonicalize_file_name (filename); - if (rp == NULL) - return xstrdup (filename); - else - return rp; -#else - return xstrdup (filename); + /* Method 2: The host system (i.e., GNU) has the function + canonicalize_file_name() which malloc's a chunk of memory and + returns that, use that. */ +#if defined(HAVE_CANONICALIZE_FILE_NAME) + { + char *rp = canonicalize_file_name (filename); + if (rp == NULL) + return xstrdup (filename); + else + return rp; + } #endif + + /* FIXME: cagney/2002-11-13: + + Method 2a: Use realpath() with a NULL buffer. Some systems, due + to the problems described in in method 3, have modified their + realpath() implementation so that it will allocate a buffer when + NULL is passed in. Before this can be used, though, some sort of + configure time test would need to be added. Otherwize the code + will likely core dump. */ + + /* Method 3: Now we're getting desperate! The system doesn't have a + compile time buffer size and no alternative function. Query the + OS, using pathconf(), for the buffer limit. Care is needed + though, some systems do not limit PATH_MAX (return -1 for + pathconf()) making it impossible to pass a correctly sized buffer + to realpath() (it could always overflow). On those systems, we + skip this. */ +#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) + { + /* Find out the max path size. */ + long path_max = pathconf ("/", _PC_PATH_MAX); + if (path_max > 0) + { + /* PATH_MAX is bounded. */ + char *buf = alloca (path_max); + char *rp = realpath (filename, buf); + return xstrdup (rp ? rp : filename); + } + } +#endif + + /* This system is a lost cause, just dup the buffer. */ + return xstrdup (filename); } /* Return a copy of FILENAME, with its directory prefix canonicalized diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 6aea886..eae7db6 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1089,8 +1089,8 @@ v850_store_return_value (struct type *type, char *valbuf) CORE_ADDR return_buffer; if (!v850_use_struct_convention (0, type)) - write_register_bytes (REGISTER_BYTE (E_V0_REGNUM), valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (E_V0_REGNUM), valbuf, + TYPE_LENGTH (type)); else { return_buffer = read_register (E_V0_REGNUM); diff --git a/gdb/v850ice.c b/gdb/v850ice.c index 958eac3..2e68cff 100644 --- a/gdb/v850ice.c +++ b/gdb/v850ice.c @@ -560,7 +560,7 @@ v850ice_store_registers (int regno) return; } - regval = extract_unsigned_integer (®isters[REGISTER_BYTE (regno)], + regval = extract_unsigned_integer (&deprecated_registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); strcpy (cmd, "reg "); if (!convert_register (regno, &cmd[4])) @@ -897,14 +897,9 @@ init_850ice_ops (void) v850ice_ops.to_doc = "Debug a system controlled by a NEC 850 ICE."; v850ice_ops.to_open = v850ice_open; v850ice_ops.to_close = v850ice_close; - v850ice_ops.to_attach = NULL; - v850ice_ops.to_post_attach = NULL; - v850ice_ops.to_require_attach = NULL; v850ice_ops.to_detach = v850ice_detach; - v850ice_ops.to_require_detach = NULL; v850ice_ops.to_resume = v850ice_resume; v850ice_ops.to_wait = v850ice_wait; - v850ice_ops.to_post_wait = NULL; v850ice_ops.to_fetch_registers = v850ice_fetch_registers; v850ice_ops.to_store_registers = v850ice_store_registers; v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store; @@ -912,30 +907,16 @@ init_850ice_ops (void) v850ice_ops.to_files_info = v850ice_files_info; v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint; v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint; - v850ice_ops.to_terminal_init = NULL; - v850ice_ops.to_terminal_inferior = NULL; - v850ice_ops.to_terminal_ours_for_output = NULL; - v850ice_ops.to_terminal_ours = NULL; - v850ice_ops.to_terminal_info = NULL; v850ice_ops.to_kill = v850ice_kill; v850ice_ops.to_load = v850ice_load; - v850ice_ops.to_lookup_symbol = NULL; - v850ice_ops.to_create_inferior = NULL; v850ice_ops.to_mourn_inferior = v850ice_mourn; - v850ice_ops.to_can_run = 0; - v850ice_ops.to_notice_signals = 0; - v850ice_ops.to_thread_alive = NULL; v850ice_ops.to_stop = v850ice_stop; - v850ice_ops.to_pid_to_exec_file = NULL; v850ice_ops.to_stratum = process_stratum; - v850ice_ops.DONT_USE = NULL; v850ice_ops.to_has_all_memory = 1; v850ice_ops.to_has_memory = 1; v850ice_ops.to_has_stack = 1; v850ice_ops.to_has_registers = 1; v850ice_ops.to_has_execution = 1; - v850ice_ops.to_sections = NULL; - v850ice_ops.to_sections_end = NULL; v850ice_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/valops.c b/gdb/valops.c index 91b97b4..61688c4 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -632,132 +632,120 @@ value_assign (struct value *toval, struct value *fromval) } break; - case lval_register: - if (VALUE_BITSIZE (toval)) - { - char buffer[sizeof (LONGEST)]; - int len = - REGISTER_RAW_SIZE (VALUE_REGNO (toval)) - VALUE_OFFSET (toval); - - if (len > (int) sizeof (LONGEST)) - error ("Can't handle bitfields in registers larger than %d bits.", - (int) sizeof (LONGEST) * HOST_CHAR_BIT); - - if (VALUE_BITPOS (toval) + VALUE_BITSIZE (toval) - > len * HOST_CHAR_BIT) - /* Getting this right would involve being very careful about - byte order. */ - error ("Can't assign to bitfields that cross register " - "boundaries."); - - read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), - buffer, len); - modify_field (buffer, value_as_long (fromval), - VALUE_BITPOS (toval), VALUE_BITSIZE (toval)); - write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), - buffer, len); - } - else if (use_buffer) - write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), - raw_buffer, use_buffer); - else - { - /* Do any conversion necessary when storing this type to more - than one register. */ -#ifdef REGISTER_CONVERT_FROM_TYPE - memcpy (raw_buffer, VALUE_CONTENTS (fromval), TYPE_LENGTH (type)); - REGISTER_CONVERT_FROM_TYPE (VALUE_REGNO (toval), type, raw_buffer); - write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), - raw_buffer, TYPE_LENGTH (type)); -#else - write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), - VALUE_CONTENTS (fromval), TYPE_LENGTH (type)); -#endif - } - - target_changed_event (); - - /* Assigning to the stack pointer, frame pointer, and other - (architecture and calling convention specific) registers may - cause the frame cache to be out of date. We just do this - on all assignments to registers for simplicity; I doubt the slowdown - matters. */ - reinit_frame_cache (); - break; - case lval_reg_frame_relative: + case lval_register: { + struct frame_id old_frame; /* value is stored in a series of registers in the frame specified by the structure. Copy that value out, modify it, and copy it back in. */ - int amount_to_copy = (VALUE_BITSIZE (toval) ? 1 : TYPE_LENGTH (type)); - int reg_size = REGISTER_RAW_SIZE (VALUE_FRAME_REGNUM (toval)); - int byte_offset = VALUE_OFFSET (toval) % reg_size; - int reg_offset = VALUE_OFFSET (toval) / reg_size; int amount_copied; - - /* Make the buffer large enough in all cases. */ - /* FIXME (alloca): Not safe for very large data types. */ - char *buffer = (char *) alloca (amount_to_copy - + sizeof (LONGEST) - + MAX_REGISTER_RAW_SIZE); - + int amount_to_copy; + char *buffer; + int value_reg; + int reg_offset; + int byte_offset; int regno; struct frame_info *frame; + /* Since modifying a register can trash the frame chain, we + save the old frame and then restore the new frame + afterwards. */ + get_frame_id (selected_frame, &old_frame); + /* Figure out which frame this is in currently. */ - for (frame = get_current_frame (); - frame && FRAME_FP (frame) != VALUE_FRAME (toval); - frame = get_prev_frame (frame)) - ; + if (VALUE_LVAL (toval) == lval_register) + { + frame = get_current_frame (); + value_reg = VALUE_REGNO (toval); + } + else + { + for (frame = get_current_frame (); + frame && FRAME_FP (frame) != VALUE_FRAME (toval); + frame = get_prev_frame (frame)) + ; + value_reg = VALUE_FRAME_REGNUM (toval); + } if (!frame) error ("Value being assigned to is no longer active."); - amount_to_copy += (reg_size - amount_to_copy % reg_size); + /* Locate the first register that falls in the value that + needs to be transfered. Compute the offset of the value in + that register. */ + { + int offset; + for (reg_offset = value_reg, offset = 0; + offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval); + reg_offset++); + byte_offset = VALUE_OFFSET (toval) - offset; + } - /* Copy it out. */ - for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset, - amount_copied = 0); + /* Compute the number of register aligned values that need to + be copied. */ + if (VALUE_BITSIZE (toval)) + amount_to_copy = byte_offset + 1; + else + amount_to_copy = byte_offset + TYPE_LENGTH (type); + + /* And a bounce buffer. Be slightly over generous. */ + buffer = (char *) alloca (amount_to_copy + + MAX_REGISTER_RAW_SIZE); + + /* Copy it in. */ + for (regno = reg_offset, amount_copied = 0; amount_copied < amount_to_copy; - amount_copied += reg_size, regno++) + amount_copied += REGISTER_RAW_SIZE (regno), regno++) { - get_saved_register (buffer + amount_copied, - (int *) NULL, (CORE_ADDR *) NULL, - frame, regno, (enum lval_type *) NULL); + frame_register_read (frame, regno, buffer + amount_copied); } - + /* Modify what needs to be modified. */ if (VALUE_BITSIZE (toval)) - modify_field (buffer + byte_offset, - value_as_long (fromval), - VALUE_BITPOS (toval), VALUE_BITSIZE (toval)); + { + modify_field (buffer + byte_offset, + value_as_long (fromval), + VALUE_BITPOS (toval), VALUE_BITSIZE (toval)); + } else if (use_buffer) - memcpy (buffer + byte_offset, raw_buffer, use_buffer); + { + memcpy (buffer + VALUE_OFFSET (toval), raw_buffer, use_buffer); + } else - memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval), - TYPE_LENGTH (type)); + { + memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval), + TYPE_LENGTH (type)); + /* Do any conversion necessary when storing this type to + more than one register. */ +#ifdef REGISTER_CONVERT_FROM_TYPE + REGISTER_CONVERT_FROM_TYPE (value_reg, type, + (buffer + byte_offset)); +#endif + } - /* Copy it back. */ - for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset, - amount_copied = 0); + /* Copy it out. */ + for (regno = reg_offset, amount_copied = 0; amount_copied < amount_to_copy; - amount_copied += reg_size, regno++) + amount_copied += REGISTER_RAW_SIZE (regno), regno++) { enum lval_type lval; CORE_ADDR addr; int optim; - + int realnum; + /* Just find out where to put it. */ - get_saved_register ((char *) NULL, - &optim, &addr, frame, regno, &lval); - + frame_register (frame, regno, &optim, &lval, &addr, &realnum, + NULL); + if (optim) error ("Attempt to assign to a value that was optimized out."); if (lval == lval_memory) - write_memory (addr, buffer + amount_copied, reg_size); + write_memory (addr, buffer + amount_copied, + REGISTER_RAW_SIZE (regno)); else if (lval == lval_register) - write_register_bytes (addr, buffer + amount_copied, reg_size); + regcache_cooked_write (current_regcache, realnum, + (buffer + amount_copied)); else error ("Attempt to assign to an unmodifiable value."); } @@ -765,10 +753,31 @@ value_assign (struct value *toval, struct value *fromval) if (register_changed_hook) register_changed_hook (-1); target_changed_event (); + + /* Assigning to the stack pointer, frame pointer, and other + (architecture and calling convention specific) registers + may cause the frame cache to be out of date. We just do + this on all assignments to registers for simplicity; I + doubt the slowdown matters. */ + reinit_frame_cache (); + + /* Having destoroyed the frame cache, restore the selected + frame. */ + /* FIXME: cagney/2002-11-02: There has to be a better way of + doing this. Instead of constantly saving/restoring the + frame. Why not create a get_selected_frame() function + that, having saved the selected frame's ID can + automatically re-find the previously selected frame + automatically. */ + { + struct frame_info *fi = frame_find_by_id (old_frame); + if (fi != NULL) + select_frame (fi); + } } break; - - + + default: error ("Left operand of assignment is not an lvalue."); } diff --git a/gdb/values.c b/gdb/values.c index 7286bec..5226aea 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -863,7 +863,9 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type) struct value *prev; new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type)); - + + VALUE_ENCLOSING_TYPE (new_val) = new_encl_type; + /* We have to make sure this ends up in the same place in the value chain as the original copy, so it's clean-up behavior is the same. If the value has been released, this is a waste of time, but there diff --git a/gdb/varobj.c b/gdb/varobj.c index a0e1d53..cd15f7c 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1203,7 +1203,7 @@ child_exists (struct varobj *var, char *name) for (vc = var->children; vc != NULL; vc = vc->next) { - if (STREQ (vc->child->name, name)) + if (strcmp (vc->child->name, name) == 0) return vc->child; } @@ -2123,9 +2123,9 @@ cplus_number_of_children (struct varobj *var) type = get_type_deref (var->parent); cplus_class_num_children (type, kids); - if (STREQ (var->name, "public")) + if (strcmp (var->name, "public") == 0) children = kids[v_public]; - else if (STREQ (var->name, "private")) + else if (strcmp (var->name, "private") == 0) children = kids[v_private]; else children = kids[v_protected]; @@ -2176,7 +2176,6 @@ cplus_name_of_child (struct varobj *parent, int index) { char *name; struct type *type; - int children[3]; if (CPLUS_FAKE_CHILD (parent)) { @@ -2191,55 +2190,97 @@ cplus_name_of_child (struct varobj *parent, int index) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: - cplus_class_num_children (type, children); - if (CPLUS_FAKE_CHILD (parent)) { - int i; - - /* Skip over vptr, if it exists. */ - if (TYPE_VPTR_BASETYPE (type) == type - && index >= TYPE_VPTR_FIELDNO (type)) - index++; - - /* FIXME: This assumes that type orders - inherited, public, private, protected */ - i = index + TYPE_N_BASECLASSES (type); - if (STREQ (parent->name, "private") - || STREQ (parent->name, "protected")) - i += children[v_public]; - if (STREQ (parent->name, "protected")) - i += children[v_private]; - - name = TYPE_FIELD_NAME (type, i); + /* The fields of the class type are ordered as they + appear in the class. We are given an index for a + particular access control type ("public","protected", + or "private"). We must skip over fields that don't + have the access control we are looking for to properly + find the indexed field. */ + int type_index = TYPE_N_BASECLASSES (type); + if (strcmp (parent->name, "private") == 0) + { + while (index >= 0) + { + if (TYPE_VPTR_BASETYPE (type) == type + && type_index == TYPE_VPTR_FIELDNO (type)) + ; /* ignore vptr */ + else if (TYPE_FIELD_PRIVATE (type, type_index)) + --index; + ++type_index; + } + --type_index; + } + else if (strcmp (parent->name, "protected") == 0) + { + while (index >= 0) + { + if (TYPE_VPTR_BASETYPE (type) == type + && type_index == TYPE_VPTR_FIELDNO (type)) + ; /* ignore vptr */ + else if (TYPE_FIELD_PROTECTED (type, type_index)) + --index; + ++type_index; + } + --type_index; + } + else + { + while (index >= 0) + { + if (TYPE_VPTR_BASETYPE (type) == type + && type_index == TYPE_VPTR_FIELDNO (type)) + ; /* ignore vptr */ + else if (!TYPE_FIELD_PRIVATE (type, type_index) && + !TYPE_FIELD_PROTECTED (type, type_index)) + --index; + ++type_index; + } + --type_index; + } + + name = TYPE_FIELD_NAME (type, type_index); } else if (index < TYPE_N_BASECLASSES (type)) + /* We are looking up the name of a base class */ name = TYPE_FIELD_NAME (type, index); else { + int children[3]; + cplus_class_num_children(type, children); + /* Everything beyond the baseclasses can - only be "public", "private", or "protected" */ + only be "public", "private", or "protected" + + The special "fake" children are always output by varobj in + this order. So if INDEX == 2, it MUST be "protected". */ index -= TYPE_N_BASECLASSES (type); switch (index) { case 0: - if (children[v_public] != 0) - { - name = "public"; - break; - } + if (children[v_public] > 0) + name = "public"; + else if (children[v_private] > 0) + name = "private"; + else + name = "protected"; + break; case 1: - if (children[v_private] != 0) + if (children[v_public] > 0) { - name = "private"; - break; + if (children[v_private] > 0) + name = "private"; + else + name = "protected"; } + else if (children[v_private] > 0) + name = "protected"; + break; case 2: - if (children[v_protected] != 0) - { - name = "protected"; - break; - } + /* Must be protected */ + name = "protected"; + break; default: /* error! */ break; diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 2f517ed..e82227f 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -298,7 +298,7 @@ vax_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) static void vax_store_return_value (struct type *valtype, char *valbuf) { - write_register_bytes (0, valbuf, TYPE_LENGTH (valtype)); + deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (valtype)); } static CORE_ADDR diff --git a/gdb/version.in b/gdb/version.in index 4b2a497..5d8bf3d1 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2002-10-25-cvs +2002-11-15-cvs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index e2a85e1..93bd108 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -383,7 +383,7 @@ static void do_child_store_inferior_registers (int r) { if (r >= 0) - read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]); + deprecated_read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]); else { for (r = 0; r < NUM_REGS; r++) @@ -1828,24 +1828,18 @@ init_child_ops (void) child_ops.to_terminal_save_ours = terminal_save_ours; child_ops.to_terminal_info = child_terminal_info; child_ops.to_kill = child_kill_inferior; - child_ops.to_load = 0; - child_ops.to_lookup_symbol = 0; child_ops.to_create_inferior = child_create_inferior; child_ops.to_mourn_inferior = child_mourn_inferior; child_ops.to_can_run = child_can_run; - child_ops.to_notice_signals = 0; child_ops.to_thread_alive = win32_child_thread_alive; child_ops.to_pid_to_str = cygwin_pid_to_str; child_ops.to_stop = child_stop; child_ops.to_stratum = process_stratum; - child_ops.DONT_USE = 0; child_ops.to_has_all_memory = 1; child_ops.to_has_memory = 1; child_ops.to_has_stack = 1; child_ops.to_has_registers = 1; child_ops.to_has_execution = 1; - child_ops.to_sections = 0; - child_ops.to_sections_end = 0; child_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/wince.c b/gdb/wince.c index 92c1158..322564e 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -1139,7 +1139,7 @@ static void do_child_store_inferior_registers (int r) { if (r >= 0) - read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]); + deprecated_read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]); else { for (r = 0; r < NUM_REGS; r++) @@ -1924,8 +1924,6 @@ init_child_ops (void) child_ops.to_has_stack = 1; child_ops.to_has_registers = 1; child_ops.to_has_execution = 1; - child_ops.to_sections = 0; - child_ops.to_sections_end = 0; child_ops.to_magic = OPS_MAGIC; } diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index 7e6417b..78e9c49 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -158,7 +158,7 @@ fill_gregset (elf_gregset_t * gregsetp, int regno) for (i = 0; i < x86_64_num_gregs; i++) if ((regno == -1 || regno == i)) - read_register_gen (i, (char *) (regp + x86_64_regmap[i])); + deprecated_read_register_gen (i, (char *) (regp + x86_64_regmap[i])); } /* Fetch all general-purpose registers from process/thread TID and diff --git a/gdb/x86-64-linux-tdep.c b/gdb/x86-64-linux-tdep.c index 146a7a0..b8385a6 100644 --- a/gdb/x86-64-linux-tdep.c +++ b/gdb/x86-64-linux-tdep.c @@ -189,9 +189,3 @@ x86_64_init_frame_pc (int fromleaf, struct frame_info *fi) else cfi_init_frame_pc (fromleaf, fi); } - -void -x86_64_init_extra_frame_info (int fromleaf, struct frame_info *fi) -{ - cfi_init_extra_frame_info (fromleaf, fi); -} diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 979c2bd..d9356ec 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1,7 +1,6 @@ /* Target-dependent code for the x86-64 for GDB, the GNU debugger. Copyright 2001, 2002 Free Software Foundation, Inc. - Contributed by Jiri Smid, SuSE Labs. This file is part of GDB. @@ -177,6 +176,15 @@ x86_64_register_virtual_type (int regno) return *x86_64_register_info_table[regno].type; } +/* FIXME: cagney/2002-11-11: Once the i386 and x86-64 targets are + merged, this function can go away. */ +int +i386_fp_regnum_p (int regnum) +{ + return (regnum < NUM_REGS + && (FP0_REGNUM && FP0_REGNUM <= (regnum) && (regnum) < FPC_REGNUM)); +} + /* x86_64_register_convertible is true if register N's virtual format is different from its raw format. Note that this definition assumes that the host supports IEEE 32-bit floats, since it doesn't say @@ -252,18 +260,20 @@ static const char *valid_flavours[] = { }; static const char *disassembly_flavour = att_flavour; +/* Push the return address (pointing to the call dummy) onto the stack + and return the new value for the stack pointer. */ + static CORE_ADDR x86_64_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { char buf[8]; store_unsigned_integer (buf, 8, CALL_DUMMY_ADDRESS ()); - write_memory (sp - 8, buf, 8); return sp - 8; } -void +static void x86_64_pop_frame (void) { generic_pop_current_frame (cfi_pop_frame); @@ -301,8 +311,8 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) if (class1 == class2) return class1; - /* Rule #2: If one of the classes is NO_CLASS, the resulting class is - the other class. */ + /* Rule #2: If one of the classes is NO_CLASS, the resulting class + is the other class. */ if (class1 == X86_64_NO_CLASS) return class2; if (class2 == X86_64_NO_CLASS) @@ -329,15 +339,13 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) return X86_64_SSE_CLASS; } +/* Classify the argument type. CLASSES will be filled by the register + class used to pass each word of the operand. The number of words + is returned. In case the parameter should be passed in memory, 0 + is returned. As a special case for zero sized containers, + classes[0] will be NO_CLASS and 1 is returned. -/* Classify the argument type. - CLASSES will be filled by the register class used to pass each word - of the operand. The number of words is returned. In case the parameter - should be passed in memory, 0 is returned. As a special case for zero - sized containers, classes[0] will be NO_CLASS and 1 is returned. - - See the x86-64 PS ABI for details. -*/ + See the x86-64 psABI for details. */ static int classify_argument (struct type *type, @@ -362,8 +370,8 @@ classify_argument (struct type *type, for (i = 0; i < words; i++) classes[i] = X86_64_NO_CLASS; - /* Zero sized arrays or structures are NO_CLASS. We return 0 to - signalize memory class, so handle it as special case. */ + /* Zero sized arrays or structures are NO_CLASS. We return 0 + to signalize memory class, so handle it as special case. */ if (!words) { classes[0] = X86_64_NO_CLASS; @@ -446,7 +454,7 @@ classify_argument (struct type *type, && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS)) classes[i] = X86_64_SSE_CLASS; - /* X86_64_X87UP_CLASS should be preceeded by X86_64_X87_CLASS. */ + /* X86_64_X87UP_CLASS should be preceeded by X86_64_X87_CLASS. */ if (classes[i] == X86_64_X87UP_CLASS && (i == 0 || classes[i - 1] != X86_64_X87_CLASS)) classes[i] = X86_64_SSE_CLASS; @@ -500,8 +508,9 @@ classify_argument (struct type *type, "classify_argument: unknown argument type"); } -/* Examine the argument and return set number of register required in each - class. Return 0 ifif parameter should be passed in memory. */ +/* Examine the argument and set *INT_NREGS and *SSE_NREGS to the + number of registers required based on the information passed in + CLASSES. Return 0 if parameter should be passed in memory. */ static int examine_argument (enum x86_64_reg_class classes[MAX_CLASSES], @@ -539,9 +548,9 @@ examine_argument (enum x86_64_reg_class classes[MAX_CLASSES], #define RET_SSE_REGS 2 /* Check if the structure in value_type is returned in registers or in - memory. If this function returns 1, gdb will call STORE_STRUCT_RETURN and - EXTRACT_STRUCT_VALUE_ADDRESS else STORE_RETURN_VALUE and EXTRACT_RETURN_VALUE - will be used. */ + memory. If this function returns 1, GDB will call + STORE_STRUCT_RETURN and EXTRACT_STRUCT_VALUE_ADDRESS else + STORE_RETURN_VALUE and EXTRACT_RETURN_VALUE will be used. */ int x86_64_use_struct_convention (int gcc_p, struct type *value_type) { @@ -555,7 +564,6 @@ x86_64_use_struct_convention (int gcc_p, struct type *value_type) needed_intregs > RET_INT_REGS || needed_sseregs > RET_SSE_REGS); } - /* Extract from an array REGBUF containing the (raw) register state, a function return value of TYPE, and copy that, in virtual format, into VALBUF. */ @@ -638,10 +646,10 @@ x86_64_extract_return_value (struct type *type, char *regbuf, char *valbuf) } } -/* Handled by unwind informations. */ static void x86_64_frame_init_saved_regs (struct frame_info *fi) { + /* Do nothing. Everything is handled by the stack unwinding code. */ } #define INT_REGS 6 @@ -694,30 +702,30 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, case X86_64_NO_CLASS: break; case X86_64_INTEGER_CLASS: - write_register_gen (int_parameter_registers - [(intreg + 1) / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); + deprecated_write_register_gen (int_parameter_registers + [(intreg + 1) / 2], + VALUE_CONTENTS_ALL (args[i]) + offset); offset += 8; intreg += 2; break; case X86_64_INTEGERSI_CLASS: - write_register_gen (int_parameter_registers[intreg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); + deprecated_write_register_gen (int_parameter_registers[intreg / 2], + VALUE_CONTENTS_ALL (args[i]) + offset); offset += 8; intreg++; break; case X86_64_SSEDF_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSE_CLASS: - write_register_gen (sse_parameter_registers - [(ssereg + 1) / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); + deprecated_write_register_gen (sse_parameter_registers + [(ssereg + 1) / 2], + VALUE_CONTENTS_ALL (args[i]) + offset); offset += 8; ssereg += 2; break; case X86_64_SSEUP_CLASS: - write_register_gen (sse_parameter_registers[ssereg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); + deprecated_write_register_gen (sse_parameter_registers[ssereg / 2], + VALUE_CONTENTS_ALL (args[i]) + offset); offset += 8; ssereg++; break; @@ -762,8 +770,8 @@ x86_64_store_return_value (struct type *type, char *valbuf) && TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext) { /* Copy straight over. */ - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), valbuf, - FPU_REG_RAW_SIZE); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), valbuf, + FPU_REG_RAW_SIZE); } else { @@ -776,8 +784,8 @@ x86_64_store_return_value (struct type *type, char *valbuf) it is the best we can do. */ val = extract_floating (valbuf, TYPE_LENGTH (type)); floatformat_from_doublest (&floatformat_i387_ext, &val, buf); - write_register_bytes (REGISTER_BYTE (FP0_REGNUM), buf, - FPU_REG_RAW_SIZE); + deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), buf, + FPU_REG_RAW_SIZE); } } else @@ -786,12 +794,13 @@ x86_64_store_return_value (struct type *type, char *valbuf) int high_size = REGISTER_RAW_SIZE (1); if (len <= low_size) - write_register_bytes (REGISTER_BYTE (0), valbuf, len); + deprecated_write_register_bytes (REGISTER_BYTE (0), valbuf, len); else if (len <= (low_size + high_size)) { - write_register_bytes (REGISTER_BYTE (0), valbuf, low_size); - write_register_bytes (REGISTER_BYTE (1), - valbuf + low_size, len - low_size); + deprecated_write_register_bytes (REGISTER_BYTE (0), valbuf, + low_size); + deprecated_write_register_bytes (REGISTER_BYTE (1), + valbuf + low_size, len - low_size); } else internal_error (__FILE__, __LINE__, @@ -863,30 +872,31 @@ x86_64_skip_prologue (CORE_ADDR pc) struct symtab_and_line v_sal; struct symbol *v_function; CORE_ADDR endaddr; + unsigned char prolog_buf[PROLOG_BUFSIZE]; - /* We will handle only functions beginning with: - 55 pushq %rbp - 48 89 e5 movq %rsp,%rbp - */ - unsigned char prolog_expect[PROLOG_BUFSIZE] = { 0x55, 0x48, 0x89, 0xe5 }, - prolog_buf[PROLOG_BUFSIZE]; + /* We will handle only functions starting with: */ + static unsigned char prolog_expect[PROLOG_BUFSIZE] = + { + 0x55, /* pushq %rbp */ + 0x48, 0x89, 0xe5 /* movq %rsp, %rbp */ + }; read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE); - /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */ + /* First check, whether pc points to pushq %rbp, movq %rsp, %rbp. */ for (i = 0; i < PROLOG_BUFSIZE; i++) if (prolog_expect[i] != prolog_buf[i]) - return pc; /* ... no, it doesn't. Nothing to skip. */ + return pc; /* ... no, it doesn't. Nothing to skip. */ - /* OK, we have found the prologue and want PC of the first + /* OK, we have found the prologue and want PC of the first non-prologue instruction. */ pc += PROLOG_BUFSIZE; v_function = find_pc_function (pc); v_sal = find_pc_line (pc, 0); - /* If pc doesn't point to a function with debuginfo, - some of the following may be NULL. */ + /* If pc doesn't point to a function with debuginfo, some of the + following may be NULL. */ if (!v_function || !v_function->ginfo.value.block || !v_sal.symtab) return pc; @@ -904,7 +914,7 @@ x86_64_skip_prologue (CORE_ADDR pc) } /* Sequence of bytes for breakpoint instruction. */ -static unsigned char * +static const unsigned char * x86_64_breakpoint_from_pc (CORE_ADDR *pc, int *lenptr) { static unsigned char breakpoint[] = { 0xcc }; @@ -912,219 +922,199 @@ x86_64_breakpoint_from_pc (CORE_ADDR *pc, int *lenptr) return breakpoint; } -static struct gdbarch * -x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +static void +x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - struct gdbarch *gdbarch; - struct gdbarch_tdep *tdep; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int i, sum; - /* Find a candidate among the list of pre-declared architectures. */ - for (arches = gdbarch_list_lookup_by_info (arches, &info); - arches != NULL; - arches = gdbarch_list_lookup_by_info (arches->next, &info)) - { - switch (info.bfd_arch_info->mach) - { - case bfd_mach_x86_64: - case bfd_mach_x86_64_intel_syntax: - switch (gdbarch_bfd_arch_info (arches->gdbarch)->mach) - { - case bfd_mach_x86_64: - case bfd_mach_x86_64_intel_syntax: - return arches->gdbarch; - case bfd_mach_i386_i386: - case bfd_mach_i386_i8086: - case bfd_mach_i386_i386_intel_syntax: - break; - default: - internal_error (__FILE__, __LINE__, - "x86_64_gdbarch_init: unknown machine type"); - } - break; - case bfd_mach_i386_i386: - case bfd_mach_i386_i8086: - case bfd_mach_i386_i386_intel_syntax: - switch (gdbarch_bfd_arch_info (arches->gdbarch)->mach) - { - case bfd_mach_x86_64: - case bfd_mach_x86_64_intel_syntax: - break; - case bfd_mach_i386_i386: - case bfd_mach_i386_i8086: - case bfd_mach_i386_i386_intel_syntax: - return arches->gdbarch; - default: - internal_error (__FILE__, __LINE__, - "x86_64_gdbarch_init: unknown machine type"); - } - break; - default: - internal_error (__FILE__, __LINE__, - "x86_64_gdbarch_init: unknown machine type"); - } - } - - tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); - gdbarch = gdbarch_alloc (&info, tdep); - - switch (info.bfd_arch_info->mach) - { - case bfd_mach_x86_64: - case bfd_mach_x86_64_intel_syntax: - tdep->num_xmm_regs = 16; - break; - case bfd_mach_i386_i386: - case bfd_mach_i386_i8086: - case bfd_mach_i386_i386_intel_syntax: - /* This is place for definition of i386 target vector. */ - break; - default: - internal_error (__FILE__, __LINE__, - "x86_64_gdbarch_init: unknown machine type"); - } + /* The x86-64 has 16 SSE registers. */ + tdep->num_xmm_regs = 16; + /* This is what all the fuss is about. */ set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); - set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); + /* In contrast to the i386, on the x86-64 a `long double' actually + takes up 128 bits, even though it's still based on the i387 + extended floating-point format which has only 80 significant bits. */ + set_gdbarch_long_double_bit (gdbarch, 128); set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS); + + /* Register numbers of various important registers. */ + set_gdbarch_sp_regnum (gdbarch, 7); /* %rsp */ + set_gdbarch_fp_regnum (gdbarch, 6); /* %rbp */ + set_gdbarch_pc_regnum (gdbarch, 16); /* %rip */ + set_gdbarch_ps_regnum (gdbarch, 17); /* %eflags */ + set_gdbarch_fp0_regnum (gdbarch, X86_64_NUM_GREGS); /* %st(0) */ + + /* The "default" register numbering scheme for the x86-64 is + referred to as the "DWARF register number mapping" in the psABI. + The preferred debugging format for all known x86-64 targets is + actually DWARF2, and GCC doesn't seem to support DWARF (that is + DWARF-1), but we provide the same mapping just in case. This + mapping is also used for stabs, which GCC does support. */ + set_gdbarch_stab_reg_to_regnum (gdbarch, x86_64_dwarf2_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (gdbarch, x86_64_dwarf2_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, x86_64_dwarf2_reg_to_regnum); + + /* We don't override SDB_REG_RO_REGNUM, sice COFF doesn't seem to be + in use on any of the supported x86-64 targets. */ + set_gdbarch_register_name (gdbarch, x86_64_register_name); set_gdbarch_register_size (gdbarch, 8); - set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size); - set_gdbarch_max_register_raw_size (gdbarch, 16); - set_gdbarch_register_byte (gdbarch, x86_64_register_byte); - /* Total amount of space needed to store our copies of the machine's register - (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS) */ + /* Total amount of space needed to store our copies of the machine's + register (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + + SIZEOF_SSE_REGS) */ for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++) sum += x86_64_register_info_table[i].size; set_gdbarch_register_bytes (gdbarch, sum); - set_gdbarch_register_virtual_size (gdbarch, generic_register_size); - set_gdbarch_max_register_virtual_size (gdbarch, 16); + set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size); + set_gdbarch_register_byte (gdbarch, x86_64_register_byte); set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type); + /* FIXME: kettenis/20021026: As long as we don't support longjmp, + that is, as long as we have `tdep->jb_pc_offset == -1', using + i386_get_longjmp_target is fine. */ + set_gdbarch_register_convertible (gdbarch, x86_64_register_convertible); set_gdbarch_register_convert_to_virtual (gdbarch, x86_64_register_convert_to_virtual); set_gdbarch_register_convert_to_raw (gdbarch, x86_64_register_convert_to_raw); -/* Register numbers of various important registers. */ - set_gdbarch_sp_regnum (gdbarch, 7); /* (rsp) Contains address of top of stack. */ - set_gdbarch_fp_regnum (gdbarch, 6); /* (rbp) */ - set_gdbarch_pc_regnum (gdbarch, 16); /* (rip) Contains program counter. */ - - set_gdbarch_fp0_regnum (gdbarch, X86_64_NUM_GREGS); /* First FPU floating-point register. */ + /* Getting saved registers is handled by unwind information. */ + set_gdbarch_get_saved_register (gdbarch, cfi_get_saved_register); + /* FIXME: kettenis/20021026: Should we set parm_boundary to 64 here? */ set_gdbarch_read_fp (gdbarch, cfi_read_fp); -/* Discard from the stack the innermost frame, restoring all registers. */ + /* FIXME: kettenis/20021026: Should be undeprecated. */ + set_gdbarch_extract_return_value (gdbarch, NULL); + set_gdbarch_deprecated_extract_return_value (gdbarch, + x86_64_extract_return_value); + set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments); + set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address); set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame); + set_gdbarch_store_struct_return (gdbarch, x86_64_store_struct_return); + /* FIXME: kettenis/20021026: Should be undeprecated. */ + set_gdbarch_store_return_value (gdbarch, NULL); + set_gdbarch_deprecated_store_return_value (gdbarch, + x86_64_store_return_value); + /* Override, since this is handled by x86_64_extract_return_value. */ + set_gdbarch_extract_struct_value_address (gdbarch, NULL); + set_gdbarch_use_struct_convention (gdbarch, x86_64_use_struct_convention); - /* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. */ - set_gdbarch_frame_chain (gdbarch, x86_64_linux_frame_chain); + set_gdbarch_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs); + set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue); + set_gdbarch_frame_chain (gdbarch, x86_64_linux_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, - x86_64_frameless_function_invocation); + x86_64_frameless_function_invocation); + /* FIXME: kettenis/20021025: Shouldn't this be set to + generic_file_frame_chain_valid? */ + set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); + /* FIXME: kettenis/20021026: These two are GNU/Linux-specific and + should be moved elsewhere. */ set_gdbarch_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc); + set_gdbarch_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call); + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + /* FIXME: kettenis/20021026: This one is GNU/Linux-specific too. */ + set_gdbarch_pc_in_sigtramp (gdbarch, x86_64_linux_in_sigtramp); - set_gdbarch_frame_args_address (gdbarch, default_frame_address); - set_gdbarch_frame_locals_address (gdbarch, default_frame_address); - -/* Return number of bytes at start of arglist that are not really args. */ - set_gdbarch_frame_args_skip (gdbarch, 8); + /* Build call frame information (CFI) from DWARF2 frame debug info. */ + set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info); - set_gdbarch_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs); + /* Initialization of per-frame CFI. */ + set_gdbarch_init_extra_frame_info (gdbarch, cfi_init_extra_frame_info); -/* Frame pc initialization is handled by unwind informations. */ + /* Frame PC initialization is handled by using CFI. */ set_gdbarch_init_frame_pc (gdbarch, x86_64_init_frame_pc); -/* Initialization of unwind informations. */ - set_gdbarch_init_extra_frame_info (gdbarch, x86_64_init_extra_frame_info); + /* Cons up virtual frame pointer for trace. */ + set_gdbarch_virtual_frame_pointer (gdbarch, cfi_virtual_frame_pointer); -/* Getting saved registers is handled by unwind informations. */ - set_gdbarch_get_saved_register (gdbarch, cfi_get_saved_register); + /* FIXME: kettenis/20021026: This is ELF-specific. Fine for now, + since all supported x86-64 targets are ELF, but that might change + in the future. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); +} - set_gdbarch_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs); +static struct gdbarch * +x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + struct gdbarch_tdep *tdep; + struct gdbarch *gdbarch; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; -/* Cons up virtual frame pointer for trace */ - set_gdbarch_virtual_frame_pointer (gdbarch, cfi_virtual_frame_pointer); + /* Try to determine the OS ABI of the object we're loading. */ + if (info.abfd != NULL) + osabi = gdbarch_lookup_osabi (info.abfd); - set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); + /* Find a candidate among extant architectures. */ + for (arches = gdbarch_list_lookup_by_info (arches, &info); + arches != NULL; + arches = gdbarch_list_lookup_by_info (arches->next, &info)) + { + /* Make sure the OS ABI selection matches. */ + tdep = gdbarch_tdep (arches->gdbarch); + if (tdep && tdep->osabi == osabi) + return arches->gdbarch; + } - set_gdbarch_use_generic_dummy_frames (gdbarch, 1); - set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); - set_gdbarch_call_dummy_words (gdbarch, 0); - set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address); - set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments); + /* Allocate space for the new architecture. */ + tdep = XMALLOC (struct gdbarch_tdep); + gdbarch = gdbarch_alloc (&info, tdep); -/* Return number of args passed to a frame, no way to tell. */ - set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); -/* Don't use default structure extract routine */ - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, 0); + tdep->osabi = osabi; -/* If USE_STRUCT_CONVENTION retruns 0, then gdb uses STORE_RETURN_VALUE - and EXTRACT_RETURN_VALUE to store/fetch the functions return value. It is - the case when structure is returned in registers. */ - set_gdbarch_use_struct_convention (gdbarch, x86_64_use_struct_convention); + /* FIXME: kettenis/20021025: The following calls are going to + disappear when we integrate the x86_64 target into the i386 + target. */ -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ - set_gdbarch_store_struct_return (gdbarch, x86_64_store_struct_return); - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - set_gdbarch_deprecated_extract_return_value (gdbarch, - x86_64_extract_return_value); + set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); + set_gdbarch_max_register_raw_size (gdbarch, 16); + set_gdbarch_max_register_virtual_size (gdbarch, 16); -/* Write into the appropriate registers a function return value stored - in VALBUF of type TYPE, given in virtual format. */ - set_gdbarch_deprecated_store_return_value (gdbarch, - x86_64_store_return_value); - + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); -/* Offset from address of function to start of its code. */ + set_gdbarch_breakpoint_from_pc (gdbarch, x86_64_breakpoint_from_pc); + set_gdbarch_decr_pc_after_break (gdbarch, 1); set_gdbarch_function_start_offset (gdbarch, 0); - set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue); + set_gdbarch_frame_args_skip (gdbarch, 8); + set_gdbarch_frame_args_address (gdbarch, default_frame_address); + set_gdbarch_frame_locals_address (gdbarch, default_frame_address); - set_gdbarch_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call); + set_gdbarch_use_generic_dummy_frames (gdbarch, 1); - set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); + set_gdbarch_call_dummy_address (gdbarch, entry_point_address); + set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_words (gdbarch, NULL); + set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); + set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_breakpoint_from_pc (gdbarch, - (gdbarch_breakpoint_from_pc_ftype *) - x86_64_breakpoint_from_pc); + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); - set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); -/* Amount PC must be decremented by after a breakpoint. This is often the - number of bytes in BREAKPOINT but not always. */ - set_gdbarch_decr_pc_after_break (gdbarch, 1); + /* FIXME: kettenis/20021025: These already are the default. */ -/* Use dwarf2 debug frame informations. */ - set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info); - set_gdbarch_dwarf2_reg_to_regnum (gdbarch, x86_64_dwarf2_reg_to_regnum); + set_gdbarch_register_virtual_size (gdbarch, generic_register_size); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, 0); - set_gdbarch_pc_in_sigtramp (gdbarch, x86_64_linux_in_sigtramp); + x86_64_init_abi (info, gdbarch); return gdbarch; } diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index 9fb2fd0..4e73206 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -36,7 +36,6 @@ gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; gdbarch_pc_in_sigtramp_ftype x86_64_linux_in_sigtramp; CORE_ADDR x86_64_linux_frame_chain (struct frame_info *fi); void x86_64_init_frame_pc (int fromleaf, struct frame_info *fi); -void x86_64_init_extra_frame_info (int fromleaf, struct frame_info *fi); #endif diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 9618bdc..e2fe8d2 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -150,16 +150,16 @@ struct coff_symfile_info CORE_ADDR toc_offset; }; -static struct complaint storclass_complaint = +static struct deprecated_complaint storclass_complaint = {"Unexpected storage class: %d", 0, 0}; -static struct complaint bf_notfound_complaint = +static struct deprecated_complaint bf_notfound_complaint = {"line numbers off, `.bf' symbol not found", 0, 0}; -static struct complaint ef_complaint = +static struct deprecated_complaint ef_complaint = {"Mismatched .ef symbol ignored starting at symnum %d", 0, 0}; -static struct complaint eb_complaint = +static struct deprecated_complaint eb_complaint = {"Mismatched .eb symbol ignored starting at symnum %d", 0, 0}; static void xcoff_initial_scan (struct objfile *, int); @@ -483,7 +483,7 @@ record_include_begin (struct coff_symbol *cs) /* This can happen with old versions of GCC. GCC 2.3.3-930426 does not exhibit this on a test case which a user said produced the message for him. */ - static struct complaint msg = + static struct deprecated_complaint msg = {"Nested C_BINCL symbols", 0, 0}; complain (&msg); } @@ -502,7 +502,7 @@ record_include_end (struct coff_symbol *cs) if (inclDepth == 0) { - static struct complaint msg = + static struct deprecated_complaint msg = {"Mismatched C_BINCL/C_EINCL pair", 0, 0}; complain (&msg); } @@ -766,7 +766,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff { if (endoffset >= limit_offset) { - static struct complaint msg = + static struct deprecated_complaint msg = {"Bad line table offset in C_EINCL directive", 0, 0}; complain (&msg); return; @@ -864,7 +864,7 @@ static char * xcoff_next_symbol_text (struct objfile *objfile) { struct internal_syment symbol; - static struct complaint msg = + static struct deprecated_complaint msg = {"Unexpected symbol continuation", 0, 0}; char *retval; /* FIXME: is this the same as the passed arg? */ @@ -1332,7 +1332,7 @@ read_xcoff_symtab (struct partial_symtab *pst) case C_UNTAG: case C_ENTAG: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Unrecognized storage class %d.", 0, 0}; complain (&msg, cs->c_sclass); } @@ -1603,7 +1603,7 @@ read_symbol (struct internal_syment *symbol, int symno) ->symtbl; if (symno < 0 || symno >= nsyms) { - static struct complaint msg = + static struct deprecated_complaint msg = {"Invalid symbol offset", 0, 0}; complain (&msg); symbol->n_value = 0; @@ -2441,7 +2441,7 @@ scan_xcoff_symtab (struct objfile *objfile) default: { - static struct complaint msg = + static struct deprecated_complaint msg = {"Storage class %d not recognized during scan", 0, 0}; complain (&msg, sclass); } @@ -2564,7 +2564,7 @@ scan_xcoff_symtab (struct objfile *objfile) case C_STSYM: { - static struct complaint function_outside_compilation_unit = { + static struct deprecated_complaint function_outside_compilation_unit = { "function `%s' appears to be defined outside of all compilation units", 0, 0 }; diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index b088085..f111516 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -186,7 +186,7 @@ xstormy16_get_saved_register (char *raw_buffer, struct frame_info *fi, int regnum, enum lval_type *lval) { - generic_get_saved_register (raw_buffer, optimized, addrp, fi, regnum, lval); + deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, fi, regnum, lval); } /* Function: xstormy16_type_is_scalar @@ -387,12 +387,12 @@ xstormy16_store_return_value (struct type *type, char *valbuf) /* Add leading zeros to the value. */ memset (buf, 0, xstormy16_reg_size); memcpy (buf, valbuf, 1); - write_register_gen (E_1ST_ARG_REGNUM, buf); + deprecated_write_register_gen (E_1ST_ARG_REGNUM, buf); } else if (xstormy16_type_is_scalar (type) && TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS) - write_register_bytes (REGISTER_BYTE (E_1ST_ARG_REGNUM), - valbuf, TYPE_LENGTH (type)); + deprecated_write_register_bytes (REGISTER_BYTE (E_1ST_ARG_REGNUM), + valbuf, TYPE_LENGTH (type)); else { return_buffer = read_register (E_PTR_RET_REGNUM); @@ -439,7 +439,7 @@ xstormy16_frame_saved_register (struct frame_info *fi, int regnum) int size = xstormy16_register_raw_size (regnum); char *buf = (char *) alloca (size); - generic_get_saved_register (buf, NULL, NULL, fi, regnum, NULL); + deprecated_generic_get_saved_register (buf, NULL, NULL, fi, regnum, NULL); return (CORE_ADDR) extract_unsigned_integer (buf, size); } diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index c7396e2..e06f343 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -309,7 +309,8 @@ write_return_value (struct type *type, char *valbuf) int len; for (len = 0; len < TYPE_LENGTH (type); len += 2) - write_register_bytes (REGISTER_BYTE (len / 2 + 2), valbuf + len, 2); + deprecated_write_register_bytes (REGISTER_BYTE (len / 2 + 2), + valbuf + len, 2); } void @@ -319,7 +320,7 @@ store_struct_return (CORE_ADDR addr, CORE_ADDR sp) } -void +static void z8k_print_register_hook (int regno) { if ((regno & 1) == 0 && regno < 16) @@ -359,7 +360,117 @@ z8k_print_register_hook (int regno) (unsigned int)read_memory_short (rval + i)); } } +} + +static void +z8k_print_registers_info (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame, + int regnum, int print_all) +{ + int i; + const int numregs = NUM_REGS + NUM_PSEUDO_REGS; + char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); + char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + + for (i = 0; i < numregs; i++) + { + /* Decide between printing all regs, non-float / vector regs, or + specific reg. */ + if (regnum == -1) + { + if (!print_all) + { + if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) + continue; + if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) + continue; + } + } + else + { + if (i != regnum) + continue; + } + + /* If the register name is empty, it is undefined for this + processor, so don't display anything. */ + if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') + continue; + + fputs_filtered (REGISTER_NAME (i), file); + print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); + + /* Get the data in raw format. */ + if (! frame_register_read (frame, i, raw_buffer)) + { + fprintf_filtered (file, "*value not available*\n"); + continue; + } + /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. + The function frame_register_read() should have returned the + pre-cooked register so no conversion is necessary. */ + /* Convert raw data to virtual format if necessary. */ + if (REGISTER_CONVERTIBLE (i)) + { + REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), + raw_buffer, virtual_buffer); + } + else + { + memcpy (virtual_buffer, raw_buffer, + 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) + { + int j; + + val_print (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++) + { + int idx; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + idx = j; + else + idx = REGISTER_RAW_SIZE (i) - 1 - j; + fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); + } + fprintf_filtered (file, ")"); + } + else + { + /* Print the register in hex. */ + val_print (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) + { + fprintf_filtered (file, "\t"); + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + file, 0, 1, 0, Val_pretty_default); + } + } + + /* Some z8k specific info. */ + z8k_print_register_hook (i); + + fprintf_filtered (file, "\n"); + } +} + +void +z8k_do_registers_info (int regnum, int all) +{ + z8k_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + regnum, all); } void |