Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Improvements for sh double register display
@ 2003-07-02 18:01 Michael Snyder
  2003-07-15 19:13 ` Elena Zannoni
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2003-07-02 18:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: ezannoni

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



[-- Attachment #2: sh-tdep --]
[-- Type: text/plain, Size: 2090 bytes --]

2003-07-02  Michael Snyder  <msnyder@redhat.com>

	* sh-tdep.c (do_dr_register_info): Fix register number output
	(0, 2, 4, ... not 0, 1, 2...).  Display DP register both in
	hex and in floating point (noting when it is not valid FP).

Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.132
diff -p -r1.132 sh-tdep.c
*** sh-tdep.c	13 Jun 2003 04:40:34 -0000	1.132
--- sh-tdep.c	2 Jul 2003 18:00:22 -0000
*************** static void
*** 3928,3938 ****
  do_dr_register_info (int dr_regnum)
  {
    int first_fp_reg_num = dr_reg_base_num (dr_regnum);
  
!   printf_filtered ("dr%d\t0x%08x%08x\n", 
! 		    dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, 
! 		    (int) read_register (first_fp_reg_num),
! 		    (int) read_register (first_fp_reg_num + 1));
  }
  
  /* Double precision registers, compact mode. */
--- 3928,3962 ----
  do_dr_register_info (int dr_regnum)
  {
    int first_fp_reg_num = dr_reg_base_num (dr_regnum);
+   char *raw_buffer;
+   double dbl;
+   int inv;
  
!   /* Allocate space for the float. */
!   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
! 
!   /* Get the data in raw format.  */
!   if (!frame_register_read (get_selected_frame (), 
! 			    first_fp_reg_num, raw_buffer)
!       || !frame_register_read (get_selected_frame (), 
! 			       first_fp_reg_num + 1, 
! 			       raw_buffer + REGISTER_RAW_SIZE (FP0_REGNUM)))
!     error ("can't read register %d (%s)", 
! 	   dr_regnum, REGISTER_NAME (dr_regnum));
! 
!   /* Get the register as a number */ 
!   dbl = unpack_double (builtin_type_double, raw_buffer, &inv);
! 
!   dr_regnum = 2 * (dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM);
!   printf_filtered ("dr%d\t0x%08x%08x  ", 
! 		   dr_regnum,
! 		   (int) read_register (first_fp_reg_num),
! 		   (int) read_register (first_fp_reg_num + 1));
! 
!   if (inv)
!     printf_filtered ("<invalid double>\n");
!   else
!     printf_filtered ("(%.9g)\n", dbl);
  }
  
  /* Double precision registers, compact mode. */

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

* Re: [RFA] Improvements for sh double register display
  2003-07-02 18:01 [RFA] Improvements for sh double register display Michael Snyder
@ 2003-07-15 19:13 ` Elena Zannoni
  2003-07-15 19:56   ` Andrew Cagney
  2003-07-15 22:34   ` Michael Snyder
  0 siblings, 2 replies; 7+ messages in thread
From: Elena Zannoni @ 2003-07-15 19:13 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, ezannoni

Michael Snyder writes:
 > 2003-07-02  Michael Snyder  <msnyder@redhat.com>
 > 
 > 	* sh-tdep.c (do_dr_register_info): Fix register number output
 > 	(0, 2, 4, ... not 0, 1, 2...).  Display DP register both in
 > 	hex and in floating point (noting when it is not valid FP).
 > 
 > Index: sh-tdep.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/sh-tdep.c,v
 > retrieving revision 1.132
 > diff -p -r1.132 sh-tdep.c
 > *** sh-tdep.c	13 Jun 2003 04:40:34 -0000	1.132
 > --- sh-tdep.c	2 Jul 2003 18:00:22 -0000
 > *************** static void
 > *** 3928,3938 ****
 >   do_dr_register_info (int dr_regnum)
 >   {
 >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
 >   
 > !   printf_filtered ("dr%d\t0x%08x%08x\n", 
 > ! 		    dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, 
 > ! 		    (int) read_register (first_fp_reg_num),
 > ! 		    (int) read_register (first_fp_reg_num + 1));
 >   }
 >   
 >   /* Double precision registers, compact mode. */
 > --- 3928,3962 ----
 >   do_dr_register_info (int dr_regnum)
 >   {
 >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
 > +   char *raw_buffer;
 > +   double dbl;
 > +   int inv;
 >   
 > !   /* Allocate space for the float. */
 > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));

Can you use something other than alloca here? Also, this will collide
in mid air with Corinna's revamp. Maybe you can revisit this after she
is done? Otherwise it's ok.

elena

 > ! 
 > !   /* Get the data in raw format.  */
 > !   if (!frame_register_read (get_selected_frame (), 
 > ! 			    first_fp_reg_num, raw_buffer)
 > !       || !frame_register_read (get_selected_frame (), 
 > ! 			       first_fp_reg_num + 1, 
 > ! 			       raw_buffer + REGISTER_RAW_SIZE (FP0_REGNUM)))
 > !     error ("can't read register %d (%s)", 
 > ! 	   dr_regnum, REGISTER_NAME (dr_regnum));
 > ! 
 > !   /* Get the register as a number */ 
 > !   dbl = unpack_double (builtin_type_double, raw_buffer, &inv);
 > ! 
 > !   dr_regnum = 2 * (dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM);
 > !   printf_filtered ("dr%d\t0x%08x%08x  ", 
 > ! 		   dr_regnum,
 > ! 		   (int) read_register (first_fp_reg_num),
 > ! 		   (int) read_register (first_fp_reg_num + 1));
 > ! 
 > !   if (inv)
 > !     printf_filtered ("<invalid double>\n");
 > !   else
 > !     printf_filtered ("(%.9g)\n", dbl);
 >   }
 >   
 >   /* Double precision registers, compact mode. */


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

* Re: [RFA] Improvements for sh double register display
  2003-07-15 19:13 ` Elena Zannoni
@ 2003-07-15 19:56   ` Andrew Cagney
  2003-07-15 22:35     ` Michael Snyder
  2003-07-15 22:34   ` Michael Snyder
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-07-15 19:56 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: Michael Snyder, gdb-patches, ezannoni

>  > +   char *raw_buffer;
>  > +   double dbl;
>  > +   int inv;
>  >   
>  > !   /* Allocate space for the float. */
>  > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
> 
> Can you use something other than alloca here? Also, this will collide
> in mid air with Corinna's revamp. Maybe you can revisit this after she
> is done? Otherwise it's ok.

Something like:

	char raw_buffer[MAX_REGISTER_SIZE * 2];

will do the trick.

Andrew



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

* Re: [RFA] Improvements for sh double register display
  2003-07-15 19:13 ` Elena Zannoni
  2003-07-15 19:56   ` Andrew Cagney
@ 2003-07-15 22:34   ` Michael Snyder
  2003-07-16  9:51     ` Corinna Vinschen
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2003-07-15 22:34 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches, ezannoni, vinschen >> Corinna Vinschen

