Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address
@ 2002-10-26  7:41 Mark Kettenis
  2002-10-26 10:23 ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2002-10-26  7:41 UTC (permalink / raw)
  To: gdb-patches

We know for sure here that we're not dealing with a cooked register.

Checked in.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-tdep.c (i386_extract_struct_value_address): Use
	regcache_raw_read_unsigned instead of
	regcache_cooked_read_unsigned since we know that the register
	we're reading isn't a pseudo register.  Rename variable 'val' into
	the more descriptive 'addr'.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.88
diff -u -p -r1.88 i386-tdep.c
--- i386-tdep.c 17 Sep 2002 20:42:01 -0000 1.88
+++ i386-tdep.c 26 Oct 2002 14:39:42 -0000
@@ -1039,25 +1039,17 @@ i386_store_return_value (struct type *ty
     }
 }
 
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR.  */
+/* Extract from REGCACHE, which contains the (raw) register state, the
+   address in which a function should return its structure value, as a
+   CORE_ADDR.  */
 
 static CORE_ADDR
 i386_extract_struct_value_address (struct regcache *regcache)
 {
-  /* NOTE: cagney/2002-08-12: Replaced a call to
-     regcache_raw_read_as_address() with a call to
-     regcache_cooked_read_unsigned().  The old, ...as_address function
-     was eventually calling extract_unsigned_integer (via
-     extract_address) to unpack the registers value.  The below is
-     doing an unsigned extract so that it is functionally equivalent.
-     The read needs to be cooked as, otherwise, it will never
-     correctly return the value of a register in the [NUM_REGS
-     .. NUM_REGS+NUM_PSEUDO_REGS) range.  */
-  ULONGEST val;
-  regcache_cooked_read_unsigned (regcache, LOW_RETURN_REGNUM, &val);
-  return val;
+  ULONGEST addr;
+
+  regcache_raw_read_unsigned (regcache, LOW_RETURN_REGNUM, &addr);
+  return addr;
 }
 \f
 


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

* Re: [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address
  2002-10-26  7:41 [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address Mark Kettenis
@ 2002-10-26 10:23 ` Andrew Cagney
  2002-10-27  8:25   ` Mark Kettenis
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-10-26 10:23 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> We know for sure here that we're not dealing with a cooked register.

That's what you think :-)  It's more correct here to use the cooked 
interface.

Andrew


> Checked in.
> 
> Mark
> 
> Index: ChangeLog
> from  Mark Kettenis  <kettenis@gnu.org>
> 
> 	* i386-tdep.c (i386_extract_struct_value_address): Use
> 	regcache_raw_read_unsigned instead of
> 	regcache_cooked_read_unsigned since we know that the register
> 	we're reading isn't a pseudo register.  Rename variable 'val' into
> 	the more descriptive 'addr'.
> 
> Index: i386-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-tdep.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 i386-tdep.c
> --- i386-tdep.c 17 Sep 2002 20:42:01 -0000 1.88
> +++ i386-tdep.c 26 Oct 2002 14:39:42 -0000
> @@ -1039,25 +1039,17 @@ i386_store_return_value (struct type *ty
>      }
>  }
>  
> -/* Extract from an array REGBUF containing the (raw) register state
> -   the address in which a function should return its structure value,
> -   as a CORE_ADDR.  */
> +/* Extract from REGCACHE, which contains the (raw) register state, the
> +   address in which a function should return its structure value, as a
> +   CORE_ADDR.  */
>  
>  static CORE_ADDR
>  i386_extract_struct_value_address (struct regcache *regcache)
>  {
> -  /* NOTE: cagney/2002-08-12: Replaced a call to
> -     regcache_raw_read_as_address() with a call to
> -     regcache_cooked_read_unsigned().  The old, ...as_address function
> -     was eventually calling extract_unsigned_integer (via
> -     extract_address) to unpack the registers value.  The below is
> -     doing an unsigned extract so that it is functionally equivalent.
> -     The read needs to be cooked as, otherwise, it will never
> -     correctly return the value of a register in the [NUM_REGS
> -     .. NUM_REGS+NUM_PSEUDO_REGS) range.  */
> -  ULONGEST val;
> -  regcache_cooked_read_unsigned (regcache, LOW_RETURN_REGNUM, &val);
> -  return val;
> +  ULONGEST addr;
> +
> +  regcache_raw_read_unsigned (regcache, LOW_RETURN_REGNUM, &addr);
> +  return addr;
>  }
>  \f
>  
> 



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

* Re: [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address
  2002-10-26 10:23 ` Andrew Cagney
@ 2002-10-27  8:25   ` Mark Kettenis
  2002-11-07 15:12     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2002-10-27  8:25 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

   Date: Sat, 26 Oct 2002 13:23:08 -0400
   From: Andrew Cagney <ac131313@redhat.com>

   > We know for sure here that we're not dealing with a cooked register.

   That's what you think :-)  It's more correct here to use the cooked 
   interface.

Care to enlighten me?  Is it that one should always use the cooked
interface, except in code that's present to support the cooked
interface in the first place?

Mark


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

* Re: [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address
  2002-10-27  8:25   ` Mark Kettenis
@ 2002-11-07 15:12     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-11-07 15:12 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

>    Date: Sat, 26 Oct 2002 13:23:08 -0400
>    From: Andrew Cagney <ac131313@redhat.com>
> 
>    > We know for sure here that we're not dealing with a cooked register.
> 
>    That's what you think :-)  It's more correct here to use the cooked 
>    interface.
> 
> Care to enlighten me?  Is it that one should always use the cooked
> interface, except in code that's present to support the cooked
> interface in the first place?

Yes.

ABI code (such as that finding the location of the struct return 
pointer) interacts with the cooked interface.

That way, nothing (except the code to map cooked registers onto raw 
registers and/or memory) knows exactly how the underlying registers are 
implemented.

Andrew



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

end of thread, other threads:[~2002-11-07 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-26  7:41 [PATCH] Address FIXME in i386-tdep.c:i386_extract_struct_value_address Mark Kettenis
2002-10-26 10:23 ` Andrew Cagney
2002-10-27  8:25   ` Mark Kettenis
2002-11-07 15:12     ` Andrew Cagney

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