Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] infcmd.c print vector registers in hex only
@ 2002-08-18 20:07 Elena Zannoni
  2002-08-20  7:36 ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2002-08-18 20:07 UTC (permalink / raw)
  To: gdb-patches


Doing this simplification allows to get rid of a function (for now,
more later) in rs6000-tdep.c. Such function is entirely a duplicate of
do_registers_info, except for this patch.

The reason behind this is that vector registers use up a lot of
screen real estate, especially the 128 bit ones (altivec registers).

Elena

2002-08-18  Elena Zannoni  <ezannoni@redhat.com>

	* infcmd.c (do_registers_info): Print vector registers in hex
	format only.

Index: infcmd.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infcmd.c,v
retrieving revision 1.52
diff -u -p -r1.52 infcmd.c
--- infcmd.c	16 Aug 2002 00:27:45 -0000	1.52
+++ infcmd.c	19 Aug 2002 02:51:16 -0000
@@ -1632,14 +1632,18 @@ do_registers_info (int regnum, int print
 	    }
 	  printf_filtered (")");
 	}
-      /* Else print as integer in hex and in decimal.  */
       else
 	{
+	  /* Print the register in hex.  */
 	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 		     gdb_stdout, 'x', 1, 0, Val_pretty_default);
-	  printf_filtered ("\t");
-	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-		     gdb_stdout, 0, 1, 0, Val_pretty_default);
+          /* If not a vector register, print it also in decimal.  */
+	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+	    {
+	      printf_filtered ("\t");
+	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+			 gdb_stdout, 0, 1, 0, Val_pretty_default);
+	    }
 	}
 
       /* The SPARC wants to print even-numbered float regs as doubles


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

* Re: [RFA] infcmd.c print vector registers in hex only
  2002-08-18 20:07 [RFA] infcmd.c print vector registers in hex only Elena Zannoni
@ 2002-08-20  7:36 ` Elena Zannoni
  2002-08-20  8:04   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2002-08-20  7:36 UTC (permalink / raw)
  To: gdb-patches

Elena Zannoni writes:
 > 
 > Doing this simplification allows to get rid of a function (for now,
 > more later) in rs6000-tdep.c. Such function is entirely a duplicate of
 > do_registers_info, except for this patch.
 > 
 > The reason behind this is that vector registers use up a lot of
 > screen real estate, especially the 128 bit ones (altivec registers).
 > 
 > Elena
 > 

To clarify:
With this patch each register is printed like this:
(gdb) info reg vr0
vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
    0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}}

while w/o the patch:
(gdb) info reg vr0
vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
    0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}} {
  uint128 = 0x00000000000000000000000000000000, v4_float = {0, 0, 0, 0}, 
  v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
  v16_int8 = '\0' <repeats 15 times>}


I will check this in later today, if there are no objections.

Elena


 > 2002-08-18  Elena Zannoni  <ezannoni@redhat.com>
 > 
 > 	* infcmd.c (do_registers_info): Print vector registers in hex
 > 	format only.
 > 
 > Index: infcmd.c
 > ===================================================================
 > RCS file: /cvs/uberbaum/gdb/infcmd.c,v
 > retrieving revision 1.52
 > diff -u -p -r1.52 infcmd.c
 > --- infcmd.c	16 Aug 2002 00:27:45 -0000	1.52
 > +++ infcmd.c	19 Aug 2002 02:51:16 -0000
 > @@ -1632,14 +1632,18 @@ do_registers_info (int regnum, int print
 >  	    }
 >  	  printf_filtered (")");
 >  	}
 > -      /* Else print as integer in hex and in decimal.  */
 >        else
 >  	{
 > +	  /* Print the register in hex.  */
 >  	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 >  		     gdb_stdout, 'x', 1, 0, Val_pretty_default);
 > -	  printf_filtered ("\t");
 > -	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 > -		     gdb_stdout, 0, 1, 0, Val_pretty_default);
 > +          /* If not a vector register, print it also in decimal.  */
 > +	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
 > +	    {
 > +	      printf_filtered ("\t");
 > +	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 > +			 gdb_stdout, 0, 1, 0, Val_pretty_default);
 > +	    }
 >  	}
 >  
 >        /* The SPARC wants to print even-numbered float regs as doubles


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

* Re: [RFA] infcmd.c print vector registers in hex only
  2002-08-20  7:36 ` Elena Zannoni
@ 2002-08-20  8:04   ` Andrew Cagney
  2002-08-20  9:32     ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-08-20  8:04 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

> Elena Zannoni writes:
>  > 
>  > Doing this simplification allows to get rid of a function (for now,
>  > more later) in rs6000-tdep.c. Such function is entirely a duplicate of
>  > do_registers_info, except for this patch.
>  > 
>  > The reason behind this is that vector registers use up a lot of
>  > screen real estate, especially the 128 bit ones (altivec registers).
>  > 
>  > Elena
>  > 
> 
> To clarify:
> With this patch each register is printed like this:
> (gdb) info reg vr0
> vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
>     0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
>     0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}}
> 
> while w/o the patch:
> (gdb) info reg vr0
> vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
>     0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
>     0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}} {
>   uint128 = 0x00000000000000000000000000000000, v4_float = {0, 0, 0, 0}, 
>   v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
>   v16_int8 = '\0' <repeats 15 times>}

Er, yes.  The old style just looks silly :-)


>  > +	  /* Print the register in hex.  */
>  >  	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
>  >  		     gdb_stdout, 'x', 1, 0, Val_pretty_default);
>  > -	  printf_filtered ("\t");
>  > -	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
>  > -		     gdb_stdout, 0, 1, 0, Val_pretty_default);
>  > +          /* If not a vector register, print it also in decimal.  */
>  > +	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
>  > +	    {
>  > +	      printf_filtered ("\t");
>  > +	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
>  > +			 gdb_stdout, 0, 1, 0, Val_pretty_default);
>  > +	    }

The (old) comment should probably, also, be fixed.  That isn't printing 
the value in decimal.

enjoy,
Andrew



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

* Re: [RFA] infcmd.c print vector registers in hex only
  2002-08-20  8:04   ` Andrew Cagney
@ 2002-08-20  9:32     ` Elena Zannoni
  0 siblings, 0 replies; 4+ messages in thread
From: Elena Zannoni @ 2002-08-20  9:32 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney writes:
 > > Elena Zannoni writes:
 > >  > 
 > >  > Doing this simplification allows to get rid of a function (for now,
 > >  > more later) in rs6000-tdep.c. Such function is entirely a duplicate of
 > >  > do_registers_info, except for this patch.
 > >  > 
 > >  > The reason behind this is that vector registers use up a lot of
 > >  > screen real estate, especially the 128 bit ones (altivec registers).
 > >  > 
 > >  > Elena
 > >  > 
 > > 
 > > To clarify:
 > > With this patch each register is printed like this:
 > > (gdb) info reg vr0
 > > vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
 > >     0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
 > >     0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}}
 > > 
 > > while w/o the patch:
 > > (gdb) info reg vr0
 > > vr0            {uint128 = 0x00000000000000000000000000000000, v4_float = {0x0, 
 > >     0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 
 > >     0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}} {
 > >   uint128 = 0x00000000000000000000000000000000, v4_float = {0, 0, 0, 0}, 
 > >   v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
 > >   v16_int8 = '\0' <repeats 15 times>}
 > 
 > Er, yes.  The old style just looks silly :-)
 > 
 > 
 > >  > +	  /* Print the register in hex.  */
 > >  >  	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 > >  >  		     gdb_stdout, 'x', 1, 0, Val_pretty_default);
 > >  > -	  printf_filtered ("\t");
 > >  > -	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 > >  > -		     gdb_stdout, 0, 1, 0, Val_pretty_default);
 > >  > +          /* If not a vector register, print it also in decimal.  */
 > >  > +	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
 > >  > +	    {
 > >  > +	      printf_filtered ("\t");
 > >  > +	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 > >  > +			 gdb_stdout, 0, 1, 0, Val_pretty_default);
 > >  > +	    }
 > 
 > The (old) comment should probably, also, be fixed.  That isn't printing 
 > the value in decimal.
 > 


Ok. I committed the following:

Index: infcmd.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infcmd.c,v
retrieving revision 1.52
diff -u -p -r1.52 infcmd.c
--- infcmd.c	16 Aug 2002 00:27:45 -0000	1.52
+++ infcmd.c	20 Aug 2002 16:28:11 -0000
@@ -1632,14 +1632,19 @@ do_registers_info (int regnum, int print
 	    }
 	  printf_filtered (")");
 	}
-      /* Else print as integer in hex and in decimal.  */
       else
 	{
+	  /* Print the register in hex.  */
 	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
 		     gdb_stdout, 'x', 1, 0, Val_pretty_default);
-	  printf_filtered ("\t");
-	  val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-		     gdb_stdout, 0, 1, 0, Val_pretty_default);
+          /* If not a vector register, print it also according to its
+             natural format.  */
+	  if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+	    {
+	      printf_filtered ("\t");
+	      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+			 gdb_stdout, 0, 1, 0, Val_pretty_default);
+	    }
 	}
 
       /* The SPARC wants to print even-numbered float regs as doubles





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

end of thread, other threads:[~2002-08-20 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-18 20:07 [RFA] infcmd.c print vector registers in hex only Elena Zannoni
2002-08-20  7:36 ` Elena Zannoni
2002-08-20  8:04   ` Andrew Cagney
2002-08-20  9:32     ` Elena Zannoni

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