Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] h8300-tdep.c: Drop xxx_register_byte and xxx_virtual_register_type
@ 2003-06-13  8:12 Corinna Vinschen
  2003-06-13 13:21 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Corinna Vinschen @ 2003-06-13  8:12 UTC (permalink / raw)
  To: gdb-patches

Applied as obvious.

Corinna

        * h8300-tdep.c (h8300_register_byte): Remove.
        (h8300h_register_byte): Remove.
        (h8300_register_virtual_type): Remove.  Substitute by...
        (h8300_register_type): New function.
        (h8300_extract_struct_value_address): Drop usage of h8300_register_byte.
        (h8300h_extract_struct_value_address): Ditto.
        (h8300_gdbarch_init): Drop calls to
        set_gdbarch_deprecated_register_byte and
        set_gdbarch_deprecated_register_virtual_type.
        Add call to set_gdbarch_register_type.

Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.69
diff -u -p -r1.69 h8300-tdep.c
--- h8300-tdep.c	13 Jun 2003 04:40:32 -0000	1.69
+++ h8300-tdep.c	13 Jun 2003 08:04:13 -0000
@@ -1003,32 +1003,12 @@ h8300_saved_pc_after_call (struct frame_
   return read_memory_unsigned_integer (read_register (E_SP_REGNUM), BINWORD);
 }
 
-static int
-h8300_register_byte (int regno)
-{
-  if (regno < 0 || regno >= NUM_REGS)
-    internal_error (__FILE__, __LINE__,
-		    "h8300_register_byte: illegal register number %d", regno);
-  else
-    return regno * h8300_reg_size;
-}
-
-static int
-h8300h_register_byte (int regno)
-{
-  if (regno < 0 || regno >= NUM_REGS)
-    internal_error (__FILE__, __LINE__,
-		    "h8300_register_byte: illegal register number %d", regno);
-  else
-    return regno * h8300h_reg_size;
-}
-
 static struct type *
-h8300_register_virtual_type (int regno)
+h8300_register_type (struct gdbarch *gdbarch, int regno)
 {
   if (regno < 0 || regno >= NUM_REGS)
     internal_error (__FILE__, __LINE__,
-		    "h8300_register_virtual_type: illegal register number %d",
+		    "h8300_register_type: illegal register number %d",
 		    regno);
   else
     {
@@ -1062,7 +1042,7 @@ static CORE_ADDR
 h8300_extract_struct_value_address (char *regbuf)
 {
   return 
-    extract_unsigned_integer (regbuf + h8300_register_byte (E_ARG0_REGNUM),
+    extract_unsigned_integer (regbuf + h8300_reg_size * E_ARG0_REGNUM,
 			      h8300_reg_size);
 }
 
@@ -1070,7 +1050,7 @@ static CORE_ADDR
 h8300h_extract_struct_value_address (char *regbuf)
 {
   return 
-    extract_unsigned_integer (regbuf + h8300_register_byte (E_ARG0_REGNUM),
+    extract_unsigned_integer (regbuf + h8300h_reg_size * E_ARG0_REGNUM,
 			      h8300h_reg_size);
 }
 
@@ -1120,7 +1100,6 @@ h8300_gdbarch_init (struct gdbarch_info 
       h8300hmode = 0;
       set_gdbarch_num_regs (gdbarch, 13);
       set_gdbarch_register_name (gdbarch, h8300_register_name);
-      set_gdbarch_deprecated_register_byte (gdbarch, h8300_register_byte);
       set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
       break;
@@ -1131,7 +1110,6 @@ h8300_gdbarch_init (struct gdbarch_info 
       h8300hmode = 1;
       set_gdbarch_num_regs (gdbarch, 13);
       set_gdbarch_register_name (gdbarch, h8300_register_name);
-      set_gdbarch_deprecated_register_byte (gdbarch, h8300h_register_byte);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       break;
@@ -1142,7 +1120,6 @@ h8300_gdbarch_init (struct gdbarch_info 
       h8300hmode = 1;
       set_gdbarch_num_regs (gdbarch, 14);
       set_gdbarch_register_name (gdbarch, h8300s_register_name);
-      set_gdbarch_deprecated_register_byte (gdbarch, h8300h_register_byte);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       break;
@@ -1153,7 +1130,6 @@ h8300_gdbarch_init (struct gdbarch_info 
       h8300hmode = 1;
       set_gdbarch_num_regs (gdbarch, 18);
       set_gdbarch_register_name (gdbarch, h8300sx_register_name);
-      set_gdbarch_deprecated_register_byte (gdbarch, h8300h_register_byte);
       set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
       break;
@@ -1171,7 +1147,7 @@ h8300_gdbarch_init (struct gdbarch_info 
   set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
   set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
-  set_gdbarch_deprecated_register_virtual_type (gdbarch, h8300_register_virtual_type);
+  set_gdbarch_register_type (gdbarch, h8300_register_type);
   set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info);
   set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
 
-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] h8300-tdep.c: Drop xxx_register_byte and xxx_virtual_register_type
  2003-06-13  8:12 [PATCH] h8300-tdep.c: Drop xxx_register_byte and xxx_virtual_register_type Corinna Vinschen
@ 2003-06-13 13:21 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2003-06-13 13:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Corinna Vinschen

> -static int
> -h8300h_register_byte (int regno)
> -{
> -  if (regno < 0 || regno >= NUM_REGS)
> -    internal_error (__FILE__, __LINE__,
> -		    "h8300_register_byte: illegal register number %d", regno);
> -  else
> -    return regno * h8300h_reg_size;
> -}
> -
>  static struct type *
> -h8300_register_virtual_type (int regno)
> +h8300_register_type (struct gdbarch *gdbarch, int regno)
>  {
>    if (regno < 0 || regno >= NUM_REGS)
>      internal_error (__FILE__, __LINE__,
> -		    "h8300_register_virtual_type: illegal register number %d",
> +		    "h8300_register_type: illegal register number %d",
>  		    regno);
>    else
>      {

A word of caution here to would be updaters.  Before dropping 
register_byte make certain that its removal doesn't modify the register 
cache's layout (use maint print registers).

The MIPS, for instance, would change radically, if register byte is 
removed - it needs other significant surgery.

The problem here is that REGISTER_BYTE also defines the [Gg] remote 
protocol layout.  Things to do today includes adds a comment warning of 
this.

Andrew



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-13 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-13  8:12 [PATCH] h8300-tdep.c: Drop xxx_register_byte and xxx_virtual_register_type Corinna Vinschen
2003-06-13 13:21 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox