Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] 32/64 mistake in mips_find_saved_regs
@ 2002-08-05 22:06 Michael Snyder
  2002-08-06 13:26 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-08-05 22:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: cagney, kevinb

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

Here is a test that should check for stack/register size, not
whether target == mips64.

Fixes four failures in callfuncs.exp, no other regressions.

[-- Attachment #2: patch2.diff --]
[-- Type: text/plain, Size: 1332 bytes --]

2002-08-05  Michael Snyder  <msnyder@redhat.com>

	*  mips-tdep.c (mips_find_saved_regs): Adjust stack according
	to MIPS_SAVED_REGSIZE, not GDB_TARGET_IS_MIPS64.  N32 is not
	MIPS64, but it does save 64 bits worth of register.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.88
diff -p -r1.88 mips-tdep.c
*** mips-tdep.c	1 Aug 2002 23:10:34 -0000	1.88
--- mips-tdep.c	6 Aug 2002 04:32:33 -0000
*************** mips_find_saved_regs (struct frame_info 
*** 1371,1379 ****
       were saved.  */
    reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
  
!   /* The freg_offset points to where the first *double* register
!      is saved.  So skip to the high-order word. */
!   if (!GDB_TARGET_IS_MIPS64)
      reg_position += MIPS_SAVED_REGSIZE;
  
    /* Fill in the offsets for the float registers which float_mask says
--- 1371,1379 ----
       were saved.  */
    reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
  
!   /* The freg_offset points to where the first *double* register is
!      saved.  So skip to the high-order word if saved_reg_size == 4. */
!   if (MIPS_SAVED_REGSIZE == 4)
      reg_position += MIPS_SAVED_REGSIZE;
  
    /* Fill in the offsets for the float registers which float_mask says

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

* Re: [RFA] 32/64 mistake in mips_find_saved_regs
  2002-08-05 22:06 [RFA] 32/64 mistake in mips_find_saved_regs Michael Snyder
@ 2002-08-06 13:26 ` Andrew Cagney
  2002-08-06 16:23   ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-08-06 13:26 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

I believe n32 should be setting mips64 to 1.  Can you please change that. .

As for the below, yes ok.  Can you please also update the comment to 
read something like:

``[Apparently] The freg_offset gives the offset to the first 64 bit saved.

When the ABI specifies 64 bit saved registers, the FREG_OFFSET 
designates the first saved 64 bit register.

When the ABI specifies 32 bit saved registers, the ``64 bit saved 
DOUBLE'' consists of two adjacent 32 bit registers,  Hence FREG_OFFSET, 
designates the address of the lower register of the register pair. 
Adjust the offset so that it designates the upper register of the pair 
-- i.e., the address of the first saved 32 bit register.''

I think that is more correct.

Andrew

> Here is a test that should check for stack/register size, not
> whether target == mips64.
> 
> Fixes four failures in callfuncs.exp, no other regressions.
> 
> 
> 
> 2002-08-05  Michael Snyder  <msnyder@redhat.com>
> 
> 	*  mips-tdep.c (mips_find_saved_regs): Adjust stack according
> 	to MIPS_SAVED_REGSIZE, not GDB_TARGET_IS_MIPS64.  N32 is not
> 	MIPS64, but it does save 64 bits worth of register.
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.88
> diff -p -r1.88 mips-tdep.c
> *** mips-tdep.c	1 Aug 2002 23:10:34 -0000	1.88
> --- mips-tdep.c	6 Aug 2002 04:32:33 -0000
> *************** mips_find_saved_regs (struct frame_info 
> *** 1371,1379 ****
>        were saved.  */
>     reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
>   
> !   /* The freg_offset points to where the first *double* register
> !      is saved.  So skip to the high-order word. */
> !   if (!GDB_TARGET_IS_MIPS64)
>       reg_position += MIPS_SAVED_REGSIZE;
>   
>     /* Fill in the offsets for the float registers which float_mask says
> --- 1371,1379 ----
>        were saved.  */
>     reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
>   
> !   /* The freg_offset points to where the first *double* register is
> !      saved.  So skip to the high-order word if saved_reg_size == 4. */
> !   if (MIPS_SAVED_REGSIZE == 4)
>       reg_position += MIPS_SAVED_REGSIZE;
>   
>     /* Fill in the offsets for the float registers which float_mask says



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

* Re: [RFA] 32/64 mistake in mips_find_saved_regs
  2002-08-06 13:26 ` Andrew Cagney
@ 2002-08-06 16:23   ` Michael Snyder
  2002-08-06 17:27     ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-08-06 16:23 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> I believe n32 should be setting mips64 to 1.  Can you please change that. .

Really?  So you think mips64 specifies 64-bit registers, rather than
64 bit addresses?  I'll try the change, and see what happens.

> As for the below, yes ok.  Can you please also update the comment to
> read something like:
> 
> ``[Apparently] The freg_offset gives the offset to the first 64 bit saved.
> 
> When the ABI specifies 64 bit saved registers, the FREG_OFFSET
> designates the first saved 64 bit register.
> 
> When the ABI specifies 32 bit saved registers, the ``64 bit saved
> DOUBLE'' consists of two adjacent 32 bit registers,  Hence FREG_OFFSET,
> designates the address of the lower register of the register pair.
> Adjust the offset so that it designates the upper register of the pair
> -- i.e., the address of the first saved 32 bit register.''
> 
> I think that is more correct.

Will do.

> 
> Andrew
> 
> > Here is a test that should check for stack/register size, not
> > whether target == mips64.
> >
> > Fixes four failures in callfuncs.exp, no other regressions.
> >
> >
> >
> > 2002-08-05  Michael Snyder  <msnyder@redhat.com>
> >
> >       *  mips-tdep.c (mips_find_saved_regs): Adjust stack according
> >       to MIPS_SAVED_REGSIZE, not GDB_TARGET_IS_MIPS64.  N32 is not
> >       MIPS64, but it does save 64 bits worth of register.
> >
> > Index: mips-tdep.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> > retrieving revision 1.88
> > diff -p -r1.88 mips-tdep.c
> > *** mips-tdep.c       1 Aug 2002 23:10:34 -0000       1.88
> > --- mips-tdep.c       6 Aug 2002 04:32:33 -0000
> > *************** mips_find_saved_regs (struct frame_info
> > *** 1371,1379 ****
> >        were saved.  */
> >     reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
> >
> > !   /* The freg_offset points to where the first *double* register
> > !      is saved.  So skip to the high-order word. */
> > !   if (!GDB_TARGET_IS_MIPS64)
> >       reg_position += MIPS_SAVED_REGSIZE;
> >
> >     /* Fill in the offsets for the float registers which float_mask says
> > --- 1371,1379 ----
> >        were saved.  */
> >     reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
> >
> > !   /* The freg_offset points to where the first *double* register is
> > !      saved.  So skip to the high-order word if saved_reg_size == 4. */
> > !   if (MIPS_SAVED_REGSIZE == 4)
> >       reg_position += MIPS_SAVED_REGSIZE;
> >
> >     /* Fill in the offsets for the float registers which float_mask says


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

* Re: [RFA] 32/64 mistake in mips_find_saved_regs
  2002-08-06 16:23   ` Michael Snyder
@ 2002-08-06 17:27     ` Michael Snyder
  2002-08-07  8:32       ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-08-06 17:27 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches

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

Michael Snyder wrote:
> 
> Andrew Cagney wrote:
> >
> > I believe n32 should be setting mips64 to 1.  Can you please change that. .
> 
> Really?  So you think mips64 specifies 64-bit registers, rather than
> 64 bit addresses?  I'll try the change, and see what happens.

Well, this caused no regressions, so I'll commit it along with the rest.

> > As for the below, yes ok.  Can you please also update the comment to
> > read something like:

Committed in modified form, as follows:

[-- Attachment #2: patch2a.diff --]
[-- Type: text/plain, Size: 2537 bytes --]

2002-08-05  Michael Snyder  <msnyder@redhat.com>

	*  mips-tdep.c (mips_find_saved_regs): Adjust stack according
	to MIPS_SAVED_REGSIZE, not GDB_TARGET_IS_MIPS64.  Enhance comment.
	(mips_gdbarch_init): Set N32 target to be mips64.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.89
diff -p -r1.89 mips-tdep.c
*** mips-tdep.c	6 Aug 2002 19:03:40 -0000	1.89
--- mips-tdep.c	7 Aug 2002 00:26:15 -0000
*************** mips_find_saved_regs (struct frame_info 
*** 1371,1379 ****
       were saved.  */
    reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
  
!   /* The freg_offset points to where the first *double* register
!      is saved.  So skip to the high-order word. */
!   if (!GDB_TARGET_IS_MIPS64)
      reg_position += MIPS_SAVED_REGSIZE;
  
    /* Fill in the offsets for the float registers which float_mask says
--- 1371,1390 ----
       were saved.  */
    reg_position = fci->frame + PROC_FREG_OFFSET (proc_desc);
  
!   /* Apparently, the freg_offset gives the offset to the first 64 bit
!      saved.
! 
!      When the ABI specifies 64 bit saved registers, the FREG_OFFSET
!      designates the first saved 64 bit register.
! 
!      When the ABI specifies 32 bit saved registers, the ``64 bit saved
!      DOUBLE'' consists of two adjacent 32 bit registers, Hence
!      FREG_OFFSET, designates the address of the lower register of the
!      register pair.  Adjust the offset so that it designates the upper
!      register of the pair -- i.e., the address of the first saved 32
!      bit register.  */
! 
!   if (MIPS_SAVED_REGSIZE == 4)
      reg_position += MIPS_SAVED_REGSIZE;
  
    /* Fill in the offsets for the float registers which float_mask says
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4525,4531 ****
        tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
        tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
        tdep->mips_regs_have_home_p = 0;
!       tdep->gdb_target_is_mips64 = 0;
        tdep->default_mask_address_p = 0;
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);
--- 4536,4542 ----
        tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
        tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
        tdep->mips_regs_have_home_p = 0;
!       tdep->gdb_target_is_mips64 = 1;
        tdep->default_mask_address_p = 0;
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);

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

* Re: [RFA] 32/64 mistake in mips_find_saved_regs
  2002-08-06 17:27     ` Michael Snyder
@ 2002-08-07  8:32       ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-08-07  8:32 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> Michael Snyder wrote:
> 
>> 
>> Andrew Cagney wrote:
> 
>> >
>> > I believe n32 should be setting mips64 to 1.  Can you please change that. .
> 
>> 
>> Really?  So you think mips64 specifies 64-bit registers, rather than
>> 64 bit addresses?  I'll try the change, and see what happens.
> 
> 
> Well, this caused no regressions, so I'll commit it along with the rest.

I didn't expect it to cause regressions :-)  There is only one reference 
to MIPS64 left and that applies to n32 being run in a 64 bit environment.

>> > As for the below, yes ok.  Can you please also update the comment to
>> > read something like:
> 
> 
> Committed in modified form, as follows:

Thanks!
Andrew



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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-05 22:06 [RFA] 32/64 mistake in mips_find_saved_regs Michael Snyder
2002-08-06 13:26 ` Andrew Cagney
2002-08-06 16:23   ` Michael Snyder
2002-08-06 17:27     ` Michael Snyder
2002-08-07  8:32       ` Andrew Cagney

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