This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/rfc] Delete write_fp() and friends


Andrew Cagney wrote:
> 
> Well, almost, I left dwarf2cfi.c's write_fp() as is - someone might be
> interested in the code.
> 
> Assuming no issues are raised, and my builds come back clean, I'll
> commit it next week.
> 
> enjoy,
> Andrew

So what should calls to write_fp be replaced with?


>   ------------------------------------------------------------------------
> 2002-03-27  Andrew Cagney  <ac131313@redhat.com>
> 
>         * h8500-tdep.c (h8500_write_fp): Delete function.
>         * dwarf2cfi.c (cfi_write_fp): Document as not used.
>         * mips-tdep.c (mips_gdbarch_init): Do not set write_fp.
>         * ia64-tdep.c (ia64_gdbarch_init): Do not set write_fp.
>         * m68hc11-tdep.c (m68hc11_gdbarch_init): Do not set write_fp.
>         * rs6000-tdep.c (rs6000_gdbarch_init): Do not set write_fp.
>         * s390-tdep.c (s390_gdbarch_init): Do not set write_fp.
>         (s390_write_fp):
>         * sh-tdep.c (sh_gdbarch_init): Do not set write_fp.
>         * sparc-tdep.c (sparc_push_dummy_frame): Replace write_fp with
>         write_register.
>         (sparc_gdbarch_init): Do not set write_fp.
>         (sparc64_write_fp): Delete function.
>         * x86-64-tdep.c (i386_gdbarch_init): Do not set write_fp.
>         * d10v-tdep.c (d10v_gdbarch_init): Do not set write_fp.
>         (d10v_write_fp): Delete function.
>         * inferior.h (write_fp, generic_target_write_fp): Delete
>         declarations.
>         * regcache.c (generic_target_write_fp): Delete function.
>         (write_fp): Delete function.
>         * gdbarch.sh (TARGET_WRITE_FP): Delete.
>         * gdbarch.h, gdbarch.c: Regenerate.
>         * config/v850/tm-v850.h (TARGET_WRITE_FP): Delete macro.
>         * config/sparc/tm-sp64.h (TARGET_WRITE_FP): Delete macro.
>         (sparc64_write_fp): Delete declaration.
>         * config/h8500/tm-h8500.h (TARGET_WRITE_FP): Delete macro.
>         (h8500_write_fp): Delete declaration.
> 
> Index: doc/ChangeLog
> 2002-03-27  Andrew Cagney  <ac131313@redhat.com>
> 
>         * gdbint.texinfo (Target Architecture Definition): Delete
>         references to TARGET_WRITE_FP and write_fp.
> 
> Index: d10v-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
> retrieving revision 1.34
> diff -u -r1.34 d10v-tdep.c
> --- d10v-tdep.c 2002/03/19 02:51:04     1.34
> +++ d10v-tdep.c 2002/03/28 03:12:43
> @@ -966,12 +966,6 @@
>    write_register (SP_REGNUM, d10v_convert_daddr_to_raw (val));
>  }
> 
> -static void
> -d10v_write_fp (CORE_ADDR val)
> -{
> -  write_register (FP_REGNUM, d10v_convert_daddr_to_raw (val));
> -}
> -
>  static CORE_ADDR
>  d10v_read_fp (void)
>  {
> @@ -1477,7 +1471,6 @@
>    set_gdbarch_read_pc (gdbarch, d10v_read_pc);
>    set_gdbarch_write_pc (gdbarch, d10v_write_pc);
>    set_gdbarch_read_fp (gdbarch, d10v_read_fp);
> -  set_gdbarch_write_fp (gdbarch, d10v_write_fp);
>    set_gdbarch_read_sp (gdbarch, d10v_read_sp);
>    set_gdbarch_write_sp (gdbarch, d10v_write_sp);
> 
> Index: dwarf2cfi.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
> retrieving revision 1.2
> diff -u -r1.2 dwarf2cfi.c
> --- dwarf2cfi.c 2002/03/27 14:32:08     1.2
> +++ dwarf2cfi.c 2002/03/28 03:12:43
> @@ -1506,7 +1506,8 @@
>    return cfa;
>  }
> 
> -/* Store the frame address.  */
> +/* Store the frame address.  This function is not used.  */
> +
>  void
>  cfi_write_fp (CORE_ADDR val)
>  {
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.119
> diff -u -r1.119 gdbarch.sh
> --- gdbarch.sh  2002/03/19 02:51:07     1.119
> +++ gdbarch.sh  2002/03/28 03:13:12
> @@ -415,7 +415,6 @@
>  f::TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0
>  f::TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
>  f::TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
> -f::TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:generic_target_write_fp::0
>  f::TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
>  f::TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
>  # Function for getting target's idea of a frame pointer.  FIXME: GDB's
> Index: h8500-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/h8500-tdep.c,v
> retrieving revision 1.9
> diff -u -r1.9 h8500-tdep.c
> --- h8500-tdep.c        2001/07/15 20:10:02     1.9
> +++ h8500-tdep.c        2002/03/28 03:13:12
> @@ -604,12 +604,6 @@
>  }
> 
>  void
> -h8500_write_fp (CORE_ADDR v)
> -{
> -  write_register (PR6_REGNUM, v);
> -}
> -
> -void
>  _initialize_h8500_tdep (void)
>  {
>    tm_print_insn = print_insn_h8500;
> Index: ia64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
> retrieving revision 1.27
> diff -u -r1.27 ia64-tdep.c
> --- ia64-tdep.c 2002/03/16 21:09:33     1.27
> +++ ia64-tdep.c 2002/03/28 03:13:16
> @@ -667,10 +667,9 @@
>     even really hard to compute the frame chain, but it can be
>     computationally expensive.  So, instead of making life difficult
>     (and slow), we pick a more convenient representation of the frame
> -   chain, knowing that we'll have to make some small adjustments
> -   in other places.  (E.g, note that read_fp() and write_fp() are
> -   actually read_sp() and write_sp() below in ia64_gdbarch_init()
> -   below.)
> +   chain, knowing that we'll have to make some small adjustments in
> +   other places.  (E.g, note that read_fp() is actually read_sp() in
> +   ia64_gdbarch_init() below.)
> 
>     Okay, so what is the frame chain exactly?  It'll be the SP value
>     at the time that the function in question was entered.
> @@ -2204,7 +2203,6 @@
>       is all read_fp() is used for), simply use the stack pointer value
>       instead.  */
>    set_gdbarch_read_fp (gdbarch, generic_target_read_sp);
> -  set_gdbarch_write_fp (gdbarch, generic_target_write_sp);
> 
>    /* Settings that should be unnecessary.  */
>    set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
> Index: inferior.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/inferior.h,v
> retrieving revision 1.24
> diff -u -r1.24 inferior.h
> --- inferior.h  2001/11/22 00:23:12     1.24
> +++ inferior.h  2002/03/28 03:13:16
> @@ -177,10 +177,6 @@
> 
>  extern CORE_ADDR generic_target_read_fp (void);
> 
> -extern void write_fp (CORE_ADDR);
> -
> -extern void generic_target_write_fp (CORE_ADDR);
> -
>  extern CORE_ADDR unsigned_pointer_to_address (struct type *type, void *buf);
> 
>  extern void unsigned_address_to_pointer (struct type *type, void *buf,
> Index: m68hc11-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
> retrieving revision 1.17
> diff -u -r1.17 m68hc11-tdep.c
> --- m68hc11-tdep.c      2002/03/06 20:07:47     1.17
> +++ m68hc11-tdep.c      2002/03/28 03:13:18
> @@ -1087,7 +1087,6 @@
>    set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
>    set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
>    set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
> -  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>    set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
>    set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.67
> diff -u -r1.67 mips-tdep.c
> --- mips-tdep.c 2002/03/10 17:00:27     1.67
> +++ mips-tdep.c 2002/03/28 03:13:35
> @@ -4361,7 +4361,6 @@
>    set_gdbarch_read_pc (gdbarch, mips_read_pc);
>    set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
>    set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
> -  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>    set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
>    set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
> 
> Index: regcache.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/regcache.c,v
> retrieving revision 1.33
> diff -u -r1.33 regcache.c
> --- regcache.c  2002/03/21 02:13:05     1.33
> +++ regcache.c  2002/03/28 03:13:39
> @@ -585,16 +585,16 @@
>  }
> 
> 
> -/* read_pc, write_pc, read_sp, write_sp, read_fp, write_fp, etc.
> -   Special handling for registers PC, SP, and FP.  */
> +/* read_pc, write_pc, read_sp, write_sp, read_fp, etc.  Special
> +   handling for registers PC, SP, and FP.  */
> 
>  /* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(),
>     read_pc_pid(), read_pc(), generic_target_write_pc(),
>     write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(),
> -   generic_target_write_sp(), write_sp(), generic_target_read_fp(),
> -   read_fp(), generic_target_write_fp(), write_fp will eventually be
> -   moved out of the reg-cache into either frame.[hc] or to the
> -   multi-arch framework.  The are not part of the raw register cache.  */
> +   generic_target_write_sp(), write_sp(), generic_target_read_fp() and
> +   read_fp(), will eventually be moved out of the reg-cache into
> +   either frame.[hc] or to the multi-arch framework.  The are not part
> +   of the raw register cache.  */
> 
>  /* This routine is getting awfully cluttered with #if's.  It's probably
>     time to turn this into READ_PC and define it in the tm.h file.
> @@ -736,26 +736,6 @@
>  read_fp (void)
>  {
>    return TARGET_READ_FP ();
> -}
> -
> -void
> -generic_target_write_fp (CORE_ADDR val)
> -{
> -#ifdef FP_REGNUM
> -  if (FP_REGNUM >= 0)
> -    {
> -      write_register (FP_REGNUM, val);
> -      return;
> -    }
> -#endif
> -  internal_error (__FILE__, __LINE__,
> -                 "generic_target_write_fp");
> -}
> -
> -void
> -write_fp (CORE_ADDR val)
> -{
> -  TARGET_WRITE_FP (val);
>  }
> 
>  /* ARGSUSED */
> Index: rs6000-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
> retrieving revision 1.41
> diff -u -r1.41 rs6000-tdep.c
> --- rs6000-tdep.c       2002/03/28 00:48:41     1.41
> +++ rs6000-tdep.c       2002/03/28 03:13:53
> @@ -2601,7 +2601,6 @@
>    set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
>    set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
>    set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
> -  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>    set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
>    set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
> 
> Index: s390-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/s390-tdep.c,v
> retrieving revision 1.42
> diff -u -r1.42 s390-tdep.c
> --- s390-tdep.c 2002/02/24 22:31:19     1.42
> +++ s390-tdep.c 2002/03/28 03:13:56
> @@ -1212,13 +1212,6 @@
>  }
> 
> 
> -void
> -s390_write_fp (CORE_ADDR val)
> -{
> -  write_register (s390_fp_regnum (), val);
> -}
> -
> -
>  static void
>  s390_pop_frame_regular (struct frame_info *frame)
>  {
> @@ -1801,7 +1794,6 @@
>    set_gdbarch_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
>    set_gdbarch_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
>    set_gdbarch_read_fp (gdbarch, s390_read_fp);
> -  set_gdbarch_write_fp (gdbarch, s390_write_fp);
>    /* This function that tells us whether the function invocation represented
>       by FI does not have a frame on the stack associated with it.  If it
>       does not, FRAMELESS is set to 1, else 0.  */
> Index: sh-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/sh-tdep.c,v
> retrieving revision 1.49
> diff -u -r1.49 sh-tdep.c
> --- sh-tdep.c   2002/03/19 02:51:07     1.49
> +++ sh-tdep.c   2002/03/28 03:13:57
> @@ -2119,7 +2119,6 @@
>    set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
>    set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
>    set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
> -  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>    set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
>    set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
> 
> Index: sparc-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
> retrieving revision 1.23
> diff -u -r1.23 sparc-tdep.c
> --- sparc-tdep.c        2002/02/20 10:42:59     1.23
> +++ sparc-tdep.c        2002/03/28 03:14:00
> @@ -986,7 +986,7 @@
> 
>    if (strcmp (target_shortname, "sim") != 0)
>      {
> -      write_fp (old_sp);
> +      write_register (FP_REGNUM, old_sp);
> 
>        /* Set return address register for the call dummy to the current PC.  */
>        write_register (I7_REGNUM, read_pc () - 8);
> @@ -2261,16 +2261,6 @@
>      write_register (SP_REGNUM, val);
>  }
> 
> -void
> -sparc64_write_fp (CORE_ADDR val)
> -{
> -  CORE_ADDR oldfp = read_register (FP_REGNUM);
> -  if (oldfp & 1)
> -    write_register (FP_REGNUM, val - 2047);
> -  else
> -    write_register (FP_REGNUM, val);
> -}
> -
>  /* The SPARC 64 ABI passes floating-point arguments in FP0 to FP31,
>     and all other arguments in O0 to O5.  They are also copied onto
>     the stack in the correct places.  Apparently (empirically),
> @@ -3038,7 +3028,6 @@
>        set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return);
>        set_gdbarch_use_struct_convention (gdbarch,
>                                          generic_use_struct_convention);
> -      set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
>        set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
>        tdep->y_regnum = SPARC32_Y_REGNUM;
>        tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32;
> @@ -3097,7 +3086,6 @@
>        set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return);
>        set_gdbarch_use_struct_convention (gdbarch,
>                                          sparc64_use_struct_convention);
> -      set_gdbarch_write_fp (gdbarch, sparc64_write_fp);
>        set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
>        tdep->y_regnum = SPARC64_Y_REGNUM;
>        tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;
> Index: x86-64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
> retrieving revision 1.12
> diff -u -r1.12 x86-64-tdep.c
> --- x86-64-tdep.c       2002/03/27 10:21:26     1.12
> +++ x86-64-tdep.c       2002/03/28 03:14:06
> @@ -960,7 +960,6 @@
>    set_gdbarch_fp0_regnum (gdbarch, X86_64_NUM_GREGS);  /* First FPU floating-point register.  */
> 
>    set_gdbarch_read_fp (gdbarch, cfi_read_fp);
> -  set_gdbarch_write_fp (gdbarch, cfi_write_fp);
> 
>  /* Discard from the stack the innermost frame, restoring all registers.  */
>    set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame);
> Index: config/h8500/tm-h8500.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/h8500/tm-h8500.h,v
> retrieving revision 1.10
> diff -u -r1.10 tm-h8500.h
> --- tm-h8500.h  2002/01/29 04:42:37     1.10
> +++ tm-h8500.h  2002/03/28 03:14:09
> @@ -275,7 +275,6 @@
>  extern void h8500_write_sp (CORE_ADDR);
> 
>  extern CORE_ADDR h8500_read_fp (void);
> -extern void h8500_write_fp (CORE_ADDR);
> 
>  extern CORE_ADDR h8500_read_pc (ptid_t);
>  extern void h8500_write_pc (CORE_ADDR, ptid_t);
> @@ -287,4 +286,3 @@
>  #define TARGET_WRITE_PC(x,pid) h8500_write_pc(x,pid)
> 
>  #define TARGET_READ_FP() h8500_read_fp()
> -#define TARGET_WRITE_FP(x) h8500_write_fp(x)
> Index: config/sparc/tm-sp64.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/sparc/tm-sp64.h,v
> retrieving revision 1.6
> diff -u -r1.6 tm-sp64.h
> --- tm-sp64.h   2002/02/25 02:13:08     1.6
> +++ tm-sp64.h   2002/03/28 03:14:20
> @@ -268,12 +268,10 @@
>  extern CORE_ADDR sparc64_read_sp ();
>  extern CORE_ADDR sparc64_read_fp ();
>  extern void sparc64_write_sp (CORE_ADDR);
> -extern void sparc64_write_fp (CORE_ADDR);
> 
>  #define TARGET_READ_SP() (sparc64_read_sp ())
>  #define TARGET_READ_FP() (sparc64_read_fp ())
>  #define TARGET_WRITE_SP(X) (sparc64_write_sp (X))
> -#define TARGET_WRITE_FP(X) (sparc64_write_fp (X))
> 
>  #undef EXTRACT_RETURN_VALUE
>  #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
> Index: config/v850/tm-v850.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/v850/tm-v850.h,v
> retrieving revision 1.7
> diff -u -r1.7 tm-v850.h
> --- tm-v850.h   2002/01/29 04:42:44     1.7
> +++ tm-v850.h   2002/03/28 03:14:20
> @@ -72,7 +72,6 @@
>  #define FP_RAW_REGNUM 29
> 
>  #define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
> -#define TARGET_WRITE_FP(VAL) write_register (FP_REGNUM, (VAL))
> 
>  #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
> 
> Index: doc/gdbint.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
> retrieving revision 1.71
> diff -u -r1.71 gdbint.texinfo
> --- gdbint.texinfo      2002/03/27 21:16:33     1.71
> +++ gdbint.texinfo      2002/03/28 03:15:21
> @@ -2918,8 +2918,8 @@
>  If the virtual frame pointer is kept in a register, then define this
>  macro to be the number (greater than or equal to zero) of that register.
> 
> -This should only need to be defined if @code{TARGET_READ_FP} and
> -@code{TARGET_WRITE_FP} are not defined.
> +This should only need to be defined if @code{TARGET_READ_FP} is not
> +defined.
> 
>  @item FRAMELESS_FUNCTION_INVOCATION(@var{fi})
>  @findex FRAMELESS_FUNCTION_INVOCATION
> @@ -3547,18 +3547,15 @@
>  @findex TARGET_WRITE_SP
>  @itemx TARGET_READ_FP
>  @findex TARGET_READ_FP
> -@itemx TARGET_WRITE_FP
> -@findex TARGET_WRITE_FP
>  @findex read_pc
>  @findex write_pc
>  @findex read_sp
>  @findex write_sp
>  @findex read_fp
> -@findex write_fp
>  These change the behavior of @code{read_pc}, @code{write_pc},
> -@code{read_sp}, @code{write_sp}, @code{read_fp} and @code{write_fp}.
> -For most targets, these may be left undefined.  @value{GDBN} will call the read
> -and write register functions with the relevant @code{_REGNUM} argument.
> +@code{read_sp}, @code{write_sp} and @code{read_fp}.  For most targets,
> +these may be left undefined.  @value{GDBN} will call the read and write
> +register functions with the relevant @code{_REGNUM} argument.
> 
>  These macros are useful when a target keeps one of these registers in a
>  hard to get at place; for example, part in a segment register and part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]