Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size
@ 2002-05-05 19:28 Andrew Cagney
  2002-05-05 22:17 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Andrew Cagney @ 2002-05-05 19:28 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

Hello,

For most architectures.  The relationship:

	REGISTER_VIRTUAL_SIZE(N)
	== REGISTER_RAW_SIZE(N)
	== TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)

(the exception is the @$(*&@(^$*&^!@ MIPS ...).  Given this, the 
attached patch changes the architecture vector so that it defaults both 
to the register's type size.

I think this is the logical conclusion to MichaelS's earlier patch that 
provided defaults to each.

Thoughts?  I'll look to commit it in a week.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 11478 bytes --]

2002-05-05  Andrew Cagney  <ac131313@redhat.com>

	* arch-utils.h (generic_register_size): Declare.
	(generic_register_raw_size, generic_register_virtual_size): Delete
	declarations.
	* arch-utils.c (generic_register_raw_size): Delete.
	(generic_register_size): New function.
	(generic_register_virtual_size): Delete.

	* gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Make
	default generic_register_size.
	* gdbarch.h, gdbarch.c: Re-generate.
	
	* d10v-tdep.c (d10v_gdbarch_init): Use generic_register_size for
	register_virtual_size.
	* x86-64-tdep.c (x86_64_gdbarch_init): Ditto.
	* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.55
diff -u -r1.55 arch-utils.c
--- arch-utils.c	5 May 2002 01:15:12 -0000	1.55
+++ arch-utils.c	6 May 2002 02:14:27 -0000
@@ -401,21 +401,13 @@
   *frame_offset = 0;
 }
 
-/* Assume the world is flat.  Every register is large enough to fit a
-   target integer.  */
+/* Assume the world is sane, every register's virtual and real size
+   is identical.  */
 
 int
-generic_register_raw_size (int regnum)
+generic_register_size (int regnum)
 {
   gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
-  return TARGET_INT_BIT / HOST_CHAR_BIT;
-}
-
-/* Assume the virtual size corresponds to the virtual type.  */
-
-int
-generic_register_virtual_size (int regnum)
-{
   return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
 }
 
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.30
diff -u -r1.30 arch-utils.h
--- arch-utils.h	24 Apr 2002 16:28:14 -0000	1.30
+++ arch-utils.h	6 May 2002 02:14:27 -0000
@@ -149,13 +149,10 @@
 
 extern void default_print_float_info (void);
 
-/* Assume all registers are the same size and a size identical to that
-   of the integer type.  */
-extern int generic_register_raw_size (int regnum);
+/* Assume that the world is sane, a registers raw and virtual size
+   both match its type.  */
 
-/* Assume the virtual size of registers corresponds to the virtual type.  */
-
-extern int generic_register_virtual_size (int regnum);
+extern int generic_register_size (int regnum);
 
 /* Prop up old targets that use various IN_SIGTRAMP() macros.  */
 extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.37
diff -u -r1.37 d10v-tdep.c
--- d10v-tdep.c	18 Apr 2002 18:08:59 -0000	1.37
+++ d10v-tdep.c	6 May 2002 02:14:28 -0000
@@ -1486,7 +1486,7 @@
   set_gdbarch_register_byte (gdbarch, d10v_register_byte);
   set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size);
   set_gdbarch_max_register_raw_size (gdbarch, 8);
-  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
   set_gdbarch_max_register_virtual_size (gdbarch, 8);
   set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type);
 
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.122
diff -u -r1.122 gdbarch.c
--- gdbarch.c	3 May 2002 21:05:35 -0000	1.122
+++ gdbarch.c	6 May 2002 02:14:38 -0000
@@ -311,9 +311,9 @@
   0,
   0,
   0,
-  generic_register_raw_size,
+  generic_register_size,
   0,
-  generic_register_virtual_size,
+  generic_register_size,
   0,
   0,
   0,
@@ -475,7 +475,9 @@
   current_gdbarch->register_name = legacy_register_name;
   current_gdbarch->register_size = -1;
   current_gdbarch->register_bytes = -1;
+  current_gdbarch->register_raw_size = generic_register_size;
   current_gdbarch->max_register_raw_size = -1;
+  current_gdbarch->register_virtual_size = generic_register_size;
   current_gdbarch->max_register_virtual_size = -1;
   current_gdbarch->do_registers_info = do_registers_info;
   current_gdbarch->print_float_info = default_print_float_info;
@@ -611,15 +613,11 @@
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->register_byte == 0))
     fprintf_unfiltered (log, "\n\tregister_byte");
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->register_raw_size == 0))
-    fprintf_unfiltered (log, "\n\tregister_raw_size");
+  /* Skip verify of register_raw_size, invalid_p == 0 */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->max_register_raw_size == -1))
     fprintf_unfiltered (log, "\n\tmax_register_raw_size");
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->register_virtual_size == 0))
-    fprintf_unfiltered (log, "\n\tregister_virtual_size");
+  /* Skip verify of register_virtual_size, invalid_p == 0 */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->max_register_virtual_size == -1))
     fprintf_unfiltered (log, "\n\tmax_register_virtual_size");
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.91
diff -u -r1.91 gdbarch.h
--- gdbarch.h	24 Apr 2002 16:28:15 -0000	1.91
+++ gdbarch.h	6 May 2002 02:14:44 -0000
@@ -720,6 +720,11 @@
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
+#define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr))
+#endif
+
 typedef int (gdbarch_register_raw_size_ftype) (int reg_nr);
 extern int gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size);
@@ -741,6 +746,11 @@
 #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_RAW_SIZE)
 #define MAX_REGISTER_RAW_SIZE (gdbarch_max_register_raw_size (current_gdbarch))
 #endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
+#define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr))
 #endif
 
 typedef int (gdbarch_register_virtual_size_ftype) (int reg_nr);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.133
diff -u -r1.133 gdbarch.sh
--- gdbarch.sh	3 May 2002 21:05:36 -0000	1.133
+++ gdbarch.sh	6 May 2002 02:14:47 -0000
@@ -463,9 +463,9 @@
 v:2:REGISTER_SIZE:int:register_size::::0:-1
 v:2:REGISTER_BYTES:int:register_bytes::::0:-1
 f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
-f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0
+f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
 v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
-f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_virtual_size:0
+f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
 v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
 f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.63
diff -u -r1.63 rs6000-tdep.c
--- rs6000-tdep.c	30 Apr 2002 23:36:11 -0000	1.63
+++ rs6000-tdep.c	6 May 2002 02:14:52 -0000
@@ -2663,7 +2663,7 @@
   set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
   set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
   set_gdbarch_max_register_raw_size (gdbarch, 16);
-  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
   set_gdbarch_max_register_virtual_size (gdbarch, 16);
   set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
   set_gdbarch_do_registers_info (gdbarch, rs6000_do_registers_info);
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.16
diff -u -r1.16 x86-64-tdep.c
--- x86-64-tdep.c	3 May 2002 10:52:00 -0000	1.16
+++ x86-64-tdep.c	6 May 2002 02:14:56 -0000
@@ -998,7 +998,7 @@
   for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++)
     sum += x86_64_register_info_table[i].size;
   set_gdbarch_register_bytes (gdbarch, sum);
