Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] values.c: don't fetch func void return value
@ 2003-04-16 22:06 Elena Zannoni
  2003-04-17 17:44 ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2003-04-16 22:06 UTC (permalink / raw)
  To: gdb-patches


While debugging the x86-64 I noticed that there were problems because
gdb was trying to extract a void return value from a function.  It
already has set up the value structure with all the correct fields, it
seems a waste to go and ask the target for a value if we know there
isn't one.

No regressions on x86.

2003-04-16  Elena Zannoni  <ezannoni@redhat.com>

	* values.c (value_being_returned): Don't fetch the return
        value if the return type is void.

Index: values.c
===================================================================
RCS file: /cvs/uberbaum/gdb/values.c,v
retrieving revision 1.47
diff -u -p -r1.47 values.c
--- values.c	20 Feb 2003 00:01:07 -0000	1.47
+++ values.c	16 Apr 2003 21:29:19 -0000
@@ -1240,7 +1240,9 @@ value_being_returned (struct type *valty
 
   val = allocate_value (valtype);
   CHECK_TYPEDEF (valtype);
-  EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
+  /* If the function returns void, don't bother fetching the return value.  */
+  if (TYPE_CODE (valtype) != TYPE_CODE_VOID)
+    EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
 
   return val;
 }


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

* Re: [RFA] values.c: don't fetch func void return value
  2003-04-16 22:06 [RFA] values.c: don't fetch func void return value Elena Zannoni
@ 2003-04-17 17:44 ` Michael Snyder
  2003-04-17 20:36   ` Elena Zannoni
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2003-04-17 17:44 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

Elena Zannoni wrote:
> 
> While debugging the x86-64 I noticed that there were problems because
> gdb was trying to extract a void return value from a function.  It
> already has set up the value structure with all the correct fields,

Meaning the correct fields for a void return?

> it
> seems a waste to go and ask the target for a value if we know there
> isn't one.

Seems reasonable to me...  and I don't see any specific maintainer.
[donning appropriate hat]  Bless you, my child...


> 2003-04-16  Elena Zannoni  <ezannoni@redhat.com>
> 
>         * values.c (value_being_returned): Don't fetch the return
>         value if the return type is void.
> 
> Index: values.c
> ===================================================================
> RCS file: /cvs/uberbaum/gdb/values.c,v
> retrieving revision 1.47
> diff -u -p -r1.47 values.c
> --- values.c    20 Feb 2003 00:01:07 -0000      1.47
> +++ values.c    16 Apr 2003 21:29:19 -0000
> @@ -1240,7 +1240,9 @@ value_being_returned (struct type *valty
> 
>    val = allocate_value (valtype);
>    CHECK_TYPEDEF (valtype);
> -  EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
> +  /* If the function returns void, don't bother fetching the return value.  */
> +  if (TYPE_CODE (valtype) != TYPE_CODE_VOID)
> +    EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
> 
>    return val;
>  }


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

* Re: [RFA] values.c: don't fetch func void return value
  2003-04-17 17:44 ` Michael Snyder
@ 2003-04-17 20:36   ` Elena Zannoni
  0 siblings, 0 replies; 3+ messages in thread
From: Elena Zannoni @ 2003-04-17 20:36 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Elena Zannoni, gdb-patches

Michael Snyder writes:
 > Elena Zannoni wrote:
 > > 
 > > While debugging the x86-64 I noticed that there were problems because
 > > gdb was trying to extract a void return value from a function.  It
 > > already has set up the value structure with all the correct fields,
 > 
 > Meaning the correct fields for a void return?
 > 
 > > it
 > > seems a waste to go and ask the target for a value if we know there
 > > isn't one.
 > 
 > Seems reasonable to me...  and I don't see any specific maintainer.
 > [donning appropriate hat]  Bless you, my child...
 > 

Thanks, 
committed

elena


 > 
 > > 2003-04-16  Elena Zannoni  <ezannoni@redhat.com>
 > > 
 > >         * values.c (value_being_returned): Don't fetch the return
 > >         value if the return type is void.
 > > 
 > > Index: values.c
 > > ===================================================================
 > > RCS file: /cvs/uberbaum/gdb/values.c,v
 > > retrieving revision 1.47
 > > diff -u -p -r1.47 values.c
 > > --- values.c    20 Feb 2003 00:01:07 -0000      1.47
 > > +++ values.c    16 Apr 2003 21:29:19 -0000
 > > @@ -1240,7 +1240,9 @@ value_being_returned (struct type *valty
 > > 
 > >    val = allocate_value (valtype);
 > >    CHECK_TYPEDEF (valtype);
 > > -  EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
 > > +  /* If the function returns void, don't bother fetching the return value.  */
 > > +  if (TYPE_CODE (valtype) != TYPE_CODE_VOID)
 > > +    EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
 > > 
 > >    return val;
 > >  }


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

end of thread, other threads:[~2003-04-17 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-16 22:06 [RFA] values.c: don't fetch func void return value Elena Zannoni
2003-04-17 17:44 ` Michael Snyder
2003-04-17 20:36   ` Elena Zannoni

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