Elena Zannoni wrote:
> Michael Snyder writes:
>  > 2003-07-02  Michael Snyder  <msnyder@redhat.com>
>  > 
>  > 	* sh-tdep.c (do_dr_register_info): Fix register number output
>  > 	(0, 2, 4, ... not 0, 1, 2...).  Display DP register both in
>  > 	hex and in floating point (noting when it is not valid FP).
>  > 
>  > Index: sh-tdep.c
>  > ===================================================================
>  > RCS file: /cvs/src/src/gdb/sh-tdep.c,v
>  > retrieving revision 1.132
>  > diff -p -r1.132 sh-tdep.c
>  > *** sh-tdep.c	13 Jun 2003 04:40:34 -0000	1.132
>  > --- sh-tdep.c	2 Jul 2003 18:00:22 -0000
>  > *************** static void
>  > *** 3928,3938 ****
>  >   do_dr_register_info (int dr_regnum)
>  >   {
>  >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
>  >   
>  > !   printf_filtered ("dr%d\t0x%08x%08x\n", 
>  > ! 		    dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, 
>  > ! 		    (int) read_register (first_fp_reg_num),
>  > ! 		    (int) read_register (first_fp_reg_num + 1));
>  >   }
>  >   
>  >   /* Double precision registers, compact mode. */
>  > --- 3928,3962 ----
>  >   do_dr_register_info (int dr_regnum)
>  >   {
>  >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
>  > +   char *raw_buffer;
>  > +   double dbl;
>  > +   int inv;
>  >   
>  > !   /* Allocate space for the float. */
>  > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
> 
> Can you use something other than alloca here? Also, this will collide
> in mid air with Corinna's revamp. Maybe you can revisit this after she
> is done? Otherwise it's ok.

OK, I'll touch space-helmets with Corinna.
BTW, what's wrong with alloca?



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

* Re: [RFA] Improvements for sh double register display
  2003-07-15 19:56   ` Andrew Cagney
@ 2003-07-15 22:35     ` Michael Snyder
  2003-07-16  2:33       ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2003-07-15 22:35 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
>>  > +   char *raw_buffer;
>>  > +   double dbl;
>>  > +   int inv;
>>  >    > !   /* Allocate space for the float. */
>>  > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
>>
>> Can you use something other than alloca here? Also, this will collide
>> in mid air with Corinna's revamp. Maybe you can revisit this after she
>> is done? Otherwise it's ok.
> 
> 
> Something like:
> 
>     char raw_buffer[MAX_REGISTER_SIZE * 2];
> 
> will do the trick.


Wah -- didn't we just go to a bunch of trouble to get rid of those?
By "just", I suppose I mean a year or two ago...






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

* Re: [RFA] Improvements for sh double register display
  2003-07-15 22:35     ` Michael Snyder
@ 2003-07-16  2:33       ` Andrew Cagney
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2003-07-16  2:33 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Andrew Cagney wrote:
>  > +   char *raw_buffer;
>  > +   double dbl;
>  > +   int inv;
>  >    > !   /* Allocate space for the float. */
>  > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
> 
> Can you use something other than alloca here? Also, this will collide
> in mid air with Corinna's revamp. Maybe you can revisit this after she
> is done? Otherwise it's ok.
> 
> 
> Something like:
> 
>     char raw_buffer[MAX_REGISTER_SIZE * 2];
> 
> will do the trick.
> 
> 
> Wah -- didn't we just go to a bunch of trouble to get rid of those?
> By "just", I suppose I mean a year or two ago...

Well four years ago. When MAX_REGISTER_RAW_SIZE et.al. were switched to 
variables, the arrays were replaced with alloca.  However, now that the 
codes been cleaned up a lot, it's become clear that a simple 
MAX_REGISTER_SIZE constant is sufficient for many tasks.
http://sources.redhat.com/ml/gdb/2003-04/msg00014.html

Andrew



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

* Re: [RFA] Improvements for sh double register display
  2003-07-15 22:34   ` Michael Snyder
@ 2003-07-16  9:51     ` Corinna Vinschen
  0 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2003-07-16  9:51 UTC (permalink / raw)
  To: gdb-patches

On Tue, Jul 15, 2003 at 03:33:57PM -0700, Michael Snyder wrote:
> Elena Zannoni wrote:
> >Michael Snyder writes:
> > > 2003-07-02  Michael Snyder  <msnyder@redhat.com>
> > > 
> > > 	* sh-tdep.c (do_dr_register_info): Fix register number output
> > > 	(0, 2, 4, ... not 0, 1, 2...).  Display DP register both in
> > > 	hex and in floating point (noting when it is not valid FP).
> > > 
> > > Index: sh-tdep.c
> > > ===================================================================
> > > RCS file: /cvs/src/src/gdb/sh-tdep.c,v
> > > retrieving revision 1.132
> > > diff -p -r1.132 sh-tdep.c
> > > *** sh-tdep.c	13 Jun 2003 04:40:34 -0000	1.132
> > > --- sh-tdep.c	2 Jul 2003 18:00:22 -0000
> > > *************** static void
> > > *** 3928,3938 ****
> > >   do_dr_register_info (int dr_regnum)
> > >   {
> > >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
> > >   
> > > !   printf_filtered ("dr%d\t0x%08x%08x\n", 
> > > ! 		    dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, 
> > > ! 		    (int) read_register (first_fp_reg_num),
> > > ! 		    (int) read_register (first_fp_reg_num + 1));
> > >   }
> > >   
> > >   /* Double precision registers, compact mode. */
> > > --- 3928,3962 ----
> > >   do_dr_register_info (int dr_regnum)
> > >   {
> > >     int first_fp_reg_num = dr_reg_base_num (dr_regnum);
> > > +   char *raw_buffer;
> > > +   double dbl;
> > > +   int inv;
> > >   
> > > !   /* Allocate space for the float. */
> > > !   raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
> >
> >Can you use something other than alloca here? Also, this will collide
> >in mid air with Corinna's revamp. Maybe you can revisit this after she
> >is done? Otherwise it's ok.
> 
> OK, I'll touch space-helmets with Corinna.
> BTW, what's wrong with alloca?

Since I've applied my patch, that should be ok now.
Btw., REGISTER_RAW_SIZE isn't implemented on sh anymore ;-)

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


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

end of thread, other threads:[~2003-07-16  9:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02 18:01 [RFA] Improvements for sh double register display Michael Snyder
2003-07-15 19:13 ` Elena Zannoni
2003-07-15 19:56   ` Andrew Cagney
2003-07-15 22:35     ` Michael Snyder
2003-07-16  2:33       ` Andrew Cagney
2003-07-15 22:34   ` Michael Snyder
2003-07-16  9:51     ` Corinna Vinschen

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