Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] mips_extract_struct_return_value: use saved regcache
@ 2002-09-05 11:30 Michael Snyder
  2002-09-09 21:11 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-09-05 11:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: cagney


(obvious)

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

	* mips-tdep.c (mips_extract_struct_value_address): Retrieve 
	V0_REGNUM from saved regcache, not from current regcache.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.119
diff -p -r1.119 mips-tdep.c
*** mips-tdep.c	24 Aug 2002 00:21:35 -0000	1.119
--- mips-tdep.c	5 Sep 2002 18:27:42 -0000
*************** mips_store_struct_return (CORE_ADDR addr
*** 4906,4917 ****
  }
  
  static CORE_ADDR
! mips_extract_struct_value_address (struct regcache *ignore)
  {
    /* FIXME: This will only work at random.  The caller passes the
       struct_return address in V0, but it is not preserved.  It may
       still be there, or this may be a random value.  */
!   return read_register (V0_REGNUM);
  }
  
  /* Exported procedure: Is PC in the signal trampoline code */
--- 4902,4915 ----
  }
  
  static CORE_ADDR
! mips_extract_struct_value_address (struct regcache *regcache)
  {
    /* FIXME: This will only work at random.  The caller passes the
       struct_return address in V0, but it is not preserved.  It may
       still be there, or this may be a random value.  */
!   CORE_ADDR val;
!   regcache_cooked_read_unsigned (regcache, V0_REGNUM, &val);
!   return val;
  }
  
  /* Exported procedure: Is PC in the signal trampoline code */


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

* Re: [PATCH] mips_extract_struct_return_value: use saved regcache
  2002-09-05 11:30 [PATCH] mips_extract_struct_return_value: use saved regcache Michael Snyder
@ 2002-09-09 21:11 ` Andrew Cagney
  2002-09-10 13:08   ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-09-09 21:11 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> ! mips_extract_struct_value_address (struct regcache *regcache)
>   {
>     /* FIXME: This will only work at random.  The caller passes the
>        struct_return address in V0, but it is not preserved.  It may
>        still be there, or this may be a random value.  */
> !   CORE_ADDR val;
> !   regcache_cooked_read_unsigned (regcache, V0_REGNUM, &val);
> !   return val;
>   }

FYI,

This should be regcache_cooked_read_signed() so that the address is sign 
extended.  I think val should also be a LONGEST.

Andrew



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

* Re: [PATCH] mips_extract_struct_return_value: use saved regcache
  2002-09-09 21:11 ` Andrew Cagney
@ 2002-09-10 13:08   ` Michael Snyder
  2002-09-10 13:43     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-09-10 13:08 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Michael Snyder, gdb-patches

Andrew Cagney wrote:
> 
> > ! mips_extract_struct_value_address (struct regcache *regcache)
> >   {
> >     /* FIXME: This will only work at random.  The caller passes the
> >        struct_return address in V0, but it is not preserved.  It may
> >        still be there, or this may be a random value.  */
> > !   CORE_ADDR val;
> > !   regcache_cooked_read_unsigned (regcache, V0_REGNUM, &val);
> > !   return val;
> >   }
> 
> FYI,
> 
> This should be regcache_cooked_read_signed() so that the address is sign
> extended. 

Are you sure?  Arm, i386, and cris all use unsigned. 
I just copied them.


> I think val should also be a LONGEST.

OK, will change.


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

* Re: [PATCH] mips_extract_struct_return_value: use saved regcache
  2002-09-10 13:08   ` Michael Snyder
@ 2002-09-10 13:43     ` Daniel Jacobowitz
  2002-09-10 14:26       ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-09-10 13:43 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Andrew Cagney, Michael Snyder, gdb-patches

On Tue, Sep 10, 2002 at 01:08:33PM -0700, Michael Snyder wrote:
> Andrew Cagney wrote:
> > 
> > > ! mips_extract_struct_value_address (struct regcache *regcache)
> > >   {
> > >     /* FIXME: This will only work at random.  The caller passes the
> > >        struct_return address in V0, but it is not preserved.  It may
> > >        still be there, or this may be a random value.  */
> > > !   CORE_ADDR val;
> > > !   regcache_cooked_read_unsigned (regcache, V0_REGNUM, &val);
> > > !   return val;
> > >   }
> > 
> > FYI,
> > 
> > This should be regcache_cooked_read_signed() so that the address is sign
> > extended. 
> 
> Are you sure?  Arm, i386, and cris all use unsigned. 
> I just copied them.

Yes, Andrew's right - this is a quirk of MIPS.

> > I think val should also be a LONGEST.
> 
> OK, will change.
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [PATCH] mips_extract_struct_return_value: use saved regcache
  2002-09-10 13:43     ` Daniel Jacobowitz
@ 2002-09-10 14:26       ` Michael Snyder
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2002-09-10 14:26 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Andrew Cagney, Michael Snyder, gdb-patches

Daniel Jacobowitz wrote:
> 
> On Tue, Sep 10, 2002 at 01:08:33PM -0700, Michael Snyder wrote:
> > Andrew Cagney wrote:
> > >
> > > > ! mips_extract_struct_value_address (struct regcache *regcache)
> > > >   {
> > > >     /* FIXME: This will only work at random.  The caller passes the
> > > >        struct_return address in V0, but it is not preserved.  It may
> > > >        still be there, or this may be a random value.  */
> > > > !   CORE_ADDR val;
> > > > !   regcache_cooked_read_unsigned (regcache, V0_REGNUM, &val);
> > > > !   return val;
> > > >   }
> > >
> > > FYI,
> > >
> > > This should be regcache_cooked_read_signed() so that the address is sign
> > > extended.
> >
> > Are you sure?  Arm, i386, and cris all use unsigned.
> > I just copied them.
> 
> Yes, Andrew's right - this is a quirk of MIPS.

OK then -- I'll change it.
Thanks (Daniel and Andrew)


> 
> > > I think val should also be a LONGEST.
> >
> > OK, will change.
> >
> 
> --
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer


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

end of thread, other threads:[~2002-09-10 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05 11:30 [PATCH] mips_extract_struct_return_value: use saved regcache Michael Snyder
2002-09-09 21:11 ` Andrew Cagney
2002-09-10 13:08   ` Michael Snyder
2002-09-10 13:43     ` Daniel Jacobowitz
2002-09-10 14:26       ` Michael Snyder

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