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]

Remove register_bytes_ok arch method


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?

- Volodya

--- gdb/remote.c	(/mirrors/gdb_mainline)	(revision 4073)
+++ gdb/remote.c	(/patches/gdb/coldfire_1)	(revision 4073)
@@ -3589,8 +3589,6 @@ process_g_packet (void)
   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 4073)
+++ gdb/gdbarch.c	(/patches/gdb/coldfire_1)	(revision 4073)
@@ -176,7 +176,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;
@@ -304,7 +303,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 */
@@ -562,7 +560,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 */
@@ -1385,24 +1382,6 @@ gdbarch_dump (struct gdbarch *current_gd
   fprintf_unfiltered (file,
                       "gdbarch_dump: read_sp = <0x%lx>\n",
                       (long) current_gdbarch->read_sp);
-#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",
@@ -2489,30 +2468,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 4073)
+++ gdb/gdbarch.h	(/patches/gdb/coldfire_1)	(revision 4073)
@@ -597,31 +597,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 4073)
+++ gdb/m68k-tdep.c	(/patches/gdb/coldfire_1)	(revision 4073)
@@ -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
@@ -1176,7 +1164,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);

Attachment: 1.ChangeLog
Description: Text document


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