-  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
+  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
   set_gdbarch_max_register_virtual_size (gdbarch, 16);
 
   set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type);
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.183
diff -u -r1.183 ChangeLog
--- doc/ChangeLog	4 May 2002 19:57:22 -0000	1.183
+++ doc/ChangeLog	6 May 2002 02:15:03 -0000
@@ -1,3 +1,10 @@
+2002-05-05  Andrew Cagney  <ac131313@redhat.com>
+
+	* gdbint.texinfo (Target Architecture Definition): Mention
+	defaults for REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE.
+	(Target Architecture Definition): Mention same.  Add references to
+	web pages.
+
 2002-05-04  Andrew Cagney  <ac131313@redhat.com>
 
 	* gdbint.texinfo (Releasing GDB): Revise `Create a Release'.
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.81
diff -u -r1.81 gdbint.texinfo
--- doc/gdbint.texinfo	4 May 2002 19:57:22 -0000	1.81
+++ doc/gdbint.texinfo	6 May 2002 02:15:29 -0000
@@ -2496,8 +2496,13 @@
 
 @emph{Maintainer's note: The way GDB manipulates registers is undergoing
 significant change.  Many of the macros and functions refered to in the
-sections below are likely to be made obsolete.  See the file @file{TODO}
-for more up-to-date information.}
+section below are likely to be made obsolete.  For instance, instead of
+having different raw and virtual register sizes, an architecture can
+define pseudo-registers that map onto the raw registers.
+
+See the @uref{http://www.gnu.org/software/gdb/bugs/, Bug Tracking
+Database} and @uref{http://sources.redhat.com/gdb/current/ari, ARI
+Index} for more up-to-date information.}
 
 Some architectures use one representation for a value when it lives in a
 register, but use a different representation when it lives in memory.
@@ -3175,12 +3180,14 @@
 
 @item REGISTER_RAW_SIZE (@var{reg})
 @findex REGISTER_RAW_SIZE
-Return the raw size of @var{reg}.
+Return the raw size of @var{reg}; defaults to the size of the register's
+virtual type.
 @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
 
 @item REGISTER_VIRTUAL_SIZE (@var{reg})
 @findex REGISTER_VIRTUAL_SIZE
-Return the virtual size of @var{reg}.
+Return the virtual size of @var{reg}; defaults to the size of the
+register's virtual type.
 @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
 
 @item REGISTER_VIRTUAL_TYPE (@var{reg})

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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size
  2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
@ 2002-05-05 22:17 ` Eli Zaretskii
  2002-05-06 13:38 ` Kevin Buettner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2002-05-05 22:17 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches


On Sun, 5 May 2002, Andrew Cagney wrote:

> For most architectures.  The relationship:
> 
> 	REGISTER_VIRTUAL_SIZE(N)
> 	== REGISTER_RAW_SIZE(N)
> 	== TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
> 
> (the exception is the @$(*&@(^$*&^!@ MIPS ...).  Given this, the 
> attached patch changes the architecture vector so that it defaults both 
> to the register's type size.

The changes for gdbint.texinfo are approved.


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size
  2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
  2002-05-05 22:17 ` Eli Zaretskii
@ 2002-05-06 13:38 ` Kevin Buettner
  2002-05-06 17:01 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE toregister_size Michael Snyder
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Kevin Buettner @ 2002-05-06 13:38 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches

On May 5, 10:28pm, Andrew Cagney wrote:

> For most architectures.  The relationship:
> 
> 	REGISTER_VIRTUAL_SIZE(N)
> 	== REGISTER_RAW_SIZE(N)
> 	== TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
> 
> (the exception is the @$(*&@(^$*&^!@ MIPS ...).  Given this, the 
> attached patch changes the architecture vector so that it defaults both 
> to the register's type size.
> 
> I think this is the logical conclusion to MichaelS's earlier patch that 
> provided defaults to each.
> 
> Thoughts?  I'll look to commit it in a week.

It looks okay to me.

Kevin


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE  toregister_size
  2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
  2002-05-05 22:17 ` Eli Zaretskii
  2002-05-06 13:38 ` Kevin Buettner
@ 2002-05-06 17:01 ` Michael Snyder
  2002-05-06 17:17   ` Andrew Cagney
  2002-05-07  3:21 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Richard Earnshaw
  2002-05-11 19:03 ` Andrew Cagney
  4 siblings, 1 reply; 13+ messages in thread
