This is the mail archive of the gdb-patches@sourceware.org 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: Remove register_bytes_ok arch method


Daniel Jacobowitz wrote:

> On Sat, May 05, 2007 at 12:26:31PM +0400, Vladimir Prus wrote:
>> 
>> At the moment, the register_bytes_ok arch method is defined
>> only by m68k-tdep.c. There's no good reason to have this method now,
>> as remote.c, if it does not see some register in 'g' reply will send
>> extra 'p' reply just fine. Further, it's hard to decide what's
>> right size of 'g' reply -- target may have floating point registers, or
>> might not have, and so on.
>> 
>> This patch removes register_bytes_ok arch method. OK?
> 
> I agree.  The patch is OK, but you didn't remove it right.  gdbarch.h
> and gdbarch.c are generated by running gdbarch.sh; just remove it from
> there, run the script, and move the new files into place.

Here's the updated patch. OK?

- Volodya


Attachment: 1.ChangeLog
Description: Text document

--- gdb/remote.c	(/mirrors/gdb_mainline)	(revision 4267)
+++ gdb/remote.c	(/patches/gdb/coldfire_1)	(revision 4267)
@@ -3592,8 +3592,6 @@ process_g_packet (struct regcache *regca
   buf_len = strlen (rs->buf);
 
   /* Further sanity checks, with knowledge of the architecture.  */
-  if (REGISTER_BYTES_OK_P () && !REGISTER_BYTES_OK (buf_len / 2))
-    error (_("Remote 'g' packet reply is wrong length: %s"), rs->buf);
   if (buf_len > 2 * rsa->sizeof_g_packet)
     error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
 
--- gdb/gdbarch.c	(/mirrors/gdb_mainline)	(revision 4267)
+++ gdb/gdbarch.c	(/patches/gdb/coldfire_1)	(revision 4267)
@@ -174,7 +174,6 @@ struct gdbarch
   gdbarch_print_float_info_ftype *print_float_info;
   gdbarch_print_vector_info_ftype *print_vector_info;
   gdbarch_register_sim_regno_ftype *register_sim_regno;
-  gdbarch_register_bytes_ok_ftype *register_bytes_ok;
   gdbarch_cannot_fetch_register_ftype *cannot_fetch_register;
   gdbarch_cannot_store_register_ftype *cannot_store_register;
   gdbarch_get_longjmp_target_ftype *get_longjmp_target;
@@ -300,7 +299,6 @@ struct gdbarch startup_gdbarch =
   0,  /* print_float_info */
   0,  /* print_vector_info */
   0,  /* register_sim_regno */
-  0,  /* register_bytes_ok */
   0,  /* cannot_fetch_register */
   0,  /* cannot_store_register */
   0,  /* get_longjmp_target */
@@ -554,7 +552,6 @@ verify_gdbarch (struct gdbarch *current_
   /* Skip verify of print_float_info, has predicate */
   /* Skip verify of print_vector_info, has predicate */
   /* Skip verify of register_sim_regno, invalid_p == 0 */
-  /* Skip verify of register_bytes_ok, has predicate */
   /* Skip verify of cannot_fetch_register, invalid_p == 0 */
   /* Skip verify of cannot_store_register, invalid_p == 0 */
   /* Skip verify of get_longjmp_target, has predicate */
@@ -1329,24 +1326,6 @@ gdbarch_dump (struct gdbarch *current_gd
   fprintf_unfiltered (file,
                       "gdbarch_dump: read_pc = <0x%lx>\n",
                       (long) current_gdbarch->read_pc);
-#ifdef REGISTER_BYTES_OK_P
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "REGISTER_BYTES_OK_P()",
-                      XSTRING (REGISTER_BYTES_OK_P ()));
-#endif
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_register_bytes_ok_p() = %d\n",
-                      gdbarch_register_bytes_ok_p (current_gdbarch));
-#ifdef REGISTER_BYTES_OK
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "REGISTER_BYTES_OK(nr_bytes)",
-                      XSTRING (REGISTER_BYTES_OK (nr_bytes)));
-#endif
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: register_bytes_ok = <0x%lx>\n",
-                      (long) current_gdbarch->register_bytes_ok);
 #ifdef REGISTER_NAME
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2387,30 +2366,6 @@ set_gdbarch_register_sim_regno (struct g
 }
 
 int
-gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->register_bytes_ok != NULL;
-}
-
-int
-gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes)
-{
-  gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->register_bytes_ok != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n");
-  return gdbarch->register_bytes_ok (nr_bytes);
-}
-
-void
-set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch,
-                               gdbarch_register_bytes_ok_ftype register_bytes_ok)
-{
-  gdbarch->register_bytes_ok = register_bytes_ok;
-}
-
-int
 gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
 {
   gdb_assert (gdbarch != NULL);
--- gdb/gdbarch.h	(/mirrors/gdb_mainline)	(revision 4267)
+++ gdb/gdbarch.h	(/patches/gdb/coldfire_1)	(revision 4267)
@@ -538,31 +538,6 @@ extern void set_gdbarch_register_sim_reg
 #define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr))
 #endif
 
-#if defined (REGISTER_BYTES_OK)
-/* Legacy for systems yet to multi-arch REGISTER_BYTES_OK */
-#if !defined (REGISTER_BYTES_OK_P)
-#define REGISTER_BYTES_OK_P() (1)
-#endif
-#endif
-
-extern int gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch);
-#if !defined (GDB_TM_FILE) && defined (REGISTER_BYTES_OK_P)
-#error "Non multi-arch definition of REGISTER_BYTES_OK"
-#endif
-#if !defined (REGISTER_BYTES_OK_P)
-#define REGISTER_BYTES_OK_P() (gdbarch_register_bytes_ok_p (current_gdbarch))
-#endif
-
-typedef int (gdbarch_register_bytes_ok_ftype) (long nr_bytes);
-extern int gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes);
-extern void set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, gdbarch_register_bytes_ok_ftype *register_bytes_ok);
-#if !defined (GDB_TM_FILE) && defined (REGISTER_BYTES_OK)
-#error "Non multi-arch definition of REGISTER_BYTES_OK"
-#endif
-#if !defined (REGISTER_BYTES_OK)
-#define REGISTER_BYTES_OK(nr_bytes) (gdbarch_register_bytes_ok (current_gdbarch, nr_bytes))
-#endif
-
 typedef int (gdbarch_cannot_fetch_register_ftype) (int regnum);
 extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum);
 extern void set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, gdbarch_cannot_fetch_register_ftype *cannot_fetch_register);
--- gdb/m68k-tdep.c	(/mirrors/gdb_mainline)	(revision 4267)
+++ gdb/m68k-tdep.c	(/patches/gdb/coldfire_1)	(revision 4267)
@@ -54,10 +54,6 @@
 #define P_MOVEL_SP	0x2f00
 #define P_MOVEML_SP	0x48e7
 
-
-#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
-#define REGISTER_BYTES_NOFP (16*4 + 8)
-
 /* Offset from SP to first arg on stack at first instruction of a function */
 #define SP_ARG0 (1 * 4)
 
@@ -73,14 +69,6 @@ m68k_local_breakpoint_from_pc (CORE_ADDR
   return break_insn;
 }
 
-
-static int
-m68k_register_bytes_ok (long numbytes)
-{
-  return ((numbytes == REGISTER_BYTES_FP)
-	  || (numbytes == REGISTER_BYTES_NOFP));
-}
-
 /* Return the GDB type object for the "standard" data type of data in
    register N.  This should be int for D0-D7, SR, FPCONTROL and
    FPSTATUS, long double for FP0-FP7, and void pointer for all others
@@ -1043,7 +1031,6 @@ m68k_gdbarch_init (struct gdbarch_info i
   set_gdbarch_register_type (gdbarch, m68k_register_type);
   set_gdbarch_register_name (gdbarch, m68k_register_name);
   set_gdbarch_num_regs (gdbarch, M68K_NUM_REGS);
-  set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
   set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
   set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
--- gdb/gdbarch.sh	(/mirrors/gdb_mainline)	(revision 4267)
+++ gdb/gdbarch.sh	(/patches/gdb/coldfire_1)	(revision 4267)
@@ -479,7 +479,6 @@ M::void:print_vector_info:struct ui_file
 # MAP a GDB RAW register number onto a simulator register number.  See
 # also include/...-sim.h.
 f:=:int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
-F:=:int:register_bytes_ok:long nr_bytes:nr_bytes
 f:=:int:cannot_fetch_register:int regnum:regnum::cannot_register_not::0
 f:=:int:cannot_store_register:int regnum:regnum::cannot_register_not::0
 # setjmp/longjmp support.

Property changes on: 
___________________________________________________________________
Name: svk:merge
 +e7755896-6108-0410-9592-8049d3e74e28:/mirrors/gdb/trunk:172452


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