diff options
author | nobody <> | 2003-03-13 15:09:31 +0000 |
---|---|---|
committer | nobody <> | 2003-03-13 15:09:31 +0000 |
commit | ab015601f0f6fc053476cad220d7f7908fdcd850 (patch) | |
tree | 1b18f158e0c3c984b0d51341e12a27e9de72d63c /gdb | |
parent | df12d73d19b31ec578eb6be37bb15e21b06ec746 (diff) | |
download | gdb-ab015601f0f6fc053476cad220d7f7908fdcd850.zip gdb-ab015601f0f6fc053476cad220d7f7908fdcd850.tar.gz gdb-ab015601f0f6fc053476cad220d7f7908fdcd850.tar.bz2 |
This commit was manufactured by cvs2svn to create branchoffbyone-20030313-branchpoint
'offbyone-20030313-branch'.
Sprout from kettenis-i386newframe-20030308-branch 2003-03-08 00:00:32 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'kettenis-'
Cherrypick from master 2003-03-13 15:09:29 UTC Nick Clifton <nickc@redhat.com> 'Add New Chinese (simplified) PO file.':
ChangeLog
Makefile.in
Makefile.tpl
bfd/ChangeLog
bfd/aout-cris.c
bfd/aout-encap.c
bfd/aout-ns32k.c
bfd/aout-tic30.c
bfd/bfd-in2.h
bfd/configure
bfd/configure.in
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf64-mips.c
bfd/elf64-ppc.c
bfd/elfn32-mips.c
bfd/elfxx-mips.c
bfd/elfxx-target.h
bfd/hp300bsd.c
bfd/i386aout.c
bfd/i386dynix.c
bfd/i386linux.c
bfd/i386lynx.c
bfd/i386mach3.c
bfd/libbfd.h
bfd/m68k4knetbsd.c
bfd/m68klinux.c
bfd/m68klynx.c
bfd/m68knetbsd.c
bfd/m88kmach3.c
bfd/mipsbsd.c
bfd/newsos3.c
bfd/po/zh_CN.po
bfd/reloc.c
bfd/sparclinux.c
bfd/sparclynx.c
bfd/sparcnetbsd.c
bfd/vaxbsd.c
bfd/version.h
bfd/xsym.c
configure
configure.in
gdb/ChangeLog
gdb/MAINTAINERS
gdb/alpha-tdep.c
gdb/arch-utils.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/breakpoint.c
gdb/cli-out.c
gdb/config/m68k/tm-delta68.h
gdb/config/m68k/tm-linux.h
gdb/config/pa/tm-hppa.h
gdb/config/rs6000/tm-rs6000.h
gdb/config/sparc/tm-sparc.h
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/doc/gdbint.texinfo
gdb/doublest.c
gdb/dummy-frame.c
gdb/eval.c
gdb/findvar.c
gdb/frame-unwind.h
gdb/frame.c
gdb/frv-tdep.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-interix-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/mcore-tdep.c
gdb/mi/ChangeLog
gdb/mi/mi-out.c
gdb/minsyms.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/ns32k-tdep.c
gdb/ns32knbsd-nat.c
gdb/ppc-linux-tdep.c
gdb/regcache.c
gdb/regcache.h
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/sentinel-frame.c
gdb/sh-tdep.c
gdb/sparc-tdep.c
gdb/tui/ChangeLog
gdb/tui/tui-out.c
gdb/v850-tdep.c
gdb/valarith.c
gdb/vax-tdep.c
gdb/version.in
gdb/x86-64-tdep.c
gdb/x86-64-tdep.h
gdb/xstormy16-tdep.c
libiberty/ChangeLog
libiberty/cplus-dem.c
libiberty/hashtab.c
Diffstat (limited to 'gdb')
60 files changed, 2072 insertions, 482 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a89411f..c9ec531 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,299 @@ +2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com> + + * MAINTAINERS (write after approval): Alphabetically + listing corrected. + +2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com> + + * MAINTAINERS (write after approval): Add myself. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Rename the frame parameter to + "this_frame". + (get_next_frame, legacy_get_prev_frame): Ditto. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_current_frame): Check target_has_registers before + checking target_has_stack. + * eval.c (evaluate_subexp_standard): Use get_selected_frame, + instead of deprecated_selected_frame. + * findvar.c (value_of_register): Pass "frame", not + deprecated_selected_frame, to value_of_builtin_reg. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * regcache.c (regcache_cooked_write_signed): New function. + (regcache_cooked_write_unsigned): New function. + (regcache_cooked_read_unsigned): Fix regnum in range assertion. + (regcache_cooked_read_signed): Fix regnum in range assertion. + * regcache.h (regcache_cooked_write_signed): Declare. + (regcache_cooked_write_unsigned): Declare. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.h: Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ppc-linux-tdep.c (ppc_linux_init_abi): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * i386-interix-tdep.c (i386_interix_init_abi): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * sh-tdep.c (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * ns32knbsd-nat.c (frame_num_args): Update. + * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update. + * xstormy16-tdep.c (xstormy16_pop_frame): Update. + (xstormy16_frame_chain_valid): Update. + * vax-tdep.c (vax_saved_pc_after_call): Update. + * v850-tdep.c (v850_frame_chain): Update. + (v850_pop_frame): Update. + (v850_init_extra_frame_info): Update. + * sparc-tdep.c (setup_arbitrary_frame): Update. + * ns32k-tdep.c (umax_frame_num_args): Update. + * s390-tdep.c (s390_pop_frame_regular): Update. + * mn10300-tdep.c (mn10300_frame_chain): Update. + (mn10300_pop_frame_regular): Update. + (mn10300_init_extra_frame_info): Update. + * mips-tdep.c (mips_init_frame_pc_first): Update. + (mips_frame_chain): Update. + (mips_pop_frame): Update. + * mcore-tdep.c (mcore_frame_chain): Update. + (mcore_pop_frame): Update. + (mcore_init_extra_frame_info): Update. + * arch-utils.c (init_frame_pc_default): Update. + * m68k-tdep.c (isi_frame_num_args): Update. + (delta68_frame_num_args): Update. + (news_frame_num_args): Update. + * ia64-tdep.c (ia64_pop_frame_regular): Update. + * alpha-tdep.c (alpha_init_frame_pc_first): Update. + (alpha_frame_chain): Update. + (alpha_pop_frame): Update. + * hppa-tdep.c (hppa_saved_pc_after_call): Update. + (hppa_init_extra_frame_info): Update. + (hppa_frame_chain): Update. + (hppa_frame_chain_valid): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_init_extra_frame_info): Update. + * arm-tdep.c (arm_frame_chain_valid): Update. + (arm_init_extra_frame_info): Update. + (arm_pop_frame): Update. + * frame.c (frame_pc_unwind): Update. + * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update. + (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + Eliminate the need for POP_FRAME. + * frame.c (do_frame_unwind_register): New function. + (frame_pop): When no POP_FRAME, pop the frame using register + unwind and a scratch regcache. + (frame_saved_regs_pop): Delete function. + (trad_frame_unwinder): Update. + * d10v-tdep.c (d10v_frame_pop): Delete function. + (d10v_frame_unwind): Update. + * sentinel-frame.c (sentinel_frame_pop): Delete function. + (sentinel_frame_unwinder): Update. + * dummy-frame.c (dummy_frame_pop): Delete function. + (dummy_frame_unwind): Update. + * frame-unwind.h (frame_unwind_pop_ftype): Delete definition. + (struct frame_unwind): Update. + +2003-03-11 Kevin Buettner <kevinb@redhat.com> + + * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to + mips_dwarf_dwarf2_ecoff_reg_to_regnum(). + (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum): + Do range checks on register number obtained from debugging info. + (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and + set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of + set_gdbarch_ecoff_reg_to_regnum() to account for new name of + mapping function. + (do_fp_register_row): Fix typo which caused double type to be + used when attempting to unpack a float. + +2003-03-11 J. Brobecker <brobecker@gnat.com> + + * breakpoint.c (bpstat_stop_status): Fix a small memory leak. + +2003-03-11 Andrew Cagney <cagney@redhat.com> + + * frame.c (deprecated_update_frame_pc_hack): Don't assume a next + frame. Problem found by Corinna Vinschen. + +2003-03-11 Pierre Muller <muller@ics.u-strasbg.fr> + + * doublest.c (floatformat_from_length): Accept also + the real size of 'long double' type. + +2003-03-10 Daniel Jacobowitz <drow@mvista.com> + + From Klee Dienes <kdienes@apple.com>: + * breakpoint.c (bpstat_copy): Copy the command lines as well + as the old value, to match what is freed in bpstat_clear. + +2003-03-10 David Carlton <carlton@math.stanford.edu> + + * minsyms.c (add_minsym_to_hash_table): Replace + DEPRECATED_SYMBOL_NAME by SYMBOL_LINKAGE_NAME. + (compare_minimal_symbols, compact_minimal_symbols) + (install_minimal_symbols, find_solib_trampoline_target): Ditto. + (lookup_minimal_symbol_text): Use strcmp on linkage names instead + of DEPRECATED_SYMBOL_MATCHES_NAME. + (lookup_minimal_symbol_solib_trampoline): Ditto. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * regcache.h (regcache_cooked_read_ftype): Define. + (regcache_save, regcache_restore): Add a cooked_read parameter. + * regcache.c (regcache_save, regcache_restore): Update. + (do_cooked_read): New function. + (regcache_cpy): Pass do_cooked_read to regcache_save and + regcache_restore. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.h: Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ppc-linux-tdep.c (ppc_linux_init_abi): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * i386-interix-tdep.c (i386_interix_init_abi): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * sh-tdep.c (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * ns32knbsd-nat.c (frame_num_args): Update. + * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update. + * xstormy16-tdep.c (xstormy16_pop_frame): Update. + (xstormy16_frame_chain_valid): Update. + * vax-tdep.c (vax_saved_pc_after_call): Update. + * v850-tdep.c (v850_frame_chain): Update. + (v850_pop_frame): Update. + (v850_init_extra_frame_info): Update. + * sparc-tdep.c (setup_arbitrary_frame): Update. + * ns32k-tdep.c (umax_frame_num_args): Update. + * s390-tdep.c (s390_pop_frame_regular): Update. + * mn10300-tdep.c (mn10300_frame_chain): Update. + (mn10300_pop_frame_regular): Update. + (mn10300_init_extra_frame_info): Update. + * mips-tdep.c (mips_init_frame_pc_first): Update. + (mips_frame_chain): Update. + (mips_pop_frame): Update. + * mcore-tdep.c (mcore_frame_chain): Update. + (mcore_pop_frame): Update. + (mcore_init_extra_frame_info): Update. + * arch-utils.c (init_frame_pc_default): Update. + * m68k-tdep.c (isi_frame_num_args): Update. + (delta68_frame_num_args): Update. + (news_frame_num_args): Update. + * ia64-tdep.c (ia64_pop_frame_regular): Update. + * alpha-tdep.c (alpha_init_frame_pc_first): Update. + (alpha_frame_chain): Update. + (alpha_pop_frame): Update. + * hppa-tdep.c (hppa_saved_pc_after_call): Update. + (hppa_init_extra_frame_info): Update. + (hppa_frame_chain): Update. + (hppa_frame_chain_valid): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_init_extra_frame_info): Update. + * arm-tdep.c (arm_frame_chain_valid): Update. + (arm_init_extra_frame_info): Update. + (arm_pop_frame): Update. + * frame.c (frame_pc_unwind): Update. + * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update. + (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (gdbarch_unwind_pc): New method. + * gdbarch.h, gdbarch.c: Regenerate. + * frame.c (frame_pc_unwind): Rewrite. Prefer gdbarch_unwind_pc, + but use read_pc and FRAME_SAVED_PC as fall backs. + (frame_saved_regs_pc_unwind): Delete function. + (trad_frame_unwinder): Update. + * frame-unwind.h (frame_unwind_pc_ftype): Delete declaration. + (struct frame_unwind): Update. + * dummy-frame.c (dummy_frame_pc_unwind): Delete function. + (dummy_frame_unwind): Update. + * sentinel-frame.c (sentinel_frame_pc_unwind): Delete function. + (sentinel_frame_unwinder): Update. + * d10v-tdep.c (d10v_frame_pc_unwind): Delete function. + (d10v_frame_unwind): Update. + (d10v_unwind_pc): New function. + (d10v_gdbarch_init): Set unwind_pc. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.h: Re-generate. + + * d10v-tdep.c (d10v_frame_register_unwind): Correctly unwind the + PC. + (d10v_frame_pop): Unwind the PC, and not the LR, when restoring + the PC register. + +2003-03-08 Mark Kettenis <kettenis@gnu.org> + + * gdbarch.sh (save_dummy_frame_tos): Add comment. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * cli-out.c: Update copyright. + (cli_out_data): Define typedef. Use instead of ui_out_data. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * valarith.c (value_subscripted_rvalue): Copy the array's REGNO to + the result. + 2003-03-07 Andrew Cagney <cagney@redhat.com> * gdbarch.sh: Don't generate two macro definitions when an diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 6315888..00ac4c0 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -386,6 +386,7 @@ Petr Sorfa petrs@caldera.com Gary Thomas gthomas@redhat.com Jason Thorpe thorpej@wasabisystems.com Tom Tromey tromey@redhat.com +D Venkatasubramanian dvenkat@noida.hcltech.com Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com Kris Warkentin kewarken@qnx.com diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 3d1d96e..43c2273 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -68,7 +68,6 @@ static gdbarch_frame_locals_address_ftype alpha_frame_locals_address; static gdbarch_skip_prologue_ftype alpha_skip_prologue; static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call; static gdbarch_frame_chain_ftype alpha_frame_chain; -static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc; static gdbarch_push_arguments_ftype alpha_push_arguments; static gdbarch_pop_frame_ftype alpha_pop_frame; @@ -459,7 +458,7 @@ static CORE_ADDR alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev) { return (fromleaf ? SAVED_PC_AFTER_CALL (get_next_frame (prev)) - : get_next_frame (prev) ? FRAME_SAVED_PC (get_next_frame (prev)) + : get_next_frame (prev) ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)) : read_pc ()); } @@ -932,7 +931,7 @@ static CORE_ADDR alpha_frame_chain (struct frame_info *frame) { alpha_extra_func_info_t proc_desc; - CORE_ADDR saved_pc = FRAME_SAVED_PC (frame); + CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); if (saved_pc == 0 || inside_entry_file (saved_pc)) return 0; @@ -1303,7 +1302,7 @@ alpha_pop_frame (void) frame->proc_desc? If we do, who will free it? For now, we don't save a copy... */ - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); if (get_frame_saved_regs (frame) == NULL) alpha_find_saved_regs (frame); if (proc_desc) @@ -1842,7 +1841,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call); set_gdbarch_frame_chain (gdbarch, alpha_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, alpha_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, alpha_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 1016ba1..712b03e 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -386,7 +386,7 @@ init_frame_pc_default (int fromleaf, struct frame_info *prev) if (fromleaf) return SAVED_PC_AFTER_CALL (get_next_frame (prev)); else if (get_next_frame (prev) != NULL) - return FRAME_SAVED_PC (get_next_frame (prev)); + return DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)); else return read_pc (); } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 11b2350..9305105 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -159,7 +159,7 @@ struct frame_extra_info static int arm_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) { - return (FRAME_SAVED_PC (thisframe) >= LOWEST_PC); + return (DEPRECATED_FRAME_SAVED_PC (thisframe) >= LOWEST_PC); } /* Set to true if the 32-bit mode is in use. */ @@ -1032,7 +1032,7 @@ arm_frame_chain (struct frame_info *fi) return 0; /* If the caller is the startup code, we're at the end of the chain. */ - caller_pc = FRAME_SAVED_PC (fi); + caller_pc = DEPRECATED_FRAME_SAVED_PC (fi); /* If the caller is Thumb and the caller is ARM, or vice versa, the frame register of the caller is different from ours. @@ -1090,7 +1090,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) get_frame_extra_info (fi)->framereg = 0; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); memset (get_frame_saved_regs (fi), '\000', sizeof get_frame_saved_regs (fi)); @@ -1535,7 +1535,7 @@ arm_pop_frame (void) read_memory_integer (get_frame_saved_regs (frame)[regnum], REGISTER_RAW_SIZE (regnum))); - write_register (ARM_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (ARM_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); write_register (ARM_SP_REGNUM, old_SP); flush_cached_frames (); @@ -2909,7 +2909,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_chain (gdbarch, arm_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, arm_frameless_function_invocation); - set_gdbarch_frame_saved_pc (gdbarch, arm_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, arm_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, arm_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address); set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 975132a..a242d6b 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -736,7 +736,7 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) int reg; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); frame_saved_regs_zalloc (fi); @@ -1201,7 +1201,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); /* ??? */ set_gdbarch_frame_chain (gdbarch, avr_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, avr_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, avr_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, avr_frame_address); set_gdbarch_frame_locals_address (gdbarch, avr_frame_address); set_gdbarch_saved_pc_after_call (gdbarch, avr_saved_pc_after_call); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f27f3fc..1ff80d7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1816,6 +1816,11 @@ bpstat_copy (bpstat bs) { tmp = (bpstat) xmalloc (sizeof (*tmp)); memcpy (tmp, bs, sizeof (*tmp)); + if (bs->commands != NULL) + tmp->commands = copy_command_lines (bs->commands); + if (bs->old_val != NULL) + tmp->old_val = value_copy (bs->old_val); + if (p == NULL) /* This is the first thing in the chain. */ retval = tmp; @@ -2758,9 +2763,9 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) /* We will stop here */ if (b->disposition == disp_disable) b->enable_state = bp_disabled; - bs->commands = copy_command_lines (b->commands); if (b->silent) bs->print = 0; + bs->commands = b->commands; if (bs->commands && (STREQ ("silent", bs->commands->line) || (xdb_commands && STREQ ("Q", bs->commands->line)))) @@ -2768,6 +2773,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) bs->commands = bs->commands->next; bs->print = 0; } + bs->commands = copy_command_lines (bs->commands); } } /* Print nothing for this entry if we dont stop or if we dont print. */ diff --git a/gdb/cli-out.c b/gdb/cli-out.c index e3b45cd..38bf36f 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -1,6 +1,6 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -33,6 +33,7 @@ struct ui_out_data struct ui_file *stream; int suppress_output; }; +typedef struct ui_out_data cli_out_data; /* These are the CLI output functions */ @@ -110,7 +111,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (nr_rows == 0) data->suppress_output = 1; else @@ -124,7 +125,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols, void cli_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* first, close the table header line */ @@ -136,7 +137,7 @@ cli_table_body (struct ui_out *uiout) void cli_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); data->suppress_output = 0; } @@ -147,7 +148,7 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; cli_field_string (uiout, 0, width, alignment, 0, colhdr); @@ -161,7 +162,7 @@ cli_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -173,7 +174,7 @@ cli_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -187,7 +188,7 @@ cli_field_int (struct ui_out *uiout, int fldno, int width, { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; sprintf (buffer, "%d", value); @@ -201,7 +202,7 @@ cli_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; cli_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -221,7 +222,7 @@ cli_field_string (struct ui_out *uiout, int before = 0; int after = 0; - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -268,7 +269,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -281,7 +282,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno, void cli_spaces (struct ui_out *uiout, int numspaces) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; print_spaces_filtered (numspaces, data->stream); @@ -290,7 +291,7 @@ cli_spaces (struct ui_out *uiout, int numspaces) void cli_text (struct ui_out *uiout, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; fputs_filtered (string, data->stream); @@ -300,7 +301,7 @@ void cli_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if (ui_out_get_verblvl (uiout) >= verbosity) @@ -310,7 +311,7 @@ cli_message (struct ui_out *uiout, int verbosity, void cli_wrap_hint (struct ui_out *uiout, char *identstring) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; wrap_here (identstring); @@ -319,7 +320,7 @@ cli_wrap_hint (struct ui_out *uiout, char *identstring) void cli_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); gdb_flush (data->stream); } @@ -334,7 +335,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, const char *fldname, const char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); va_list args; va_start (args, format); @@ -348,7 +349,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, static void field_separator (void) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); fputc_filtered (' ', data->stream); } @@ -359,7 +360,7 @@ cli_out_new (struct ui_file *stream) { int flags = ui_source_list; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + cli_out_data *data = XMALLOC (cli_out_data); data->stream = stream; data->suppress_output = 0; return ui_out_new (&cli_ui_out_impl, data, flags); @@ -368,7 +369,7 @@ cli_out_new (struct ui_file *stream) struct ui_file * cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); struct ui_file *old = data->stream; data->stream = stream; return old; diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index a1abc0e..c54f9a7 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -99,8 +99,8 @@ extern int delta68_in_sigtramp (CORE_ADDR pc, char *name); #define IN_SIGTRAMP(pc,name) delta68_in_sigtramp (pc, name) extern CORE_ADDR delta68_frame_saved_pc (struct frame_info *fi); -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) +#undef DEPRECATED_FRAME_SAVED_PC +#define DEPRECATED_FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) extern CORE_ADDR delta68_frame_args_address (struct frame_info *fi); #undef FRAME_ARGS_ADDRESS diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h index 4990bb0..cc20c62 100644 --- a/gdb/config/m68k/tm-linux.h +++ b/gdb/config/m68k/tm-linux.h @@ -100,8 +100,8 @@ #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) +#undef DEPRECATED_FRAME_SAVED_PC +#define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *); #define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc) diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index dc23a63..4616bdd 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -420,7 +420,7 @@ extern int hppa_frameless_function_invocation (struct frame_info *); #if !GDB_MULTI_ARCH extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); -#define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) +#define DEPRECATED_FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) #endif #if !GDB_MULTI_ARCH diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 1bdd9eb..08f069b 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -80,7 +80,7 @@ extern void aix_process_linenos (void); #define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \ (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ - prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()) + prev->next ? DEPRECATED_FRAME_SAVED_PC (prev->next) : read_pc ()) /* NOTE: cagney/2002-12-08: Add local declaration of init_frame_pc_noop() because it isn't possible to include "arch-utils.h" here. Not too bad as this entire file is going away diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 20d5b37..f0267d0 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -484,7 +484,7 @@ extern CORE_ADDR sparc_frame_chain (struct frame_info *); /* Where is the PC for a specific frame */ -#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME) +#define DEPRECATED_FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME) extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *); /* If the argument is on the stack, it will be here. */ @@ -519,7 +519,7 @@ extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); #define DEPRECATED_INIT_FRAME_PC(FROMLEAF, PREV) (init_frame_pc_noop (FROMLEAF, PREV)) #define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \ ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \ - (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ()) + (PREV)->next ? DEPRECATED_FRAME_SAVED_PC ((PREV)->next) : read_pc ()) /* Define other aspects of the stack frame. */ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index a51f98c..fae9958 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1204,7 +1204,7 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (get_next_frame (fi)) { /* Called from get_prev_frame. */ - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); } frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); @@ -4316,7 +4316,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) (gdbarch, cris_frameless_function_invocation); set_gdbarch_frame_chain (gdbarch, cris_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, cris_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc); set_gdbarch_saved_pc_after_call (gdbarch, cris_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 5f334e6..b60ce7f 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1445,13 +1445,12 @@ display_trace (int low, int high) } } - static CORE_ADDR -d10v_frame_pc_unwind (struct frame_info *frame, - void **cache) +d10v_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache); - return info->return_pc; + ULONGEST pc; + frame_unwind_unsigned_register (next_frame, PC_REGNUM, &pc); + return d10v_make_iaddr (pc); } /* Given a GDB frame, determine the address of the calling function's @@ -1557,51 +1556,23 @@ d10v_frame_register_unwind (struct frame_info *frame, int *realnump, void *bufferp) { struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache); - saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp, - lvalp, addrp, realnump, bufferp); -} - - -static void -d10v_frame_pop (struct frame_info *fi, void **unwind_cache, - struct regcache *regcache) -{ - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (fi, unwind_cache); - CORE_ADDR fp; - int regnum; - char raw_buffer[8]; - - fp = get_frame_base (fi); - - /* now update the current registers with the old values */ - for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++) + if (regnum == PC_REGNUM) { - frame_unwind_register (fi, regnum, raw_buffer); - regcache_cooked_write (regcache, regnum, raw_buffer); + /* The call instruction saves the caller's PC in LR. The + function prologue of the callee may then save the LR on the + stack. Find that possibly saved LR value and return it. */ + saved_regs_unwinder (frame, info->saved_regs, LR_REGNUM, optimizedp, + lvalp, addrp, realnump, bufferp); } - for (regnum = 0; regnum < SP_REGNUM; regnum++) + else { - frame_unwind_register (fi, regnum, raw_buffer); - regcache_cooked_write (regcache, regnum, raw_buffer); + saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp, + lvalp, addrp, realnump, bufferp); } - frame_unwind_register (fi, PSW_REGNUM, raw_buffer); - regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer); - - frame_unwind_register (fi, LR_REGNUM, raw_buffer); - regcache_cooked_write (regcache, PC_REGNUM, raw_buffer); - - store_unsigned_integer (raw_buffer, - register_size (current_gdbarch, SP_REGNUM), - fp + info->size); - regcache_cooked_write (regcache, SP_REGNUM, raw_buffer); - - target_store_registers (-1); - flush_cached_frames (); } + static struct frame_unwind d10v_frame_unwind = { - d10v_frame_pop, - d10v_frame_pc_unwind, d10v_frame_id_unwind, d10v_frame_register_unwind }; @@ -1769,6 +1740,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); + /* Return the unwound PC value. */ + set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc); + return gdbarch; } diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4971d32..c6e1c61 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,17 @@ +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Rename + FRAME_SAVED_PC to DEPRECATED_FRAME_SAVED_PC. + +2003-03-10 Corinna Vinschen <vinschen@redhat.com> + + * gdb.texinfo: Add File-I/O documentation. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Cross reference + FRAME_SAVED_PC to unwind_pc. Document unwind_pc. + 2003-03-07 Andrew Cagney <cagney@redhat.com> * gdb.texinfo (Debugging Output): Mention the "set/show debug diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index b0ba376..99de23b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -14801,6 +14801,7 @@ compiled with the @samp{-pg} compiler option. * General Query Packets:: * Register Packet Format:: * Examples:: +* File-I/O remote protocol extension:: @end menu @node Overview @@ -15025,9 +15026,12 @@ Reserved for future use. Reserved for future use. -@item @code{F} --- reserved +@item @code{F}@var{RC}@code{,}@var{EE}@code{,}@var{CF}@code{;}@var{XX} --- Reply to target's F packet. +@cindex @code{F} packet -Reserved for future use. +This packet is send by @value{GDBN} as reply to a @code{F} request packet +sent by the target. This is part of the File-I/O protocol extension. +@xref{File-I/O remote protocol extension}, for the specification. @item @code{g} --- read registers @anchor{read registers packet} @@ -15526,6 +15530,24 @@ is a query initiated by the host debugger.} any time while the program is running and the debugger should continue to wait for @samp{W}, @samp{T}, etc. +@item F@var{call-id}@code{,}@var{parameter@dots{}} + +@var{call-id} is the identifier which says which host system call should +be called. This is just the name of the function. Translation into the +correct system call is only applicable as it's defined in @value{GDBN}. +@xref{File-I/O remote protocol extension}, for a list of implemented +system calls. + +@var{parameter@dots{}} is a list of parameters as defined for this very +system call. + +The target replies with this packet when it expects @value{GDBN} to call +a host system call on behalf of the target. @value{GDBN} replies with +an appropriate @code{F} packet and keeps up waiting for the next reply +packet from the target. The latest @samp{C}, @samp{c}, @samp{S} or +@samp{s} action is expected to be continued. +@xref{File-I/O remote protocol extension}, for more details. + @end table @node General Query Packets @@ -15768,6 +15790,1149 @@ Example sequence of a target being stepped by a single instruction: -> @code{+} @end smallexample +@node File-I/O remote protocol extension +@section File-I/O remote protocol extension +@cindex File-I/O remote protocol extension + +@menu +* File-I/O Overview:: +* Protocol basics:: +* The `F' request packet:: +* The `F' reply packet:: +* Memory transfer:: +* The Ctrl-C message:: +* Console I/O:: +* The isatty call:: +* The system call:: +* List of supported calls:: +* Protocol specific representation of datatypes:: +* Constants:: +* File-I/O Examples:: +@end menu + +@node File-I/O Overview +@subsection File-I/O Overview +@cindex file-i/o overview + +The File I/O remote protocol extension (short: File-I/O) allows the +target to use the hosts file system and console I/O when calling various +system calls. System calls on the target system are translated into a +remote protocol packet to the host system which then performs the needed +actions and returns with an adequate response packet to the target system. +This simulates file system operations even on targets that lack file systems. + +The protocol is defined host- and target-system independent. It uses +it's own independent representation of datatypes and values. Both, +@value{GDBN} and the target's @value{GDBN} stub are responsible for +translating the system dependent values into the unified protocol values +when data is transmitted. + +The communication is synchronous. A system call is possible only +when GDB is waiting for the @samp{C}, @samp{c}, @samp{S} or @samp{s} +packets. While @value{GDBN} handles the request for a system call, +the target is stopped to allow deterministic access to the target's +memory. Therefore File-I/O is not interuptible by target signals. It +is possible to interrupt File-I/O by a user interrupt (Ctrl-C), though. + +The target's request to perform a host system call does not finish +the latest @samp{C}, @samp{c}, @samp{S} or @samp{s} action. That means, +after finishing the system call, the target returns to continuing the +previous activity (continue, step). No additional continue or step +request from @value{GDBN} is required. + +@smallexample +(gdb) continue + <- target requests 'system call X' + target is stopped, @value{GDBN} executes system call + -> GDB returns result + ... target continues, GDB returns to wait for the target + <- target hits breakpoint and sends a Txx packet +@end smallexample + +The protocol is only used for files on the host file system and +for I/O on the console. Character or block special devices, pipes, +named pipes or sockets or any other communication method on the host +system are not supported by this protocol. + +@node Protocol basics +@subsection Protocol basics +@cindex protocol basics, file-i/o + +The File-I/O protocol uses the @code{F} packet, as request as well +as as reply packet. Since a File-I/O system call can only occur when +@value{GDBN} is waiting for the continuing or stepping target, the +File-I/O request is a reply that @value{GDBN} has to expect as a result +of a former @samp{C}, @samp{c}, @samp{S} or @samp{s} packet. +This @code{F} packet contains all information needed to allow @value{GDBN} +to call the appropriate host system call: + +@itemize @bullet +@item +A unique identifier for the requested system call. + +@item +All parameters to the system call. Pointers are given as addresses +in the target memory address space. Pointers to strings are given as +pointer/length pair. Numerical values are given as they are. +Numerical control values are given in a protocol specific representation. + +@end itemize + +At that point @value{GDBN} has to perform the following actions. + +@itemize @bullet +@item +If parameter pointer values are given, which point to data needed as input +to a system call, @value{GDBN} requests this data from the target with a +standard @code{m} packet request. This additional communication has to be +expected by the target implementation and is handled as any other @code{m} +packet. + +@item +@value{GDBN} translates all value from protocol representation to host +representation as needed. Datatypes are coerced into the host types. + +@item +@value{GDBN} calls the system call + +@item +It then coerces datatypes back to protocol representation. + +@item +If pointer parameters in the request packet point to buffer space in which +a system call is expected to copy data to, the data is transmitted to the +target using a @code{M} or @code{X} packet. This packet has to be expected +by the target implementation and is handled as any other @code{M} or @code{X} +packet. + +@end itemize + +Eventually @value{GDBN} replies with another @code{F} packet which contains all +necessary information for the target to continue. This at least contains + +@itemize @bullet +@item +Return value. + +@item +@code{errno}, if has been changed by the system call. + +@item +``Ctrl-C'' flag. + +@end itemize + +After having done the needed type and value coercion, the target continues +the latest continue or step action. + +@node The `F' request packet +@subsection The @code{F} request packet +@cindex file-i/o request packet +@cindex @code{F} request packet + +The @code{F} request packet has the following format: + +@table @samp + +@smallexample +@code{F}@var{call-id}@code{,}@var{parameter@dots{}} +@end smallexample + +@var{call-id} is the identifier to indicate the host system call to be called. +This is just the name of the function. + +@var{parameter@dots{}} are the parameters to the system call. + +@end table + +Parameters are hexadecimal integer values, either the real values in case +of scalar datatypes, as pointers to target buffer space in case of compound +datatypes and unspecified memory areas or as pointer/length pairs in case +of string parameters. These are appended to the call-id, each separated +from its predecessor by a comma. All values are transmitted in ASCII +string representation, pointer/length pairs separated by a slash. + +@node The `F' reply packet +@subsection The @code{F} reply packet +@cindex file-i/o reply packet +@cindex @code{F} reply packet + +The @code{F} reply packet has the following format: + +@table @samp + +@smallexample +@code{F}@var{retcode}@code{,}@var{errno}@code{,}@var{Ctrl-C flag}@code{;}@var{call specific attachment} +@end smallexample + +@var{retcode} is the return code of the system call as hexadecimal value. + +@var{errno} is the errno set by the call, in protocol specific representation. +This parameter can be omitted if the call was successful. + +@var{Ctrl-C flag} is only send if the user requested a break. In this +case, @var{errno} must be send as well, even if the call was successful. +The @var{Ctrl-C flag} itself consists of the character 'C': + +@smallexample +F0,0,C +@end smallexample + +@noindent +or, if the call was interupted before the host call has been performed: + +@smallexample +F-1,4,C +@end smallexample + +@noindent +assuming 4 is the protocol specific representation of @code{EINTR}. + +@end table + +@node Memory transfer +@subsection Memory transfer +@cindex memory transfer, in file-i/o protocol + +Structured data which is transferred using a memory read or write as e.g.@: +a @code{struct stat} is expected to be in a protocol specific format with +all scalar multibyte datatypes being big endian. This should be done by +the target before the @code{F} packet is sent resp.@: by @value{GDBN} before +it transfers memory to the target. Transferred pointers to structured +data should point to the already coerced data at any time. + +@node The Ctrl-C message +@subsection The Ctrl-C message +@cindex ctrl-c message, in file-i/o protocol + +A special case is, if the @var{Ctrl-C flag} is set in the @value{GDBN} +reply packet. In this case the target should behave, as if it had +gotten a break message. The meaning for the target is ``system call +interupted by @code{SIGINT}''. Consequentially, the target should actually stop +(as with a break message) and return to @value{GDBN} with a @code{T02} +packet. In this case, it's important for the target to know, in which +state the system call was interrupted. Since this action is by design +not an atomic operation, we have to differ between two cases: + +@itemize @bullet +@item +The system call hasn't been performed on the host yet. + +@item +The system call on the host has been finished. + +@end itemize + +These two states can be distinguished by the target by the value of the +returned @code{errno}. If it's the protocol representation of @code{EINTR}, the system +call hasn't been performed. This is equivalent to the @code{EINTR} handling +on POSIX systems. In any other case, the target may presume that the +system call has been finished --- successful or not --- and should behave +as if the break message arrived right after the system call. + +@value{GDBN} must behave reliable. If the system call has not been called +yet, @value{GDBN} may send the @code{F} reply immediately, setting @code{EINTR} as +@code{errno} in the packet. If the system call on the host has been finished +before the user requests a break, the full action must be finshed by +@value{GDBN}. This requires sending @code{M} or @code{X} packets as they fit. +The @code{F} packet may only be send when either nothing has happened +or the full action has been completed. + +@node Console I/O +@subsection Console I/O +@cindex console i/o as part of file-i/o + +By default and if not explicitely closed by the target system, the file +descriptors 0, 1 and 2 are connected to the @value{GDBN} console. Output +on the @value{GDBN} console is handled as any other file output operation +(@code{write(1, @dots{})} or @code{write(2, @dots{})}). Console input is handled +by @value{GDBN} so that after the target read request from file descriptor +0 all following typing is buffered until either one of the following +conditions is met: + +@itemize @bullet +@item +The user presses @kbd{Ctrl-C}. The behaviour is as explained above, the +@code{read} +system call is treated as finished. + +@item +The user presses @kbd{Enter}. This is treated as end of input with a trailing +line feed. + +@item +The user presses @kbd{Ctrl-D}. This is treated as end of input. No trailing +character, especially no Ctrl-D is appended to the input. + +@end itemize + +If the user has typed more characters as fit in the buffer given to +the read call, the trailing characters are buffered in @value{GDBN} until +either another @code{read(0, @dots{})} is requested by the target or debugging +is stopped on users request. + +@node The isatty call +@subsection The isatty(3) call +@cindex isatty call, file-i/o protocol + +A special case in this protocol is the library call @code{isatty} which +is implemented as it's own call inside of this protocol. It returns +1 to the target if the file descriptor given as parameter is attached +to the @value{GDBN} console, 0 otherwise. Implementing through system calls +would require implementing @code{ioctl} and would be more complex than +needed. + +@node The system call +@subsection The system(3) call +@cindex system call, file-i/o protocol + +The other special case in this protocol is the @code{system} call which +is implemented as it's own call, too. @value{GDBN} is taking over the full +task of calling the necessary host calls to perform the @code{system} +call. The return value of @code{system} is simplified before it's returned +to the target. Basically, the only signal transmitted back is @code{EINTR} +in case the user pressed @kbd{Ctrl-C}. Otherwise the return value consists +entirely of the exit status of the called command. + +Due to security concerns, the @code{system} call is refused to be called +by @value{GDBN} by default. The user has to allow this call explicitly by +entering + +@table @samp +@kindex set remote system-call-allowed 1 +@item @code{set remote system-call-allowed 1} +@end table + +Disabling the @code{system} call is done by + +@table @samp +@kindex set remote system-call-allowed 0 +@item @code{set remote system-call-allowed 0} +@end table + +The current setting is shown by typing + +@table @samp +@kindex show remote system-call-allowed +@item @code{show remote system-call-allowed} +@end table + +@node List of supported calls +@subsection List of supported calls +@cindex list of supported file-i/o calls + +@menu +* open:: +* close:: +* read:: +* write:: +* lseek:: +* rename:: +* unlink:: +* stat/fstat:: +* gettimeofday:: +* isatty:: +* system:: +@end menu + +@node open +@unnumberedsubsubsec open +@cindex open, file-i/o system call + +@smallexample +@exdent Synopsis: +int open(const char *pathname, int flags); +int open(const char *pathname, int flags, mode_t mode); + +@exdent Request: +Fopen,pathptr/len,flags,mode +@end smallexample + +@noindent +@code{flags} is the bitwise or of the following values: + +@table @code +@item O_CREAT +If the file does not exist it will be created. The host +rules apply as far as file ownership and time stamps +are concerned. + +@item O_EXCL +When used with O_CREAT, if the file already exists it is +an error and open() fails. + +@item O_TRUNC +If the file already exists and the open mode allows +writing (O_RDWR or O_WRONLY is given) it will be +truncated to length 0. + +@item O_APPEND +The file is opened in append mode. + +@item O_RDONLY +The file is opened for reading only. + +@item O_WRONLY +The file is opened for writing only. + +@item O_RDWR +The file is opened for reading and writing. + +@noindent +Each other bit is silently ignored. + +@end table + +@noindent +@code{mode} is the bitwise or of the following values: + +@table @code +@item S_IRUSR +User has read permission. + +@item S_IWUSR +User has write permission. + +@item S_IRGRP +Group has read permission. + +@item S_IWGRP +Group has write permission. + +@item S_IROTH +Others have read permission. + +@item S_IWOTH +Others have write permission. + +@noindent +Each other bit is silently ignored. + +@end table + +@smallexample +@exdent Return value: +open returns the new file descriptor or -1 if an error +occured. + +@exdent Errors: +@end smallexample + +@table @code +@item EEXIST +pathname already exists and O_CREAT and O_EXCL were used. + +@item EISDIR +pathname refers to a directory. + +@item EACCES +The requested access is not allowed. + +@item ENAMETOOLONG +pathname was too long. + +@item ENOENT +A directory component in pathname does not exist. + +@item ENODEV +pathname refers to a device, pipe, named pipe or socket. + +@item EROFS +pathname refers to a file on a read-only filesystem and +write access was requested. + +@item EFAULT +pathname is an invalid pointer value. + +@item ENOSPC +No space on device to create the file. + +@item EMFILE +The process already has the maximum number of files open. + +@item ENFILE +The limit on the total number of files open on the system +has been reached. + +@item EINTR +The call was interrupted by the user. +@end table + +@node close +@unnumberedsubsubsec close +@cindex close, file-i/o system call + +@smallexample +@exdent Synopsis: +int close(int fd); + +@exdent Request: +Fclose,fd + +@exdent Return value: +close returns zero on success, or -1 if an error occurred. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd isn't a valid open file descriptor. + +@item EINTR +The call was interrupted by the user. +@end table + +@node read +@unnumberedsubsubsec read +@cindex read, file-i/o system call + +@smallexample +@exdent Synopsis: +int read(int fd, void *buf, unsigned int count); + +@exdent Request: +Fread,fd,bufptr,count + +@exdent Return value: +On success, the number of bytes read is returned. +Zero indicates end of file. If count is zero, read +returns zero as well. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid file descriptor or is not open for +reading. + +@item EFAULT +buf is an invalid pointer value. + +@item EINTR +The call was interrupted by the user. +@end table + +@node write +@unnumberedsubsubsec write +@cindex write, file-i/o system call + +@smallexample +@exdent Synopsis: +int write(int fd, const void *buf, unsigned int count); + +@exdent Request: +Fwrite,fd,bufptr,count + +@exdent Return value: +On success, the number of bytes written are returned. +Zero indicates nothing was written. On error, -1 +is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid file descriptor or is not open for +writing. + +@item EFAULT +buf is an invalid pointer value. + +@item EFBIG +An attempt was made to write a file that exceeds the +host specific maximum file size allowed. + +@item ENOSPC +No space on device to write the data. + +@item EINTR +The call was interrupted by the user. +@end table + +@node lseek +@unnumberedsubsubsec lseek +@cindex lseek, file-i/o system call + +@smallexample +@exdent Synopsis: +long lseek (int fd, long offset, int flag); + +@exdent Request: +Flseek,fd,offset,flag +@end smallexample + +@code{flag} is one of: + +@table @code +@item SEEK_SET +The offset is set to offset bytes. + +@item SEEK_CUR +The offset is set to its current location plus offset +bytes. + +@item SEEK_END +The offset is set to the size of the file plus offset +bytes. +@end table + +@smallexample +@exdent Return value: +On success, the resulting unsigned offset in bytes from +the beginning of the file is returned. Otherwise, a +value of -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid open file descriptor. + +@item ESPIPE +fd is associated with the @value{GDBN} console. + +@item EINVAL +flag is not a proper value. + +@item EINTR +The call was interrupted by the user. +@end table + +@node rename +@unnumberedsubsubsec rename +@cindex rename, file-i/o system call + +@smallexample +@exdent Synopsis: +int rename(const char *oldpath, const char *newpath); + +@exdent Request: +Frename,oldpathptr/len,newpathptr/len + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EISDIR +newpath is an existing directory, but oldpath is not a +directory. + +@item EEXIST +newpath is a non-empty directory. + +@item EBUSY +oldpath or newpath is a directory that is in use by some +process. + +@item EINVAL +An attempt was made to make a directory a subdirectory +of itself. + +@item ENOTDIR +A component used as a directory in oldpath or new +path is not a directory. Or oldpath is a directory +and newpath exists but is not a directory. + +@item EFAULT +oldpathptr or newpathptr are invalid pointer values. + +@item EACCES +No access to the file or the path of the file. + +@item ENAMETOOLONG + +oldpath or newpath was too long. + +@item ENOENT +A directory component in oldpath or newpath does not exist. + +@item EROFS +The file is on a read-only filesystem. + +@item ENOSPC +The device containing the file has no room for the new +directory entry. + +@item EINTR +The call was interrupted by the user. +@end table + +@node unlink +@unnumberedsubsubsec unlink +@cindex unlink, file-i/o system call + +@smallexample +@exdent Synopsis: +int unlink(const char *pathname); + +@exdent Request: +Funlink,pathnameptr/len + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EACCES +No access to the file or the path of the file. + +@item EPERM +The system does not allow unlinking of directories. + +@item EBUSY +The file pathname cannot be unlinked because it's +being used by another process. + +@item EFAULT +pathnameptr is an invalid pointer value. + +@item ENAMETOOLONG +pathname was too long. + +@item ENOENT +A directory component in pathname does not exist. + +@item ENOTDIR +A component of the path is not a directory. + +@item EROFS +The file is on a read-only filesystem. + +@item EINTR +The call was interrupted by the user. +@end table + +@node stat/fstat +@unnumberedsubsubsec stat/fstat +@cindex fstat, file-i/o system call +@cindex stat, file-i/o system call + +@smallexample +@exdent Synopsis: +int stat(const char *pathname, struct stat *buf); +int fstat(int fd, struct stat *buf); + +@exdent Request: +Fstat,pathnameptr/len,bufptr +Ffstat,fd,bufptr + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid open file. + +@item ENOENT +A directory component in pathname does not exist or the +path is an empty string. + +@item ENOTDIR +A component of the path is not a directory. + +@item EFAULT +pathnameptr is an invalid pointer value. + +@item EACCES +No access to the file or the path of the file. + +@item ENAMETOOLONG +pathname was too long. + +@item EINTR +The call was interrupted by the user. +@end table + +@node gettimeofday +@unnumberedsubsubsec gettimeofday +@cindex gettimeofday, file-i/o system call + +@smallexample +@exdent Synopsis: +int gettimeofday(struct timeval *tv, void *tz); + +@exdent Request: +Fgettimeofday,tvptr,tzptr + +@exdent Return value: +On success, 0 is returned, -1 otherwise. + +@exdent Errors: +@end smallexample + +@table @code +@item EINVAL +tz is a non-NULL pointer. + +@item EFAULT +tvptr and/or tzptr is an invalid pointer value. +@end table + +@node isatty +@unnumberedsubsubsec isatty +@cindex isatty, file-i/o system call + +@smallexample +@exdent Synopsis: +int isatty(int fd); + +@exdent Request: +Fisatty,fd + +@exdent Return value: +Returns 1 if fd refers to the @value{GDBN} console, 0 otherwise. + +@exdent Errors: +@end smallexample + +@table @code +@item EINTR +The call was interrupted by the user. +@end table + +@node system +@unnumberedsubsubsec system +@cindex system, file-i/o system call + +@smallexample +@exdent Synopsis: +int system(const char *command); + +@exdent Request: +Fsystem,commandptr/len + +@exdent Return value: +The value returned is -1 on error and the return status +of the command otherwise. Only the exit status of the +command is returned, which is extracted from the hosts +system return value by calling WEXITSTATUS(retval). +In case /bin/sh could not be executed, 127 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EINTR +The call was interrupted by the user. +@end table + +@node Protocol specific representation of datatypes +@subsection Protocol specific representation of datatypes +@cindex protocol specific representation of datatypes, in file-i/o protocol + +@menu +* Integral datatypes:: +* Pointer values:: +* struct stat:: +* struct timeval:: +@end menu + +@node Integral datatypes +@unnumberedsubsubsec Integral datatypes +@cindex integral datatypes, in file-i/o protocol + +The integral datatypes used in the system calls are + +@smallexample +int@r{,} unsigned int@r{,} long@r{,} unsigned long@r{,} mode_t @r{and} time_t +@end smallexample + +@code{Int}, @code{unsigned int}, @code{mode_t} and @code{time_t} are +implemented as 32 bit values in this protocol. + +@code{Long} and @code{unsigned long} are implemented as 64 bit types. + +@xref{Limits}, for corresponding MIN and MAX values (similar to those +in @file{limits.h}) to allow range checking on host and target. + +@code{time_t} datatypes are defined as seconds since the Epoch. + +All integral datatypes transferred as part of a memory read or write of a +structured datatype e.g.@: a @code{struct stat} have to be given in big endian +byte order. + +@node Pointer values +@unnumberedsubsubsec Pointer values +@cindex pointer values, in file-i/o protocol + +Pointers to target data are transmitted as they are. An exception +is made for pointers to buffers for which the length isn't +transmitted as part of the function call, namely strings. Strings +are transmitted as a pointer/length pair, both as hex values, e.g.@: + +@smallexample +@code{1aaf/12} +@end smallexample + +@noindent +which is a pointer to data of length 18 bytes at position 0x1aaf. +The length is defined as the full string length in bytes, including +the trailing null byte. Example: + +@smallexample +``hello, world'' at address 0x123456 +@end smallexample + +@noindent +is transmitted as + +@smallexample +@code{123456/d} +@end smallexample + +@node struct stat +@unnumberedsubsubsec struct stat +@cindex struct stat, in file-i/o protocol + +The buffer of type struct stat used by the target and @value{GDBN} is defined +as follows: + +@smallexample +struct stat @{ + unsigned int st_dev; /* device */ + unsigned int st_ino; /* inode */ + mode_t st_mode; /* protection */ + unsigned int st_nlink; /* number of hard links */ + unsigned int st_uid; /* user ID of owner */ + unsigned int st_gid; /* group ID of owner */ + unsigned int st_rdev; /* device type (if inode device) */ + unsigned long st_size; /* total size, in bytes */ + unsigned long st_blksize; /* blocksize for filesystem I/O */ + unsigned long st_blocks; /* number of blocks allocated */ + time_t st_atime; /* time of last access */ + time_t st_mtime; /* time of last modification */ + time_t st_ctime; /* time of last change */ +@}; +@end smallexample + +The integral datatypes are conforming to the definitions given in the +approriate section (see @ref{Integral datatypes}, for details) so this +structure is of size 64 bytes. + +The values of several fields have a restricted meaning and/or +range of values. + +@smallexample +st_dev: 0 file + 1 console + +st_ino: No valid meaning for the target. Transmitted unchanged. + +st_mode: Valid mode bits are described in Appendix C. Any other + bits have currently no meaning for the target. + +st_uid: No valid meaning for the target. Transmitted unchanged. + +st_gid: No valid meaning for the target. Transmitted unchanged. + +st_rdev: No valid meaning for the target. Transmitted unchanged. + +st_atime, st_mtime, st_ctime: + These values have a host and file system dependent + accuracy. Especially on Windows hosts the file systems + don't support exact timing values. +@end smallexample + +The target gets a struct stat of the above representation and is +responsible to coerce it to the target representation before +continuing. + +Note that due to size differences between the host and target +representation of stat members, these members could eventually +get truncated on the target. + +@node struct timeval +@unnumberedsubsubsec struct timeval +@cindex struct timeval, in file-i/o protocol + +The buffer of type struct timeval used by the target and @value{GDBN} +is defined as follows: + +@smallexample +struct timeval @{ + time_t tv_sec; /* second */ + long tv_usec; /* microsecond */ +@}; +@end smallexample + +The integral datatypes are conforming to the definitions given in the +approriate section (see @ref{Integral datatypes}, for details) so this +structure is of size 8 bytes. + +@node Constants +@subsection Constants +@cindex constants, in file-i/o protocol + +The following values are used for the constants inside of the +protocol. @value{GDBN} and target are resposible to translate these +values before and after the call as needed. + +@menu +* Open flags:: +* mode_t values:: +* Errno values:: +* Lseek flags:: +* Limits:: +@end menu + +@node Open flags +@unnumberedsubsubsec Open flags +@cindex open flags, in file-i/o protocol + +All values are given in hexadecimal representation. + +@smallexample + O_RDONLY 0x0 + O_WRONLY 0x1 + O_RDWR 0x2 + O_APPEND 0x8 + O_CREAT 0x200 + O_TRUNC 0x400 + O_EXCL 0x800 +@end smallexample + +@node mode_t values +@unnumberedsubsubsec mode_t values +@cindex mode_t values, in file-i/o protocol + +All values are given in octal representation. + +@smallexample + S_IFREG 0100000 + S_IFDIR 040000 + S_IRUSR 0400 + S_IWUSR 0200 + S_IXUSR 0100 + S_IRGRP 040 + S_IWGRP 020 + S_IXGRP 010 + S_IROTH 04 + S_IWOTH 02 + S_IXOTH 01 +@end smallexample + +@node Errno values +@unnumberedsubsubsec Errno values +@cindex errno values, in file-i/o protocol + +All values are given in decimal representation. + +@smallexample + EPERM 1 + ENOENT 2 + EINTR 4 + EBADF 9 + EACCES 13 + EFAULT 14 + EBUSY 16 + EEXIST 17 + ENODEV 19 + ENOTDIR 20 + EISDIR 21 + EINVAL 22 + ENFILE 23 + EMFILE 24 + EFBIG 27 + ENOSPC 28 + ESPIPE 29 + EROFS 30 + ENAMETOOLONG 91 + EUNKNOWN 9999 +@end smallexample + + EUNKNOWN is used as a fallback error value if a host system returns + any error value not in the list of supported error numbers. + +@node Lseek flags +@unnumberedsubsubsec Lseek flags +@cindex lseek flags, in file-i/o protocol + +@smallexample + SEEK_SET 0 + SEEK_CUR 1 + SEEK_END 2 +@end smallexample + +@node Limits +@unnumberedsubsubsec Limits +@cindex limits, in file-i/o protocol + +All values are given in decimal representation. + +@smallexample + INT_MIN -2147483648 + INT_MAX 2147483647 + UINT_MAX 4294967295 + LONG_MIN -9223372036854775808 + LONG_MAX 9223372036854775807 + ULONG_MAX 18446744073709551615 +@end smallexample + +@node File-I/O Examples +@subsection File-I/O Examples +@cindex file-i/o examples + +Example sequence of a write call, file descriptor 3, buffer is at target +address 0x1234, 6 bytes should be written: + +@smallexample +<- @code{Fwrite,3,1234,6} +@emph{request memory read from target} +-> @code{m1234,6} +<- XXXXXX +@emph{return "6 bytes written"} +-> @code{F6} +@end smallexample + +Example sequence of a read call, file descriptor 3, buffer is at target +address 0x1234, 6 bytes should be read: + +@smallexample +<- @code{Fread,3,1234,6} +@emph{request memory write to target} +-> @code{X1234,6:XXXXXX} +@emph{return "6 bytes read"} +-> @code{F6} +@end smallexample + +Example sequence of a read call, call fails on the host due to invalid +file descriptor (EBADF): + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{F-1,9} +@end smallexample + +Example sequence of a read call, user presses Ctrl-C before syscall on +host is called: + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{F-1,4,C} +<- @code{T02} +@end smallexample + +Example sequence of a read call, user presses Ctrl-C after syscall on +host is called: + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{X1234,6:XXXXXX} +<- @code{T02} +@end smallexample + @include gpl.texi @include fdl.texi diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 7deabfc..60d6c9d 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3268,10 +3268,30 @@ For the frame described by @var{fi} return the number of arguments that are being passed. If the number of arguments is not known, return @code{-1}. -@item FRAME_SAVED_PC(@var{frame}) -@findex FRAME_SAVED_PC -Given @var{frame}, return the pc saved there. This is the return -address. +@item DEPRECATED_FRAME_SAVED_PC(@var{frame}) +@findex DEPRECATED_FRAME_SAVED_PC +@anchor{DEPRECATED_FRAME_SAVED_PC} Given @var{frame}, return the pc +saved there. This is the return address. + +This method is deprecated. @xref{unwind_pc}. + +@item CORE_ADDR unwind_pc (struct frame_info *@var{this_frame}) +@findex unwind_pc +@anchor{unwind_pc} Return the instruction address, in @var{this_frame}'s +caller, at which execution will resume after @var{this_frame} returns. +This is commonly refered to as the return address. + +The implementation, which must be frame agnostic (work with any frame), +is typically no more than: + +@smallexample +ULONGEST pc; +frame_unwind_unsigned_register (this_frame, D10V_PC_REGNUM, &pc); +return d10v_make_iaddr (pc); +@end smallexample + +@noindent +@xref{DEPRECATED_FRAME_SAVED_PC}, which this method replaces. @item FUNCTION_EPILOGUE_SIZE @findex FUNCTION_EPILOGUE_SIZE diff --git a/gdb/doublest.c b/gdb/doublest.c index e601a4d..3f68273 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -633,6 +633,14 @@ floatformat_from_length (int len) return TARGET_DOUBLE_FORMAT; else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT) return TARGET_LONG_DOUBLE_FORMAT; + /* On i386 the 'long double' type takes 96 bits, + while the real number of used bits is only 80, + both in processor and in memory. + The code below accepts the real bit size. */ + else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) + && (len * TARGET_CHAR_BIT == + TARGET_LONG_DOUBLE_FORMAT->totalsize)) + return TARGET_LONG_DOUBLE_FORMAT; return NULL; } diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 5b63830..bf4a31c 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -282,37 +282,6 @@ discard_innermost_dummy (struct dummy_frame **stack) xfree (tbd); } -/* Function: dummy_frame_pop. Restore the machine state from a saved - dummy stack frame. */ - -static void -dummy_frame_pop (struct frame_info *fi, void **cache, - struct regcache *regcache) -{ - struct dummy_frame *dummy = cached_find_dummy_frame (fi, cache); - - /* If it isn't, what are we even doing here? */ - gdb_assert (get_frame_type (fi) == DUMMY_FRAME); - - if (dummy == NULL) - error ("Can't pop dummy frame!"); - - /* Discard all dummy frames up-to but not including this one. */ - while (dummy_frame_stack != dummy) - discard_innermost_dummy (&dummy_frame_stack); - - /* Restore this one. */ - regcache_cpy (regcache, dummy->regcache); - flush_cached_frames (); - - /* Now discard it. */ - discard_innermost_dummy (&dummy_frame_stack); - - /* Note: target changed would be better. Registers, memory and - frame are all invalid. */ - flush_cached_frames (); -} - void generic_pop_dummy_frame (void) { @@ -370,23 +339,6 @@ dummy_frame_register_unwind (struct frame_info *frame, void **cache, } } -/* Assuming that FRAME is a dummy, return the resume address for the - previous frame. */ - -static CORE_ADDR -dummy_frame_pc_unwind (struct frame_info *frame, - void **cache) -{ - struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache); - /* Oops! In a dummy-frame but can't find the stack dummy. Pretend - that the frame doesn't unwind. Should this function instead - return a has-no-caller indication? */ - if (dummy == NULL) - return 0; - return dummy->pc; -} - - /* Assuming that FRAME is a dummy, return the ID of the calling frame (the frame that the dummy has the saved state of). */ @@ -407,8 +359,6 @@ dummy_frame_id_unwind (struct frame_info *frame, static struct frame_unwind dummy_frame_unwind = { - dummy_frame_pop, - dummy_frame_pc_unwind, dummy_frame_id_unwind, dummy_frame_register_unwind }; @@ -447,7 +447,7 @@ evaluate_subexp_standard (struct type *expect_type, case OP_REGISTER: { int regno = longest_to_int (exp->elts[pc + 1].longconst); - struct value *val = value_of_register (regno, deprecated_selected_frame); + struct value *val = value_of_register (regno, get_selected_frame ()); (*pos) += 2; if (val == NULL) error ("Value of register %s not available.", diff --git a/gdb/findvar.c b/gdb/findvar.c index 3147126..38d01cd 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -305,7 +305,7 @@ value_of_register (int regnum, struct frame_info *frame) /* Builtin registers lie completly outside of the range of normal registers. Catch them early so that the target never sees them. */ if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) - return value_of_builtin_reg (regnum, deprecated_selected_frame); + return value_of_builtin_reg (regnum, frame); get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval); diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 2c67c96..5d85efe 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -69,12 +69,6 @@ typedef void (frame_unwind_reg_ftype) (struct frame_info * frame, CORE_ADDR *addrp, int *realnump, void *valuep); -/* Same as for registers above, but return the address at which the - calling frame would resume. */ - -typedef CORE_ADDR (frame_unwind_pc_ftype) (struct frame_info * frame, - void **unwind_cache); - /* Same as for registers above, but return the ID of the frame that called this one. */ @@ -82,28 +76,11 @@ typedef void (frame_unwind_id_ftype) (struct frame_info * frame, void **unwind_cache, struct frame_id * id); -/* Discard the frame by restoring the registers (in regcache) back to - that of the caller. */ -/* NOTE: cagney/2003-01-19: While at present the callers all pop each - frame in turn, the implementor should try to code things so that - any frame can be popped directly. */ -/* FIXME: cagney/2003-01-19: Since both FRAME and REGCACHE refer to a - common register cache, care must be taken when restoring the - registers. The `correct fix' is to first first save the registers - in a scratch cache, and second write that scratch cache back to to - the real register cache. */ - -typedef void (frame_unwind_pop_ftype) (struct frame_info *frame, - void **unwind_cache, - struct regcache *regcache); - struct frame_unwind { /* Should the frame's type go here? */ /* Should an attribute indicating the frame's address-in-block go here? */ - frame_unwind_pop_ftype *pop; - frame_unwind_pc_ftype *pc; frame_unwind_id_ftype *id; frame_unwind_reg_ftype *reg; }; diff --git a/gdb/frame.c b/gdb/frame.c index bf860fe..267d484 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -135,26 +135,94 @@ frame_find_by_id (struct frame_id id) } CORE_ADDR -frame_pc_unwind (struct frame_info *frame) +frame_pc_unwind (struct frame_info *this_frame) { - if (!frame->pc_unwind_cache_p) + if (!this_frame->pc_unwind_cache_p) { - frame->pc_unwind_cache = frame->unwind->pc (frame, &frame->unwind_cache); - frame->pc_unwind_cache_p = 1; + CORE_ADDR pc; + if (gdbarch_unwind_pc_p (current_gdbarch)) + { + /* The right way. The `pure' way. The one true way. This + method depends solely on the register-unwind code to + determine the value of registers in THIS frame, and hence + the value of this frame's PC (resume address). A typical + implementation is no more than: + + frame_unwind_register (this_frame, ISA_PC_REGNUM, buf); + return extract_address (buf, size of ISA_PC_REGNUM); + + Note: this method is very heavily dependent on a correct + register-unwind implementation, it pays to fix that + method first; this method is frame type agnostic, since + it only deals with register values, it works with any + frame. This is all in stark contrast to the old + FRAME_SAVED_PC which would try to directly handle all the + different ways that a PC could be unwound. */ + pc = gdbarch_unwind_pc (current_gdbarch, this_frame); + } + else if (this_frame->level < 0) + { + /* FIXME: cagney/2003-03-06: Old code and and a sentinel + frame. Do like was always done. Fetch the PC's value + direct from the global registers array (via read_pc). + This assumes that this frame belongs to the current + global register cache. The assumption is dangerous. */ + pc = read_pc (); + } + else if (DEPRECATED_FRAME_SAVED_PC_P ()) + { + /* FIXME: cagney/2003-03-06: Old code, but not a sentinel + frame. Do like was always done. Note that this method, + unlike unwind_pc(), tries to handle all the different + frame cases directly. It fails. */ + pc = DEPRECATED_FRAME_SAVED_PC (this_frame); + } + else + internal_error (__FILE__, __LINE__, "No gdbarch_unwind_pc method"); + this_frame->pc_unwind_cache = pc; + this_frame->pc_unwind_cache_p = 1; } - return frame->pc_unwind_cache; + return this_frame->pc_unwind_cache; +} + +static int +do_frame_unwind_register (void *src, int regnum, void *buf) +{ + frame_unwind_register (src, regnum, buf); + return 1; } void -frame_pop (struct frame_info *frame) +frame_pop (struct frame_info *this_frame) { - /* FIXME: cagney/2003-01-18: There is probably a chicken-egg problem - with passing in current_regcache. The pop function needs to be - written carefully so as to not overwrite registers whose [old] - values are needed to restore other registers. Instead, this code - should pass in a scratch cache and, as a second step, restore the - registers using that. */ - frame->unwind->pop (frame, &frame->unwind_cache, current_regcache); + struct regcache *scratch_regcache; + struct cleanup *cleanups; + + if (POP_FRAME_P ()) + { + /* A legacy architecture that has implemented a custom pop + function. All new architectures should instead be using the + generic code below. */ + POP_FRAME; + } + else + { + /* Make a copy of all the register values unwound from this + frame. Save them in a scratch buffer so that there isn't a + race betweening trying to extract the old values from the + current_regcache while, at the same time writing new values + into that same cache. */ + struct regcache *scratch = regcache_xmalloc (current_gdbarch); + struct cleanup *cleanups = make_cleanup_regcache_xfree (scratch); + regcache_save (scratch, do_frame_unwind_register, this_frame); + /* Now copy those saved registers into the current regcache. + Here, regcache_cpy() calls regcache_restore(). */ + regcache_cpy (current_regcache, scratch); + do_cleanups (cleanups); + } + /* We've made right mess of GDB's local state, just discard + everything. */ + target_store_registers (-1); flush_cached_frames (); } @@ -498,10 +566,15 @@ unwind_to_current_frame (struct ui_out *ui_out, void *args) struct frame_info * get_current_frame (void) { - if (!target_has_stack) - error ("No stack."); + /* First check, and report, the lack of registers. Having GDB + report "No stack!" or "No memory" when the target doesn't even + have registers is very confusing. Besides, "printcmd.exp" + explicitly checks that ``print $pc'' with no registers prints "No + registers". */ if (!target_has_registers) error ("No registers."); + if (!target_has_stack) + error ("No stack."); if (!target_has_memory) error ("No memory."); if (current_frame == NULL) @@ -667,13 +740,6 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, bufferp); } -static CORE_ADDR -frame_saved_regs_pc_unwind (struct frame_info *frame, void **cache) -{ - gdb_assert (FRAME_SAVED_PC_P ()); - return FRAME_SAVED_PC (frame); -} - static void frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache, struct frame_id *id) @@ -735,17 +801,7 @@ frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache, id->base = base; } -static void -frame_saved_regs_pop (struct frame_info *fi, void **cache, - struct regcache *regcache) -{ - gdb_assert (POP_FRAME_P ()); - POP_FRAME; -} - const struct frame_unwind trad_frame_unwinder = { - frame_saved_regs_pop, - frame_saved_regs_pc_unwind, frame_saved_regs_id_unwind, frame_saved_regs_register_unwind }; @@ -904,15 +960,15 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) return fi; } -/* Return the frame that FRAME calls (NULL if FRAME is the innermost - frame). Be careful to not fall off the bottom of the frame chain - and onto the sentinel frame. */ +/* Return the frame that THIS_FRAME calls (NULL if THIS_FRAME is the + innermost frame). Be careful to not fall off the bottom of the + frame chain and onto the sentinel frame. */ struct frame_info * -get_next_frame (struct frame_info *frame) +get_next_frame (struct frame_info *this_frame) { - if (frame->level > 0) - return frame->next; + if (this_frame->level > 0) + return this_frame->next; else return NULL; } @@ -949,7 +1005,7 @@ reinit_frame_cache (void) INIT_EXTRA_INFO, INIT_FRAME_PC and INIT_FRAME_PC_FIRST. */ static struct frame_info * -legacy_get_prev_frame (struct frame_info *next_frame) +legacy_get_prev_frame (struct frame_info *this_frame) { CORE_ADDR address = 0; struct frame_info *prev; @@ -957,7 +1013,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) /* This code only works on normal frames. A sentinel frame, where the level is -1, should never reach this code. */ - gdb_assert (next_frame->level >= 0); + gdb_assert (this_frame->level >= 0); /* On some machines it is possible to call a function without setting up a stack frame for it. On these machines, we @@ -966,14 +1022,14 @@ legacy_get_prev_frame (struct frame_info *next_frame) or isn't leafless. */ /* Still don't want to worry about this except on the innermost - frame. This macro will set FROMLEAF if NEXT_FRAME is a frameless + frame. This macro will set FROMLEAF if THIS_FRAME is a frameless function invocation. */ - if (next_frame->level == 0) + if (this_frame->level == 0) /* FIXME: 2002-11-09: Frameless functions can occure anywhere in the frame chain, not just the inner most frame! The generic, per-architecture, frame code should handle this and the below should simply be removed. */ - fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame); + fromleaf = FRAMELESS_FUNCTION_INVOCATION (this_frame); else fromleaf = 0; @@ -984,7 +1040,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) /* FIXME: 2002-11-09: There isn't any reason to special case this edge condition. Instead the per-architecture code should hande it locally. */ - address = get_frame_base (next_frame); + address = get_frame_base (this_frame); else { /* Two macros defined in tm.h specify the machine-dependent @@ -1003,9 +1059,9 @@ legacy_get_prev_frame (struct frame_info *next_frame) start go curfluy than have an abort called from main not show main. */ gdb_assert (FRAME_CHAIN_P ()); - address = FRAME_CHAIN (next_frame); + address = FRAME_CHAIN (this_frame); - if (!frame_chain_valid (address, next_frame)) + if (!frame_chain_valid (address, this_frame)) return 0; } if (address == 0) @@ -1015,10 +1071,10 @@ legacy_get_prev_frame (struct frame_info *next_frame) prev = frame_obstack_zalloc (sizeof (struct frame_info)); /* Link it in. */ - next_frame->prev = prev; - prev->next = next_frame; + this_frame->prev = prev; + prev->next = this_frame; prev->frame = address; - prev->level = next_frame->level + 1; + prev->level = this_frame->level + 1; /* FIXME: cagney/2002-11-18: Should be setting the frame's type here, before anything else, and not last. Various INIT functions are full of work-arounds for the frames type not being set @@ -1083,7 +1139,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) inner most and any other case. Since there is always a frame to unwind from, there is always - somewhere (NEXT_FRAME) to store all the info needed to construct + somewhere (THIS_FRAME) to store all the info needed to construct a new (previous) frame without having to first create it. This means that the convolution below - needing to carefully order a frame's initialization - isn't needed. @@ -1112,10 +1168,10 @@ legacy_get_prev_frame (struct frame_info *next_frame) 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) + if (prev->frame == this_frame->frame + && prev->pc == this_frame->pc) { - next_frame->prev = NULL; + this_frame->prev = NULL; obstack_free (&frame_cache_obstack, prev); return NULL; } @@ -1163,11 +1219,11 @@ legacy_get_prev_frame (struct frame_info *next_frame) } /* Return a structure containing various interesting information - about the frame that called NEXT_FRAME. Returns NULL + about the frame that called THIS_FRAME. Returns NULL if there is no such frame. */ struct frame_info * -get_prev_frame (struct frame_info *next_frame) +get_prev_frame (struct frame_info *this_frame) { struct frame_info *prev_frame; @@ -1189,7 +1245,7 @@ get_prev_frame (struct frame_info *next_frame) that a frame isn't possible, rather than checking that the target has state and then calling get_current_frame() and get_prev_frame(). This is a guess mind. */ - if (next_frame == NULL) + if (this_frame == NULL) { /* NOTE: cagney/2002-11-09: There was a code segment here that would error out when CURRENT_FRAME was NULL. The comment @@ -1202,18 +1258,18 @@ get_prev_frame (struct frame_info *next_frame) thing to do.'' Per the above, this code shouldn't even be called with a NULL - NEXT_FRAME. */ + THIS_FRAME. */ return current_frame; } /* There is always a frame. If this assertion fails, suspect that something should be calling get_selected_frame() or get_current_frame(). */ - gdb_assert (next_frame != NULL); + gdb_assert (this_frame != NULL); - if (next_frame->level >= 0 + if (this_frame->level >= 0 && !backtrace_below_main - && inside_main_func (get_frame_pc (next_frame))) + && inside_main_func (get_frame_pc (this_frame))) /* Don't unwind past main(), bug always unwind the sentinel frame. Note, this is done _before_ the frame has been marked as previously unwound. That way if the user later decides to @@ -1226,9 +1282,9 @@ get_prev_frame (struct frame_info *next_frame) } /* Only try to do the unwind once. */ - if (next_frame->prev_p) - return next_frame->prev; - next_frame->prev_p = 1; + if (this_frame->prev_p) + return this_frame->prev; + this_frame->prev_p = 1; /* If we're inside the entry file, it isn't valid. Don't apply this test to a dummy frame - dummy frame PC's typically land in the @@ -1241,8 +1297,8 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-01-10: If there is a way of disabling this test then it should probably be moved to before the ->prev_p test, above. */ - if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_file (get_frame_pc (next_frame))) + if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_file (get_frame_pc (this_frame))) { if (frame_debug) fprintf_unfiltered (gdb_stdlog, @@ -1258,8 +1314,8 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-02-25: Don't enable until someone has found hard evidence that this is needed. */ if (0 - && next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_func (get_frame_pc (next_frame))) + && this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_func (get_frame_pc (this_frame))) { if (frame_debug) fprintf_unfiltered (gdb_stdlog, @@ -1275,9 +1331,9 @@ get_prev_frame (struct frame_info *next_frame) || DEPRECATED_INIT_FRAME_PC_FIRST_P () || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () || FRAME_CHAIN_P ()) - && next_frame->level >= 0) + && this_frame->level >= 0) { - prev_frame = legacy_get_prev_frame (next_frame); + prev_frame = legacy_get_prev_frame (this_frame); if (frame_debug && prev_frame == NULL) fprintf_unfiltered (gdb_stdlog, "Outermost frame - legacy_get_prev_frame NULL.\n"); @@ -1295,7 +1351,7 @@ get_prev_frame (struct frame_info *next_frame) been here before' check above will stop repeated memory allocation calls. */ prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info); - prev_frame->level = next_frame->level + 1; + prev_frame->level = this_frame->level + 1; /* Try to unwind the PC. If that doesn't work, assume we've reached the oldest frame and simply return. Is there a better sentinal @@ -1305,16 +1361,16 @@ get_prev_frame (struct frame_info *next_frame) Note that the pc-unwind is intentionally performed before the frame chain. This is ok since, for old targets, both frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume - NEXT_FRAME's data structures have already been initialized (using + THIS_FRAME's data structures have already been initialized (using DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order doesn't matter. By unwinding the PC first, it becomes possible to, in the case of a dummy frame, avoid also unwinding the frame ID. This is because (well ignoring the PPC) a dummy frame can be located - using NEXT_FRAME's frame ID. */ + using THIS_FRAME's frame ID. */ - prev_frame->pc = frame_pc_unwind (next_frame); + prev_frame->pc = frame_pc_unwind (this_frame); if (prev_frame->pc == 0) { /* The allocated PREV_FRAME will be reclaimed when the frame @@ -1353,9 +1409,9 @@ get_prev_frame (struct frame_info *next_frame) frame_register_unwind to obtain the register values needed to determine the dummy frame's ID. */ prev_frame->id = gdbarch_unwind_dummy_id (current_gdbarch, - next_frame); + this_frame); } - else if (next_frame->level < 0) + else if (this_frame->level < 0) { /* We're unwinding a sentinel frame, the PC of which is pointing at a stack dummy. Fake up the dummy frame's ID @@ -1380,9 +1436,9 @@ get_prev_frame (struct frame_info *next_frame) case SIGTRAMP_FRAME: /* FIXME: cagney/2003-03-04: The below call isn't right. It should instead be doing something like "prev_frame -> unwind - -> id (next_frame, & prev_frame -> unwind_cache, & prev_frame + -> id (this_frame, & prev_frame -> unwind_cache, & prev_frame -> id)" but that requires more extensive (pending) changes. */ - next_frame->unwind->id (next_frame, &next_frame->unwind_cache, + this_frame->unwind->id (this_frame, &this_frame->unwind_cache, &prev_frame->id); /* Check that the unwound ID is valid. */ if (!frame_id_p (prev_frame->id)) @@ -1400,8 +1456,8 @@ get_prev_frame (struct frame_info *next_frame) sentinel frame's frame ID to a `sentinel'. Leave it until after the switch to storing the frame ID, instead of the frame base, in the frame object. */ - if (next_frame->level >= 0 - && frame_id_inner (prev_frame->id, get_frame_id (next_frame))) + if (this_frame->level >= 0 + && frame_id_inner (prev_frame->id, get_frame_id (this_frame))) error ("Unwound frame inner-to selected frame (corrupt stack?)"); /* Note that, due to frameless functions, the stronger test of the new frame being outer to the old frame can't be used - @@ -1418,8 +1474,8 @@ get_prev_frame (struct frame_info *next_frame) prev_frame->frame = prev_frame->id.base; /* Link it in. */ - next_frame->prev = prev_frame; - prev_frame->next = next_frame; + this_frame->prev = prev_frame; + prev_frame->next = this_frame; /* FIXME: cagney/2002-01-19: This call will go away. Instead of initializing extra info, all frames will use the frame_cache @@ -1551,12 +1607,18 @@ deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc) { /* See comment in "frame.h". */ frame->pc = pc; - /* While we're at it, update this frame's cached PC value, found in - the next frame. Oh, for the day when "struct frame_info" is - opaque and this hack on hack can go. */ - gdb_assert (frame->next != NULL); - frame->next->pc_unwind_cache = pc; - frame->next->pc_unwind_cache_p = 1; + /* NOTE: cagney/2003-03-11: Some architectures (e.g., Arm) are + maintaining a locally allocated frame object. Since such frame's + are not in the frame chain, it isn't possible to assume that the + frame has a next. Sigh. */ + if (frame->next != NULL) + { + /* While we're at it, update this frame's cached PC value, found + in the next frame. Oh for the day when "struct frame_info" + is opaque and this hack on hack can just go away. */ + frame->next->pc_unwind_cache = pc; + frame->next->pc_unwind_cache_p = 1; + } } void diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index d279707..b5bc335 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -36,7 +36,6 @@ static gdbarch_register_virtual_type_ftype frv_register_virtual_type; static gdbarch_register_byte_ftype frv_register_byte; static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; static gdbarch_frame_chain_ftype frv_frame_chain; -static gdbarch_frame_saved_pc_ftype frv_frame_saved_pc; static gdbarch_skip_prologue_ftype frv_skip_prologue; static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address; @@ -1081,7 +1080,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_saved_pc_after_call (gdbarch, frv_saved_pc_after_call); set_gdbarch_frame_chain (gdbarch, frv_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, frv_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, frv_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 636349c..6f75878 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -241,7 +241,8 @@ struct gdbarch gdbarch_frameless_function_invocation_ftype *frameless_function_invocation; gdbarch_frame_chain_ftype *frame_chain; gdbarch_frame_chain_valid_ftype *frame_chain_valid; - gdbarch_frame_saved_pc_ftype *frame_saved_pc; + gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc; + gdbarch_unwind_pc_ftype *unwind_pc; gdbarch_frame_args_address_ftype *frame_args_address; gdbarch_frame_locals_address_ftype *frame_locals_address; gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; @@ -433,6 +434,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -758,7 +760,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of frameless_function_invocation, invalid_p == 0 */ /* Skip verify of frame_chain, has predicate */ /* Skip verify of frame_chain_valid, has predicate */ - /* Skip verify of frame_saved_pc, has predicate */ + /* Skip verify of deprecated_frame_saved_pc, has predicate */ + /* Skip verify of unwind_pc, has predicate */ /* Skip verify of frame_args_address, invalid_p == 0 */ /* Skip verify of frame_locals_address, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) @@ -1190,6 +1193,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_frame_init_saved_regs /*DEPRECATED_FRAME_INIT_SAVED_REGS ()*/); #endif +#ifdef DEPRECATED_FRAME_SAVED_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC_P()", + XSTRING (DEPRECATED_FRAME_SAVED_PC_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC_P() = %d\n", + DEPRECATED_FRAME_SAVED_PC_P ()); +#endif +#ifdef DEPRECATED_FRAME_SAVED_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC(fi)", + XSTRING (DEPRECATED_FRAME_SAVED_PC (fi))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC = <0x%08lx>\n", + (long) current_gdbarch->deprecated_frame_saved_pc + /*DEPRECATED_FRAME_SAVED_PC ()*/); +#endif #ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1586,26 +1609,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->frame_num_args /*FRAME_NUM_ARGS ()*/); #endif -#ifdef FRAME_SAVED_PC_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_SAVED_PC_P()", - XSTRING (FRAME_SAVED_PC_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_SAVED_PC_P() = %d\n", - FRAME_SAVED_PC_P ()); -#endif -#ifdef FRAME_SAVED_PC - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_SAVED_PC(fi)", - XSTRING (FRAME_SAVED_PC (fi))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_SAVED_PC = <0x%08lx>\n", - (long) current_gdbarch->frame_saved_pc - /*FRAME_SAVED_PC ()*/); -#endif #ifdef FUNCTION_START_OFFSET fprintf_unfiltered (file, "gdbarch_dump: FUNCTION_START_OFFSET # %s\n", @@ -2578,6 +2581,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: unwind_dummy_id = 0x%08lx\n", (long) current_gdbarch->unwind_dummy_id); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n", + gdbarch_unwind_pc_p (current_gdbarch)); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: unwind_pc = 0x%08lx\n", + (long) current_gdbarch->unwind_pc); #ifdef USE_STRUCT_CONVENTION fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4820,29 +4831,55 @@ set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, } int -gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch) +gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_saved_pc != 0; +} + +CORE_ADDR +gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_frame_saved_pc == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_frame_saved_pc invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_saved_pc called\n"); + return gdbarch->deprecated_frame_saved_pc (fi); +} + +void +set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_saved_pc_ftype deprecated_frame_saved_pc) +{ + gdbarch->deprecated_frame_saved_pc = deprecated_frame_saved_pc; +} + +int +gdbarch_unwind_pc_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->frame_saved_pc != 0; + return gdbarch->unwind_pc != 0; } CORE_ADDR -gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) +gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { gdb_assert (gdbarch != NULL); - if (gdbarch->frame_saved_pc == 0) + if (gdbarch->unwind_pc == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_frame_saved_pc invalid"); + "gdbarch: gdbarch_unwind_pc invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n"); - return gdbarch->frame_saved_pc (fi); + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n"); + return gdbarch->unwind_pc (gdbarch, next_frame); } void -set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, - gdbarch_frame_saved_pc_ftype frame_saved_pc) +set_gdbarch_unwind_pc (struct gdbarch *gdbarch, + gdbarch_unwind_pc_ftype unwind_pc) { - gdbarch->frame_saved_pc = frame_saved_pc; + gdbarch->unwind_pc = unwind_pc; } CORE_ADDR diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 26424ef..acb1c33 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2228,43 +2228,53 @@ extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_fram #endif #endif -#if defined (FRAME_SAVED_PC) -/* Legacy for systems yet to multi-arch FRAME_SAVED_PC */ -#if !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (1) +/* DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please + note, per UNWIND_PC's doco, that while the two have similar + interfaces they have very different underlying implementations. */ + +#if defined (DEPRECATED_FRAME_SAVED_PC) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_SAVED_PC */ +#if !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (0) #endif -extern int gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC_P) -#error "Non multi-arch definition of FRAME_SAVED_PC" +extern int gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (gdbarch_frame_saved_pc_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (gdbarch_deprecated_frame_saved_pc_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC) -#define FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "FRAME_SAVED_PC"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC) +#define DEPRECATED_FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_SAVED_PC"), 0) #endif -typedef CORE_ADDR (gdbarch_frame_saved_pc_ftype) (struct frame_info *fi); -extern CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); -extern void set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC) -#error "Non multi-arch definition of FRAME_SAVED_PC" +typedef CORE_ADDR (gdbarch_deprecated_frame_saved_pc_ftype) (struct frame_info *fi); +extern CORE_ADDR gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC) -#define FRAME_SAVED_PC(fi) (gdbarch_frame_saved_pc (current_gdbarch, fi)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC) +#define DEPRECATED_FRAME_SAVED_PC(fi) (gdbarch_deprecated_frame_saved_pc (current_gdbarch, fi)) #endif #endif +extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc); + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (FRAME_ARGS_ADDRESS) #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi)) @@ -2419,6 +2429,9 @@ extern void set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_re #endif #endif +/* FIXME: kettenis/2003-03-08: This should be replaced by a function + parametrized with (at least) the regcache. */ + #if defined (SAVE_DUMMY_FRAME_TOS) /* Legacy for systems yet to multi-arch SAVE_DUMMY_FRAME_TOS */ #if !defined (SAVE_DUMMY_FRAME_TOS_P) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index ed8a9e7..2cf9a32 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -591,7 +591,11 @@ v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 F:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 F:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0 -F:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 +# DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please +# note, per UNWIND_PC's doco, that while the two have similar +# interfaces they have very different underlying implementations. +F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi::0:0 +M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame: f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:frame::0:0 @@ -601,6 +605,8 @@ F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0 M:::CORE_ADDR:frame_align:CORE_ADDR address:address v:2:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0::: F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0 +# FIXME: kettenis/2003-03-08: This should be replaced by a function +# parametrized with (at least) the regcache. F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0 M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0 v:2:PARM_BOUNDARY:int:parm_boundary diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index b90f6ed..8349322 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1122,7 +1122,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info); set_gdbarch_frame_chain (gdbarch, h8300_frame_chain); set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue); set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 9ba5ef9..8385596 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -875,7 +875,7 @@ hppa_saved_pc_after_call (struct frame_info *frame) the stub will return to out of the stack. */ u = find_unwind_entry (pc); if (u && u->stub_unwind.stub_type != 0) - return FRAME_SAVED_PC (frame); + return DEPRECATED_FRAME_SAVED_PC (frame); else return pc; } @@ -1075,7 +1075,7 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame) { /* Find the framesize of *this* frame without peeking at the PC in the current frame structure (it isn't set yet). */ - framesize = find_proc_framesize (FRAME_SAVED_PC (get_next_frame (frame))); + framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (get_next_frame (frame))); /* Now adjust our base frame accordingly. If we have a frame pointer use it, else subtract the size of this frame from the current @@ -1185,7 +1185,7 @@ hppa_frame_chain (struct frame_info *frame) /* Get frame sizes for the current frame and the frame of the caller. */ my_framesize = find_proc_framesize (frame->pc); - caller_pc = FRAME_SAVED_PC (frame); + caller_pc = DEPRECATED_FRAME_SAVED_PC (frame); /* If we can't determine the caller's PC, then it's not likely we can really determine anything meaningful about its frame. We'll consider @@ -1193,7 +1193,7 @@ hppa_frame_chain (struct frame_info *frame) if (caller_pc == (CORE_ADDR) 0) return (CORE_ADDR) 0; - caller_framesize = find_proc_framesize (FRAME_SAVED_PC (frame)); + caller_framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (frame)); /* If caller does not have a frame pointer, then its frame can be found at current_frame - caller_framesize. */ @@ -1316,7 +1316,7 @@ hppa_frame_chain (struct frame_info *frame) || (saved_regs.regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { - u = find_unwind_entry (FRAME_SAVED_PC (frame)); + u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { return read_memory_integer (saved_regs.regs[FP_REGNUM], @@ -1351,7 +1351,7 @@ hppa_frame_chain (struct frame_info *frame) || (saved_regs.regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { - u = find_unwind_entry (FRAME_SAVED_PC (frame)); + u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { return read_memory_integer (saved_regs.regs[FP_REGNUM], @@ -1392,7 +1392,7 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) indistinguishable (as nearly as I can tell) from the symbol for a function which is (legitimately, since it is in the user's namespace) named Ltext_end, so we can't just ignore it. */ - msym_us = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe)); + msym_us = lookup_minimal_symbol_by_pc (DEPRECATED_FRAME_SAVED_PC (thisframe)); msym_start = lookup_minimal_symbol ("_start", NULL, NULL); if (msym_us && msym_start @@ -5011,7 +5011,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_chain_valid (gdbarch, hppa_frame_chain_valid); set_gdbarch_frameless_function_invocation (gdbarch, hppa_frameless_function_invocation); - set_gdbarch_frame_saved_pc (gdbarch, hppa_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, hppa_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address); set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args); diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c index b9ad2ff..e25242c 100644 --- a/gdb/i386-interix-tdep.c +++ b/gdb/i386-interix-tdep.c @@ -334,7 +334,7 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_deprecated_init_extra_frame_info (gdbarch, i386_interix_back_one_frame); set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); set_gdbarch_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid); - set_gdbarch_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc); set_gdbarch_name_of_malloc (gdbarch, "_malloc"); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 018f073..4b479cc 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1617,7 +1617,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, i386_frameless_function_invocation); set_gdbarch_frame_chain (gdbarch, i386_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_frame_saved_pc); set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, i386_frame_num_args); set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 36036f2..62cff27 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -92,7 +92,6 @@ static gdbarch_register_virtual_type_ftype ia64_register_virtual_type; static gdbarch_register_byte_ftype ia64_register_byte; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; static gdbarch_frame_chain_ftype ia64_frame_chain; -static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; static gdbarch_get_saved_register_ftype ia64_get_saved_register; static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value; @@ -2008,7 +2007,7 @@ ia64_pop_frame_regular (struct frame_info *frame) } write_register (sp_regnum, FRAME_CHAIN (frame)); - write_pc (FRAME_SAVED_PC (frame)); + write_pc (DEPRECATED_FRAME_SAVED_PC (frame)); cfm = read_register (IA64_CFM_REGNUM); @@ -2197,7 +2196,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call); set_gdbarch_frame_chain (gdbarch, ia64_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ia64_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ia64_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs); set_gdbarch_get_saved_register (gdbarch, ia64_get_saved_register); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 6af823e..d1173ba 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -895,7 +895,7 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); m68hc11_frame_init_saved_regs (fi); @@ -1404,7 +1404,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_chain (gdbarch, m68hc11_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address); set_gdbarch_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 6008a62..1e09cf8 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -359,7 +359,7 @@ int isi_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -381,7 +381,7 @@ int delta68_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -403,7 +403,7 @@ int news_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -1011,7 +1011,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_return_value (gdbarch, m68k_store_return_value); set_gdbarch_frame_chain (gdbarch, m68k_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68k_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs); set_gdbarch_frameless_function_invocation (gdbarch, m68k_frameless_function_invocation); diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index e5b6434..a0d8693 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -671,7 +671,7 @@ mcore_frame_chain (struct frame_info * fi) If our caller does not have a frame pointer, then his frame base is <our base> + -<caller's frame size>. */ - dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi)); + dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi)); if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP) { @@ -803,7 +803,7 @@ mcore_pop_frame (void) else { /* Write out the PC we saved. */ - write_register (PC_REGNUM, FRAME_SAVED_PC (fi)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi)); /* Restore any saved registers. */ for (rn = 0; rn < NUM_REGS; rn++) @@ -1047,7 +1047,7 @@ void mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (fi && get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_saved_regs_zalloc (fi); @@ -1139,7 +1139,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info); set_gdbarch_frame_chain (gdbarch, mcore_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs); - set_gdbarch_frame_saved_pc (gdbarch, mcore_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mcore_frame_saved_pc); set_gdbarch_deprecated_store_return_value (gdbarch, mcore_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mcore_extract_return_value); diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index a103802..7290ef9 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * mi-out.c: Update copyright. + (mi_out_data): Define typedef. Use instead of ui_out_data. + 2003-03-01 Andrew Cagney <cagney@redhat.com> * mi-main.c (get_register): Use register_type instead of diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index f7156ca..2aac528 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -1,6 +1,6 @@ /* MI Command Set - output generating routines. - Copyright 2000, 2002 Free Software Foundation, Inc. + Copyright 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -32,6 +32,7 @@ struct ui_out_data int mi_version; struct ui_file *buffer; }; +typedef struct ui_out_data mi_out_data; /* These are the MI output functions */ @@ -107,7 +108,7 @@ mi_table_begin (struct ui_out *uiout, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); mi_open (uiout, tblid, ui_out_type_tuple); mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/, "nr_rows", nr_rows); @@ -121,7 +122,7 @@ mi_table_begin (struct ui_out *uiout, void mi_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* close the table header line if there were any headers */ @@ -134,7 +135,7 @@ mi_table_body (struct ui_out *uiout) void mi_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); data->suppress_output = 0; mi_close (uiout, ui_out_type_list); /* body */ mi_close (uiout, ui_out_type_tuple); @@ -147,7 +148,7 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_open (uiout, NULL, ui_out_type_tuple); @@ -166,7 +167,7 @@ mi_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_open (uiout, id, type); @@ -179,7 +180,7 @@ mi_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_close (uiout, type); @@ -192,7 +193,7 @@ mi_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname, int value) { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -206,7 +207,7 @@ void mi_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -223,7 +224,7 @@ mi_field_string (struct ui_out *uiout, const char *fldname, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); @@ -244,7 +245,7 @@ mi_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); @@ -282,7 +283,7 @@ mi_wrap_hint (struct ui_out *uiout, char *identstring) void mi_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); gdb_flush (data->buffer); } @@ -296,7 +297,7 @@ static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); va_list args; field_separator (uiout); @@ -318,7 +319,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, static void field_separator (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_field_separator) data->suppress_field_separator = 0; else @@ -330,7 +331,7 @@ mi_open (struct ui_out *uiout, const char *name, enum ui_out_type type) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); field_separator (uiout); data->suppress_field_separator = 1; if (name) @@ -352,7 +353,7 @@ static void mi_close (struct ui_out *uiout, enum ui_out_type type) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); switch (type) { case ui_out_type_tuple: @@ -372,7 +373,7 @@ mi_close (struct ui_out *uiout, void mi_out_buffered (struct ui_out *uiout, char *string) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); fprintf_unfiltered (data->buffer, "%s", string); } @@ -381,7 +382,7 @@ mi_out_buffered (struct ui_out *uiout, char *string) void mi_out_rewind (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); ui_file_rewind (data->buffer); } @@ -397,7 +398,7 @@ void mi_out_put (struct ui_out *uiout, struct ui_file *stream) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); ui_file_put (data->buffer, do_write, stream); ui_file_rewind (data->buffer); } @@ -407,7 +408,7 @@ mi_out_put (struct ui_out *uiout, int mi_version (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); return data->mi_version; } @@ -417,7 +418,7 @@ struct ui_out * mi_out_new (int mi_version) { int flags = 0; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + mi_out_data *data = XMALLOC (mi_out_data); data->suppress_field_separator = 0; data->suppress_output = 0; data->mi_version = mi_version; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 5c2ca46..d8569ff 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -113,7 +113,8 @@ add_minsym_to_hash_table (struct minimal_symbol *sym, { if (sym->hash_next == NULL) { - unsigned int hash = msymbol_hash (DEPRECATED_SYMBOL_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; + unsigned int hash + = msymbol_hash (SYMBOL_LINKAGE_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; sym->hash_next = table[hash]; table[hash] = sym; } @@ -288,7 +289,7 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile, msymbol != NULL && found_symbol == NULL; msymbol = msymbol->hash_next) { - if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) && + if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 && (MSYMBOL_TYPE (msymbol) == mst_text || MSYMBOL_TYPE (msymbol) == mst_file_text)) { @@ -364,7 +365,7 @@ lookup_minimal_symbol_solib_trampoline (register const char *name, msymbol != NULL && found_symbol == NULL; msymbol = msymbol->hash_next) { - if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) && + if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 && MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) return msymbol; } @@ -659,8 +660,8 @@ compare_minimal_symbols (const void *fn1p, const void *fn2p) else /* addrs are equal: sort by name */ { - char *name1 = DEPRECATED_SYMBOL_NAME (fn1); - char *name2 = DEPRECATED_SYMBOL_NAME (fn2); + char *name1 = SYMBOL_LINKAGE_NAME (fn1); + char *name2 = SYMBOL_LINKAGE_NAME (fn2); if (name1 && name2) /* both have names */ return strcmp (name1, name2); @@ -752,7 +753,8 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount, { if (SYMBOL_VALUE_ADDRESS (copyfrom) == SYMBOL_VALUE_ADDRESS ((copyfrom + 1)) && - (STREQ (DEPRECATED_SYMBOL_NAME (copyfrom), DEPRECATED_SYMBOL_NAME ((copyfrom + 1))))) + (STREQ (SYMBOL_LINKAGE_NAME (copyfrom), + SYMBOL_LINKAGE_NAME ((copyfrom + 1))))) { if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown) { @@ -867,9 +869,9 @@ install_minimal_symbols (struct objfile *objfile) for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++) { msymbols[mcount] = bunch->contents[bindex]; - if (DEPRECATED_SYMBOL_NAME (&msymbols[mcount])[0] == leading_char) + if (SYMBOL_LINKAGE_NAME (&msymbols[mcount])[0] == leading_char) { - DEPRECATED_SYMBOL_NAME (&msymbols[mcount])++; + SYMBOL_LINKAGE_NAME (&msymbols[mcount])++; } } msym_bunch_index = BUNCH_SIZE; @@ -898,7 +900,7 @@ install_minimal_symbols (struct objfile *objfile) symbol count does *not* include this null symbol, which is why it is indexed by mcount and not mcount-1. */ - DEPRECATED_SYMBOL_NAME (&msymbols[mcount]) = NULL; + SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL; SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0; MSYMBOL_INFO (&msymbols[mcount]) = NULL; MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown; @@ -918,7 +920,7 @@ install_minimal_symbols (struct objfile *objfile) for (i = 0; i < mcount; i++) { - const char *name = DEPRECATED_SYMBOL_NAME (&objfile->msymbols[i]); + const char *name = SYMBOL_LINKAGE_NAME (&objfile->msymbols[i]); if (name[0] == '_' && name[1] == 'Z') { set_cp_abi_as_auto_default ("gnu-v3"); @@ -981,7 +983,8 @@ find_solib_trampoline_target (CORE_ADDR pc) ALL_MSYMBOLS (objfile, msymbol) { if (MSYMBOL_TYPE (msymbol) == mst_text - && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (tsymbol))) + && STREQ (SYMBOL_LINKAGE_NAME (msymbol), + SYMBOL_LINKAGE_NAME (tsymbol))) return SYMBOL_VALUE_ADDRESS (msymbol); } } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7ade6a2..ae28790 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1694,7 +1694,7 @@ mips_init_frame_pc_first (int fromleaf, struct frame_info *prev) pc = ((fromleaf) ? SAVED_PC_AFTER_CALL (get_next_frame (prev)) : get_next_frame (prev) - ? FRAME_SAVED_PC (get_next_frame (prev)) + ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)) : read_pc ()); tmp = SKIP_TRAMPOLINE_CODE (pc); return tmp ? tmp : pc; @@ -2432,7 +2432,7 @@ mips_frame_chain (struct frame_info *frame) { mips_extra_func_info_t proc_desc; CORE_ADDR tmp; - CORE_ADDR saved_pc = FRAME_SAVED_PC (frame); + CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); if (saved_pc == 0 || inside_entry_file (saved_pc)) return 0; @@ -3844,7 +3844,7 @@ mips_pop_frame (void) return; } - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); if (get_frame_saved_regs (frame) == NULL) DEPRECATED_FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < NUM_REGS; regnum++) @@ -4150,7 +4150,7 @@ do_fp_register_row (int regnum) { /* Eight byte registers: print each one as float AND as double. */ mips_read_fp_register_single (regnum, raw_buffer); - flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1); + flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1); mips_read_fp_register_double (regnum, raw_buffer); doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3); @@ -5546,23 +5546,37 @@ mips_saved_pc_after_call (struct frame_info *frame) static int mips_stab_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 38 && num < 70) return num + FP0_REGNUM - 38; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } -/* Convert a ecoff register number to a gdb REGNUM */ + +/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */ static int -mips_ecoff_reg_to_regnum (int num) +mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 32 && num < 64) return num + FP0_REGNUM - 32; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } + /* Convert an integer into an address. By first converting the value into a pointer and then extracting it signed, the address is guarenteed to be correctly sign extended. */ @@ -5979,7 +5993,9 @@ mips_gdbarch_init (struct gdbarch_info info, /* Map debug register numbers onto internal register numbers. */ set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); - set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum); + set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); /* Initialize a frame */ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs); @@ -6011,7 +6027,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_chain (gdbarch, mips_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_frame_saved_pc (gdbarch, mips_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mips_frame_saved_pc); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_args_skip (gdbarch, 0); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index bcd96ad..7996b1e 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -688,7 +688,7 @@ mn10300_frame_chain (struct frame_info *fi) /* The easiest way to get that info is to analyze our caller's frame. So we set up a dummy frame and call mn10300_analyze_prologue to find stuff for us. */ - dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi)); + dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi)); if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP) { @@ -728,7 +728,7 @@ mn10300_pop_frame_regular (struct frame_info *frame) { int regnum; - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ for (regnum = 0; regnum < NUM_REGS; regnum++) @@ -900,7 +900,7 @@ static void mn10300_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_saved_regs_zalloc (fi); frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); @@ -1171,7 +1171,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs); set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, mn10300_extract_struct_value_address); diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 36ccadc..20696c7 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -191,7 +191,7 @@ umax_frame_num_args (struct frame_info *fi) { pc = ((enter_addr == 1) ? SAVED_PC_AFTER_CALL (fi) - : FRAME_SAVED_PC (fi)); + : DEPRECATED_FRAME_SAVED_PC (fi)); insn = read_memory_integer (pc, 2); addr_mode = (insn >> 11) & 0x1f; insn = insn & 0x7ff; @@ -573,7 +573,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) generic_frameless_function_invocation_not); set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address); diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c index bf5250f..97971d2 100644 --- a/gdb/ns32knbsd-nat.c +++ b/gdb/ns32knbsd-nat.c @@ -295,7 +295,7 @@ frame_num_args (struct frame_info *fi) enter_addr = ns32k_get_enter_addr (fi->pc); if (enter_addr = 0) return (-1); - argp = enter_addr == 1 ? SAVED_PC_AFTER_CALL (fi) : FRAME_SAVED_PC (fi); + argp = enter_addr == 1 ? SAVED_PC_AFTER_CALL (fi) : DEPRECATED_FRAME_SAVED_PC (fi); for (i = 0; i < 16; i++) { /* diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index f02581b..3ba7c2e 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -730,7 +730,7 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_frameless_function_invocation (gdbarch, ppc_linux_frameless_function_invocation); set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ppc_linux_frame_init_saved_regs); diff --git a/gdb/regcache.c b/gdb/regcache.c index 3f2be7b..c669017 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -389,59 +389,79 @@ register_buffer (struct regcache *regcache, int regnum) } void -regcache_save (struct regcache *dst, struct regcache *src) +regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read, + void *src) { struct gdbarch *gdbarch = dst->descr->gdbarch; + void *buf = alloca (max_register_size (gdbarch)); int regnum; - /* The SRC and DST register caches had better belong to the same - architecture. */ - gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); /* The DST should be `read-only', if it wasn't then the save would - end up trying to write the register values out through to the + end up trying to write the register values back out to the target. */ - gdb_assert (!src->readonly_p); gdb_assert (dst->readonly_p); /* Clear the dest. */ memset (dst->registers, 0, dst->descr->sizeof_cooked_registers); memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p); /* Copy over any registers (identified by their membership in the - save_reggroup) and mark them as valid. The full [0 - .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some - architectures need to save/restore `cooked' registers that live - in memory. */ + save_reggroup) and mark them as valid. The full [0 .. NUM_REGS + + NUM_PSEUDO_REGS) range is checked since some architectures need + to save/restore `cooked' registers that live in memory. */ for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++) { if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) { - regcache_cooked_read (src, regnum, register_buffer (dst, regnum)); - dst->register_valid_p[regnum] = 1; + int valid = cooked_read (src, regnum, buf); + if (valid) + { + memcpy (register_buffer (dst, regnum), buf, + register_size (gdbarch, regnum)); + dst->register_valid_p[regnum] = 1; + } } } } void -regcache_restore (struct regcache *dst, struct regcache *src) +regcache_restore (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src) { struct gdbarch *gdbarch = dst->descr->gdbarch; + void *buf = alloca (max_register_size (gdbarch)); int regnum; - gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); + /* The dst had better not be read-only. If it is, the `restore' + doesn't make much sense. */ gdb_assert (!dst->readonly_p); - gdb_assert (src->readonly_p); /* Copy over any registers, being careful to only restore those that - were both saved and need to be restored. The full [0 - .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some - architectures need to save/restore `cooked' registers that live - in memory. */ - for (regnum = 0; regnum < src->descr->nr_cooked_registers; regnum++) + were both saved and need to be restored. The full [0 .. NUM_REGS + + NUM_PSEUDO_REGS) range is checked since some architectures need + to save/restore `cooked' registers that live in memory. */ + for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++) { - if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup) - && src->register_valid_p[regnum]) + if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup)) { - regcache_cooked_write (dst, regnum, register_buffer (src, regnum)); + int valid = cooked_read (src, regnum, buf); + if (valid) + regcache_cooked_write (dst, regnum, buf); } } } +static int +do_cooked_read (void *src, int regnum, void *buf) +{ + struct regcache *regcache = src; + if (!regcache_valid_p (regcache, regnum) + && regcache->readonly_p) + /* Don't even think about fetching a register from a read-only + cache when the register isn't yet valid. There isn't a target + from which the register value can be fetched. */ + return 0; + regcache_cooked_read (regcache, regnum, buf); + return 1; +} + + void regcache_cpy (struct regcache *dst, struct regcache *src) { @@ -452,9 +472,9 @@ regcache_cpy (struct regcache *dst, struct regcache *src) gdb_assert (src != dst); gdb_assert (src->readonly_p || dst->readonly_p); if (!src->readonly_p) - regcache_save (dst, src); + regcache_save (dst, do_cooked_read, src); else if (!dst->readonly_p) - regcache_restore (dst, src); + regcache_restore (dst, do_cooked_read, src); else regcache_cpy_no_passthrough (dst, src); } @@ -864,7 +884,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_signed_integer (buf, @@ -877,13 +897,37 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_unsigned_integer (buf, regcache->descr->sizeof_register[regnum]); } +void +regcache_cooked_write_signed (struct regcache *regcache, int regnum, + LONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + +void +regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, + ULONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + /* Write register REGNUM at MYADDR to the target. MYADDR points at REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */ diff --git a/gdb/regcache.h b/gdb/regcache.h index ee10505..bc9757e 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -75,6 +75,10 @@ extern void regcache_cooked_read_signed (struct regcache *regcache, int regnum, LONGEST *val); extern void regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, ULONGEST *val); +extern void regcache_cooked_write_signed (struct regcache *regcache, + int regnum, LONGEST val); +extern void regcache_cooked_write_unsigned (struct regcache *regcache, + int regnum, ULONGEST val); /* Partial transfer of a cooked register. These perform read, modify, write style operations. */ @@ -155,15 +159,19 @@ extern int max_register_size (struct gdbarch *gdbarch); extern int register_size (struct gdbarch *gdbarch, int regnum); -/* Save/restore a register cache. The registers saved/restored is - determined by the save_reggroup and restore_reggroup (although you - can't restore a register that wasn't saved as well :-). You can - only save to a read-only cache (default from regcache_xmalloc()) - from a live cache and you can only restore from a read-only cache - to a live cache. */ +/* Save/restore a register cache. The set of registers saved / + restored into the DST regcache determined by the save_reggroup / + restore_reggroup respectively. COOKED_READ returns zero iff the + register's value can't be returned. */ -extern void regcache_save (struct regcache *dst, struct regcache *src); -extern void regcache_restore (struct regcache *dst, struct regcache *src); +typedef int (regcache_cooked_read_ftype) (void *src, int regnum, void *buf); + +extern void regcache_save (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src); +extern void regcache_restore (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src); /* Copy/duplicate the contents of a register cache. By default, the operation is pass-through. Writes to DST and reads from SRC will diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ac33578..72079ce 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2938,7 +2938,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, rs6000_frameless_function_invocation); set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 9ad34c8..f26ea13 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1221,7 +1221,7 @@ s390_pop_frame_regular (struct frame_info *frame) { int regnum; - write_register (S390_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (S390_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ if (get_frame_saved_regs (frame)) @@ -1839,7 +1839,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, s390_frameless_function_invocation); /* Return saved PC from a frame */ - set_gdbarch_frame_saved_pc (gdbarch, s390_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, s390_frame_saved_pc); /* FRAME_CHAIN takes a frame's nominal address and produces the frame's chain-pointer. */ set_gdbarch_frame_chain (gdbarch, s390_frame_chain); diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index fe11d8a..961e030 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -70,17 +70,6 @@ sentinel_frame_register_unwind (struct frame_info *frame, } } -CORE_ADDR -sentinel_frame_pc_unwind (struct frame_info *frame, - void **cache) -{ - /* FIXME: cagney/2003-01-08: This should be using a per-architecture - method that doesn't suffer from DECR_PC_AFTER_BREAK problems. - Such a method would take unwind_cache, regcache and stop reason - parameters. */ - return read_pc (); -} - void sentinel_frame_id_unwind (struct frame_info *frame, void **cache, @@ -94,18 +83,8 @@ sentinel_frame_id_unwind (struct frame_info *frame, id->pc = read_pc (); } -static void -sentinel_frame_pop (struct frame_info *frame, - void **cache, - struct regcache *regcache) -{ - internal_error (__FILE__, __LINE__, "Function sentinal_frame_pop called"); -} - const struct frame_unwind sentinel_frame_unwinder = { - sentinel_frame_pop, - sentinel_frame_pc_unwind, sentinel_frame_id_unwind, sentinel_frame_register_unwind }; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 91f3f62..081c063 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1758,7 +1758,7 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) @@ -1790,7 +1790,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) @@ -4674,7 +4674,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc); set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_believe_pcc_promotion (gdbarch, 1); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index b22474a..be8197f 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -547,7 +547,7 @@ setup_arbitrary_frame (int argc, CORE_ADDR *argv) "create_new_frame returned invalid frame"); get_frame_extra_info (frame)->bottom = argv[1]; - deprecated_update_frame_pc_hack (frame, FRAME_SAVED_PC (frame)); + deprecated_update_frame_pc_hack (frame, DEPRECATED_FRAME_SAVED_PC (frame)); return frame; } @@ -3147,7 +3147,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_chain (gdbarch, sparc_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - set_gdbarch_frame_saved_pc (gdbarch, sparc_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, sparc_frame_saved_pc); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index c3e659d..a9f918a 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,8 @@ +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * tui-out.c: Update copyright. + (tui_out_data): Define typedef. Use instead of ui_out_data. + 2003-02-14 Andrew Cagney <ac131313@redhat.com> * tui.c (tui_enable, tui_disable): Don't modify tui_version. diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 71ce5e0..1ec6d86 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -1,6 +1,7 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Inc. Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -35,6 +36,7 @@ struct ui_out_data int line; int start_of_line; }; +struct ui_out_data tui_out_data; /* These are the CLI output functions */ @@ -112,7 +114,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (nr_rows == 0) data->suppress_output = 1; else @@ -126,7 +128,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols, void tui_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* first, close the table header line */ @@ -138,7 +140,7 @@ tui_table_body (struct ui_out *uiout) void tui_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); data->suppress_output = 0; } @@ -149,7 +151,7 @@ tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; tui_field_string (uiout, 0, width, alignment, 0, colhdr); @@ -163,7 +165,7 @@ tui_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -175,7 +177,7 @@ tui_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -189,7 +191,7 @@ tui_field_int (struct ui_out *uiout, int fldno, int width, { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -212,7 +214,7 @@ tui_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; tui_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -232,7 +234,7 @@ tui_field_string (struct ui_out *uiout, int before = 0; int after = 0; - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -290,7 +292,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -304,7 +306,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno, void tui_spaces (struct ui_out *uiout, int numspaces) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; print_spaces_filtered (numspaces, data->stream); @@ -313,7 +315,7 @@ tui_spaces (struct ui_out *uiout, int numspaces) void tui_text (struct ui_out *uiout, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; data->start_of_line ++; @@ -335,7 +337,7 @@ void tui_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if (ui_out_get_verblvl (uiout) >= verbosity) @@ -345,7 +347,7 @@ tui_message (struct ui_out *uiout, int verbosity, void tui_wrap_hint (struct ui_out *uiout, char *identstring) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; wrap_here (identstring); @@ -354,7 +356,7 @@ tui_wrap_hint (struct ui_out *uiout, char *identstring) void tui_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); gdb_flush (data->stream); } @@ -369,7 +371,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, const char *fldname, const char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); va_list args; va_start (args, format); @@ -383,7 +385,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, static void field_separator (void) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); fputc_filtered (' ', data->stream); } @@ -394,7 +396,7 @@ tui_out_new (struct ui_file *stream) { int flags = 0; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + tui_out_data *data = XMALLOC (tui_out_data); data->stream = stream; data->suppress_output = 0; data->line = -1; diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 0894a8f..94fcb81 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -826,7 +826,7 @@ v850_frame_chain (struct frame_info *fi) CORE_ADDR callers_pc, fp; /* First, find out who called us */ - callers_pc = FRAME_SAVED_PC (fi); + callers_pc = DEPRECATED_FRAME_SAVED_PC (fi); /* If caller is a call-dummy, then our FP bears no relation to his FP! */ fp = v850_find_callers_reg (fi, E_FP_RAW_REGNUM); if (DEPRECATED_PC_IN_CALL_DUMMY (callers_pc, fp, fp)) @@ -892,7 +892,7 @@ v850_pop_frame (void) generic_pop_dummy_frame (); else { - write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (E_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); for (regnum = 0; regnum < E_NUM_REGS; regnum++) if (get_frame_saved_regs (frame)[regnum] != 0) @@ -1165,7 +1165,7 @@ v850_init_extra_frame_info (int fromleaf, struct frame_info *fi) struct prologue_info pi; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); v850_frame_init_saved_regs (fi); } @@ -1246,7 +1246,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_init_extra_frame_info (gdbarch, v850_init_extra_frame_info); set_gdbarch_frame_chain (gdbarch, v850_frame_chain); set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, v850_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue); /* diff --git a/gdb/valarith.c b/gdb/valarith.c index dcfd92c..ed0fe05 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -276,6 +276,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound else VALUE_LVAL (v) = VALUE_LVAL (array); VALUE_ADDRESS (v) = VALUE_ADDRESS (array); + VALUE_REGNO (v) = VALUE_REGNO (array); VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs; return v; } diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index ab968b6..4b1851e 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -43,7 +43,6 @@ static gdbarch_skip_prologue_ftype vax_skip_prologue; static gdbarch_saved_pc_after_call_ftype vax_saved_pc_after_call; static gdbarch_frame_num_args_ftype vax_frame_num_args; static gdbarch_frame_chain_ftype vax_frame_chain; -static gdbarch_frame_saved_pc_ftype vax_frame_saved_pc; static gdbarch_frame_args_address_ftype vax_frame_args_address; static gdbarch_frame_locals_address_ftype vax_frame_locals_address; @@ -375,7 +374,7 @@ vax_skip_prologue (CORE_ADDR pc) static CORE_ADDR vax_saved_pc_after_call (struct frame_info *frame) { - return (FRAME_SAVED_PC(frame)); + return (DEPRECATED_FRAME_SAVED_PC(frame)); } /* Print the vax instruction at address MEMADDR in debugged memory, @@ -650,7 +649,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) generic_frameless_function_invocation_not); set_gdbarch_frame_chain (gdbarch, vax_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, vax_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, vax_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address); diff --git a/gdb/version.in b/gdb/version.in index 099f772..2f39186 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-03-08-cvs +2003-03-13-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 5fece43..85057f7 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1030,7 +1030,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) x86_64_frameless_function_invocation); /* FIXME: kettenis/20021026: These two are GNU/Linux-specific and should be moved elsewhere. */ - set_gdbarch_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc); + set_gdbarch_deprecated_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. */ diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index b0b8191..f39ea0d 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -31,7 +31,7 @@ extern int x86_64_num_gregs; int x86_64_register_number (const char *name); const char *x86_64_register_name (int reg_nr); -gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; +gdbarch_deprecated_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; 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); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 2bbd402..e44b64d 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -354,7 +354,7 @@ xstormy16_pop_frame (void) xstormy16_reg_size)); } /* Restore the PC */ - write_register (PC_REGNUM, FRAME_SAVED_PC (fi)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi)); flush_cached_frames (); } return; @@ -836,7 +836,7 @@ xstormy16_frame_chain (struct frame_info *fi) static int xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) { - return chain < 0x8000 && FRAME_SAVED_PC (thisframe) >= 0x8000 && + return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 && (get_frame_extra_info (thisframe)->frameless_p || get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain); } @@ -1060,7 +1060,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_chain (gdbarch, xstormy16_frame_chain); set_gdbarch_get_saved_register (gdbarch, xstormy16_get_saved_register); set_gdbarch_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue); set_gdbarch_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid); |