From: Michael Snyder @ 2002-05-06 17:01 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> Hello,
> 
> For most architectures.  The relationship:
> 
>         REGISTER_VIRTUAL_SIZE(N)
>         == REGISTER_RAW_SIZE(N)
>         == TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
> 
> (the exception is the @$(*&@(^$*&^!@ MIPS ...). 

Surely this is also true for x87 regs?

> Given this, the
> attached patch changes the architecture vector so that it defaults both
> to the register's type size.
> 
> I think this is the logical conclusion to MichaelS's earlier patch that
> provided defaults to each.
> 
> Thoughts?  I'll look to commit it in a week.

If I understand it, it won't affect any target that explicitly 
sets these methods -- in which case I agree with the change.


>   ------------------------------------------------------------------------
> 2002-05-05  Andrew Cagney  <ac131313@redhat.com>
> 
>         * arch-utils.h (generic_register_size): Declare.
>         (generic_register_raw_size, generic_register_virtual_size): Delete
>         declarations.
>         * arch-utils.c (generic_register_raw_size): Delete.
>         (generic_register_size): New function.
>         (generic_register_virtual_size): Delete.
> 
>         * gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Make
>         default generic_register_size.
>         * gdbarch.h, gdbarch.c: Re-generate.
> 
>         * d10v-tdep.c (d10v_gdbarch_init): Use generic_register_size for
>         register_virtual_size.
>         * x86-64-tdep.c (x86_64_gdbarch_init): Ditto.
>         * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
> 
> Index: arch-utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.c,v
> retrieving revision 1.55
> diff -u -r1.55 arch-utils.c
> --- arch-utils.c        5 May 2002 01:15:12 -0000       1.55
> +++ arch-utils.c        6 May 2002 02:14:27 -0000
> @@ -401,21 +401,13 @@
>    *frame_offset = 0;
>  }
> 
> -/* Assume the world is flat.  Every register is large enough to fit a
> -   target integer.  */
> +/* Assume the world is sane, every register's virtual and real size
> +   is identical.  */
> 
>  int
> -generic_register_raw_size (int regnum)
> +generic_register_size (int regnum)
>  {
>    gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
> -  return TARGET_INT_BIT / HOST_CHAR_BIT;
> -}
> -
> -/* Assume the virtual size corresponds to the virtual type.  */
> -
> -int
> -generic_register_virtual_size (int regnum)
> -{
>    return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
>  }
> 
> Index: arch-utils.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.h,v
> retrieving revision 1.30
> diff -u -r1.30 arch-utils.h
> --- arch-utils.h        24 Apr 2002 16:28:14 -0000      1.30
> +++ arch-utils.h        6 May 2002 02:14:27 -0000
> @@ -149,13 +149,10 @@
> 
>  extern void default_print_float_info (void);
> 
> -/* Assume all registers are the same size and a size identical to that
> -   of the integer type.  */
> -extern int generic_register_raw_size (int regnum);
> +/* Assume that the world is sane, a registers raw and virtual size
> +   both match its type.  */
> 
> -/* Assume the virtual size of registers corresponds to the virtual type.  */
> -
> -extern int generic_register_virtual_size (int regnum);
> +extern int generic_register_size (int regnum);
> 
>  /* Prop up old targets that use various IN_SIGTRAMP() macros.  */
>  extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
> Index: d10v-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
> retrieving revision 1.37
> diff -u -r1.37 d10v-tdep.c
> --- d10v-tdep.c 18 Apr 2002 18:08:59 -0000      1.37
> +++ d10v-tdep.c 6 May 2002 02:14:28 -0000
> @@ -1486,7 +1486,7 @@
>    set_gdbarch_register_byte (gdbarch, d10v_register_byte);
>    set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size);
>    set_gdbarch_max_register_raw_size (gdbarch, 8);
> -  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
> +  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
>    set_gdbarch_max_register_virtual_size (gdbarch, 8);
>    set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type);
> 
> Index: gdbarch.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.c,v
> retrieving revision 1.122
> diff -u -r1.122 gdbarch.c
> --- gdbarch.c   3 May 2002 21:05:35 -0000       1.122
> +++ gdbarch.c   6 May 2002 02:14:38 -0000
> @@ -311,9 +311,9 @@
>    0,
>    0,
>    0,
> -  generic_register_raw_size,
> +  generic_register_size,
>    0,
> -  generic_register_virtual_size,
> +  generic_register_size,
>    0,
>    0,
>    0,
> @@ -475,7 +475,9 @@
>    current_gdbarch->register_name = legacy_register_name;
>    current_gdbarch->register_size = -1;
>    current_gdbarch->register_bytes = -1;
> +  current_gdbarch->register_raw_size = generic_register_size;
>    current_gdbarch->max_register_raw_size = -1;
> +  current_gdbarch->register_virtual_size = generic_register_size;
>    current_gdbarch->max_register_virtual_size = -1;
>    current_gdbarch->do_registers_info = do_registers_info;
>    current_gdbarch->print_float_info = default_print_float_info;
> @@ -611,15 +613,11 @@
>    if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
>        && (gdbarch->register_byte == 0))
>      fprintf_unfiltered (log, "\n\tregister_byte");
> -  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
> -      && (gdbarch->register_raw_size == 0))
> -    fprintf_unfiltered (log, "\n\tregister_raw_size");
> +  /* Skip verify of register_raw_size, invalid_p == 0 */
>    if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
>        && (gdbarch->max_register_raw_size == -1))
>      fprintf_unfiltered (log, "\n\tmax_register_raw_size");
> -  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
> -      && (gdbarch->register_virtual_size == 0))
> -    fprintf_unfiltered (log, "\n\tregister_virtual_size");
> +  /* Skip verify of register_virtual_size, invalid_p == 0 */
>    if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
>        && (gdbarch->max_register_virtual_size == -1))
>      fprintf_unfiltered (log, "\n\tmax_register_virtual_size");
> Index: gdbarch.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.h,v
> retrieving revision 1.91
> diff -u -r1.91 gdbarch.h
> --- gdbarch.h   24 Apr 2002 16:28:15 -0000      1.91
> +++ gdbarch.h   6 May 2002 02:14:44 -0000
> @@ -720,6 +720,11 @@
>  #endif
>  #endif
> 
> +/* Default (function) for non- multi-arch platforms. */
> +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
> +#define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr))
> +#endif
> +
>  typedef int (gdbarch_register_raw_size_ftype) (int reg_nr);
>  extern int gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr);
>  extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size);
> @@ -741,6 +746,11 @@
>  #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_RAW_SIZE)
>  #define MAX_REGISTER_RAW_SIZE (gdbarch_max_register_raw_size (current_gdbarch))
>  #endif
> +#endif
> +
> +/* Default (function) for non- multi-arch platforms. */
> +#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
> +#define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr))
>  #endif
> 
>  typedef int (gdbarch_register_virtual_size_ftype) (int reg_nr);
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.133
> diff -u -r1.133 gdbarch.sh
> --- gdbarch.sh  3 May 2002 21:05:36 -0000       1.133
> +++ gdbarch.sh  6 May 2002 02:14:47 -0000
> @@ -463,9 +463,9 @@
>  v:2:REGISTER_SIZE:int:register_size::::0:-1
>  v:2:REGISTER_BYTES:int:register_bytes::::0:-1
>  f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
> -f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0
> +f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
>  v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
> -f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_virtual_size:0
> +f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
>  v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
>  f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
>  f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
> Index: rs6000-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
> retrieving revision 1.63
> diff -u -r1.63 rs6000-tdep.c
> --- rs6000-tdep.c       30 Apr 2002 23:36:11 -0000      1.63
> +++ rs6000-tdep.c       6 May 2002 02:14:52 -0000
> @@ -2663,7 +2663,7 @@
>    set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
>    set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
>    set_gdbarch_max_register_raw_size (gdbarch, 16);
> -  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
> +  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
>    set_gdbarch_max_register_virtual_size (gdbarch, 16);
>    set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
>    set_gdbarch_do_registers_info (gdbarch, rs6000_do_registers_info);
> Index: x86-64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
> retrieving revision 1.16
> diff -u -r1.16 x86-64-tdep.c
> --- x86-64-tdep.c       3 May 2002 10:52:00 -0000       1.16
> +++ x86-64-tdep.c       6 May 2002 02:14:56 -0000
> @@ -998,7 +998,7 @@
>    for (i = 0, sum = 0; i < X86_64_NUM_REGS; i++)
>      sum += x86_64_register_info_table[i].size;
>    set_gdbarch_register_bytes (gdbarch, sum);
> -  set_gdbarch_register_virtual_size (gdbarch, generic_register_virtual_size);
> +  set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
>    set_gdbarch_max_register_virtual_size (gdbarch, 16);
> 
>    set_gdbarch_register_virtual_type (gdbarch, x86_64_register_virtual_type);
> Index: doc/ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
> retrieving revision 1.183
> diff -u -r1.183 ChangeLog
> --- doc/ChangeLog       4 May 2002 19:57:22 -0000       1.183
> +++ doc/ChangeLog       6 May 2002 02:15:03 -0000
> @@ -1,3 +1,10 @@
> +2002-05-05  Andrew Cagney  <ac131313@redhat.com>
> +
> +       * gdbint.texinfo (Target Architecture Definition): Mention
> +       defaults for REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE.
> +       (Target Architecture Definition): Mention same.  Add references to
> +       web pages.
> +
>  2002-05-04  Andrew Cagney  <ac131313@redhat.com>
> 
>         * gdbint.texinfo (Releasing GDB): Revise `Create a Release'.
> Index: doc/gdbint.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
> retrieving revision 1.81
> diff -u -r1.81 gdbint.texinfo
> --- doc/gdbint.texinfo  4 May 2002 19:57:22 -0000       1.81
> +++ doc/gdbint.texinfo  6 May 2002 02:15:29 -0000
> @@ -2496,8 +2496,13 @@
> 
>  @emph{Maintainer's note: The way GDB manipulates registers is undergoing
>  significant change.  Many of the macros and functions refered to in the
> -sections below are likely to be made obsolete.  See the file @file{TODO}
> -for more up-to-date information.}
> +section below are likely to be made obsolete.  For instance, instead of
> +having different raw and virtual register sizes, an architecture can
> +define pseudo-registers that map onto the raw registers.
> +
> +See the @uref{http://www.gnu.org/software/gdb/bugs/, Bug Tracking
> +Database} and @uref{http://sources.redhat.com/gdb/current/ari, ARI
> +Index} for more up-to-date information.}
> 
>  Some architectures use one representation for a value when it lives in a
>  register, but use a different representation when it lives in memory.
> @@ -3175,12 +3180,14 @@
> 
>  @item REGISTER_RAW_SIZE (@var{reg})
>  @findex REGISTER_RAW_SIZE
> -Return the raw size of @var{reg}.
> +Return the raw size of @var{reg}; defaults to the size of the register's
> +virtual type.
>  @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
> 
>  @item REGISTER_VIRTUAL_SIZE (@var{reg})
>  @findex REGISTER_VIRTUAL_SIZE
> -Return the virtual size of @var{reg}.
> +Return the virtual size of @var{reg}; defaults to the size of the
> +register's virtual type.
>  @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
> 
>  @item REGISTER_VIRTUAL_TYPE (@var{reg})


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE toregister_size
  2002-05-06 17:01 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE toregister_size Michael Snyder
@ 2002-05-06 17:17   ` Andrew Cagney
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2002-05-06 17:17 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Andrew Cagney wrote:
> 
>> 
>> Hello,
>> 
>> For most architectures.  The relationship:
>> 
>>         REGISTER_VIRTUAL_SIZE(N)
>>         == REGISTER_RAW_SIZE(N)
>>         == TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
>> 
>> (the exception is the @$(*&@(^$*&^!@ MIPS ...). 
> 
> 
> Surely this is also true for x87 regs?

Nope!  The i386 register is 80 bits.  When pushed on the stack, extra 
space is reserved to make it 4 byte aligned (96 bit) but the extra two 
bytes at the end don't get used.


>> Given this, the
>> attached patch changes the architecture vector so that it defaults both
>> to the register's type size.
>> 
>> I think this is the logical conclusion to MichaelS's earlier patch that
>> provided defaults to each.
>> 
>> Thoughts?  I'll look to commit it in a week.
> 
> 
> If I understand it, it won't affect any target that explicitly 
> sets these methods -- in which case I agree with the change.

Yes, it isn't ment to affect existing targets.  Up until now you were 
required to set the methods as otherwize GDB wouldn't build/run.

thanks for the comments,
Andrew




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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
                   ` (2 preceding siblings ...)
  2002-05-06 17:01 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE toregister_size Michael Snyder
@ 2002-05-07  3:21 ` Richard Earnshaw
  2002-05-07  8:50   ` Andrew Cagney
  2002-05-11 19:03 ` Andrew Cagney
  4 siblings, 1 reply; 13+ messages in thread
From: Richard Earnshaw @ 2002-05-07  3:21 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches, Richard.Earnshaw

> Hello,
> 
> For most architectures.  The relationship:
> 
> 	REGISTER_VIRTUAL_SIZE(N)
> 	== REGISTER_RAW_SIZE(N)
> 	== TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
> 
> (the exception is the @$(*&@(^$*&^!@ MIPS ...).  Given this, the 
> attached patch changes the architecture vector so that it defaults both 
> to the register's type size.

The ARM has REGISTER_VIRTUAL_SIZE(FPA-reg) == 8, but 
REGISTER_RAW_SIZE(FPA-reg) == 12.

But that doesn't necessarily make the change wrong, provided we can 
override the default.

R.


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-07  3:21 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Richard Earnshaw
@ 2002-05-07  8:50   ` Andrew Cagney
  2002-05-07  9:04     ` Richard Earnshaw
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cagney @ 2002-05-07  8:50 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb-patches

> Hello,
>> 
>> For most architectures.  The relationship:
>> 
>> 	REGISTER_VIRTUAL_SIZE(N)
>> 	== REGISTER_RAW_SIZE(N)
>> 	== TYPE_LENGTH(REGISTER_VIRTUAL_TYPE(N)
>> 
>> (the exception is the @$(*&@(^$*&^!@ MIPS ...).  Given this, the 
>> attached patch changes the architecture vector so that it defaults both 
>> to the register's type size.
> 
> 
> The ARM has REGISTER_VIRTUAL_SIZE(FPA-reg) == 8, but 
> REGISTER_RAW_SIZE(FPA-reg) == 12.
> 
> But that doesn't necessarily make the change wrong, provided we can 
> override the default.

Hmm, remember that think-o bug I posted?  ARM's register virtual type is:

   if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS)
     {
       if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
         return builtin_type_arm_ext_big;
       else
         return builtin_type_arm_ext_littlebyte_bigword;
     }

(i.e. 12 bytes) yet virtual size for those registers returns:

#define FP_REGISTER_VIRTUAL_SIZE        8

Outch!

Having different raw and virtual sizes only does something(1) when 
register_convertible() is defined - the Arm doesn't define this.

enjoy,
Andrew


(1) I'm not saying that what it does is useful though :-)



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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-07  8:50   ` Andrew Cagney
@ 2002-05-07  9:04     ` Richard Earnshaw
  2002-05-07 10:33       ` Andrew Cagney
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Earnshaw @ 2002-05-07  9:04 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches


ac131313@cygnus.com said:
> Hmm, remember that think-o bug I posted?  


Hmm, yes.  Do you remember promising to write some docs on how this was 
all supposed to work?

R.


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-07  9:04     ` Richard Earnshaw
@ 2002-05-07 10:33       ` Andrew Cagney
  2002-05-08  6:55         ` Richard Earnshaw
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cagney @ 2002-05-07 10:33 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb-patches

> ac131313@cygnus.com said:
> 
>> Hmm, remember that think-o bug I posted?  
> 
> 
> 
> Hmm, yes.  Do you remember promising to write some docs on how this was 
> all supposed to work?


Like:

   http://sources.redhat.com/gdb/onlinedocs/gdbint_9.html#SEC70

(which I didn't write). I've have just posted:

   http://sources.redhat.com/ml/gdb-patches/2002-05/msg00123.html

which, I think, fixes part of the doco.

enjoy,
Andrew



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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-07 10:33       ` Andrew Cagney
@ 2002-05-08  6:55         ` Richard Earnshaw
  2002-05-08  6:58           ` Andrew Cagney
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Earnshaw @ 2002-05-08  6:55 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches

> > ac131313@cygnus.com said:
> > 
> >> Hmm, remember that think-o bug I posted?  
> > 
> > 
> > 
> > Hmm, yes.  Do you remember promising to write some docs on how this was 
> > all supposed to work?
> 
> 
> Like:
> 
>    http://sources.redhat.com/gdb/onlinedocs/gdbint_9.html#SEC70
> 
> (which I didn't write). I've have just posted:
> 
>    http://sources.redhat.com/ml/gdb-patches/2002-05/msg00123.html
> 
> which, I think, fixes part of the doco.
> 

Ok, you win!

Actually, it was the regcache model that I was thinking about when I said 
that...  Sorry for confusing things.

  http://sources.redhat.com/ml/gdb/2002-02/msg00254.html
and

  http://sources.redhat.com/ml/gdb/2002-02/msg00255.html

where you said:

>  I'll try to  do the long (add to documentation answer, in about a
> week - this really  does need to be documented.

R




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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-08  6:55         ` Richard Earnshaw
@ 2002-05-08  6:58           ` Andrew Cagney
  2002-05-08  7:01             ` Richard Earnshaw
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cagney @ 2002-05-08  6:58 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb-patches


> Ok, you win!
> 
> Actually, it was the regcache model that I was thinking about when I said 
> that...  Sorry for confusing things.
> 
>   http://sources.redhat.com/ml/gdb/2002-02/msg00254.html
> and
> 
>   http://sources.redhat.com/ml/gdb/2002-02/msg00255.html
> 
> where you said:
> 
> 
>>  I'll try to  do the long (add to documentation answer, in about a
>> week - this really  does need to be documented.

Oops! Thanks for the reminder.  Lets call it a draw.  I was thinking of 
threads and/or frames next:

http://sources.redhat.com/gdb/onlinedocs/gdbint_3.html#SEC11
http://sources.redhat.com/gdb/onlinedocs/gdbint_3.html#SEC7

Andrew



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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and  REGISTER_RAW_SIZE to register_size
  2002-05-08  6:58           ` Andrew Cagney
@ 2002-05-08  7:01             ` Richard Earnshaw
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Earnshaw @ 2002-05-08  7:01 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches


> Oops! Thanks for the reminder.  Lets call it a draw.  I was thinking of 
> threads and/or frames next:
> 
> http://sources.redhat.com/gdb/onlinedocs/gdbint_3.html#SEC11
> http://sources.redhat.com/gdb/onlinedocs/gdbint_3.html#SEC7
> 

Well, I'd put regcache and frames well above threads in the order of 
must-haves for a working GDB.

R.


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

* Re: [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size
  2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
                   ` (3 preceding siblings ...)
  2002-05-07  3:21 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Richard Earnshaw
@ 2002-05-11 19:03 ` Andrew Cagney
  4 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2002-05-11 19:03 UTC (permalink / raw)
  To: gdb-patches

Thanks for all the comments!  I've now checked it in.

Andrew

> +
> +	* gdbint.texinfo (Target Architecture Definition): Mention
> +	defaults for REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE.
> +	(Target Architecture Definition): Mention same.  Add references to
> +	web pages.
> +

> 	* arch-utils.h (generic_register_size): Declare.
> 	(generic_register_raw_size, generic_register_virtual_size): Delete
> 	declarations.
> 	* arch-utils.c (generic_register_raw_size): Delete.
> 	(generic_register_size): New function.
> 	(generic_register_virtual_size): Delete.
> 
> 	* gdbarch.sh (REGISTER_RAW_SIZE, REGISTER_VIRTUAL_SIZE): Make
> 	default generic_register_size.
> 	* gdbarch.h, gdbarch.c: Re-generate.
> 	
> 	* d10v-tdep.c (d10v_gdbarch_init): Use generic_register_size for
> 	register_virtual_size.
> 	* x86-64-tdep.c (x86_64_gdbarch_init): Ditto.
> 	* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
> 




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

end of thread, other threads:[~2002-05-12  2:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-05 19:28 [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Andrew Cagney
2002-05-05 22:17 ` Eli Zaretskii
2002-05-06 13:38 ` Kevin Buettner
2002-05-06 17:01 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE toregister_size Michael Snyder
2002-05-06 17:17   ` Andrew Cagney
2002-05-07  3:21 ` [patch/rfc] default REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE to register_size Richard Earnshaw
2002-05-07  8:50   ` Andrew Cagney
2002-05-07  9:04     ` Richard Earnshaw
2002-05-07 10:33       ` Andrew Cagney
2002-05-08  6:55         ` Richard Earnshaw
2002-05-08  6:58           ` Andrew Cagney
2002-05-08  7:01             ` Richard Earnshaw
2002-05-11 19:03 ` Andrew Cagney

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