From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] i386-tdep.c fix for *BSD.
Date: Sat, 31 Mar 2001 05:05:00 -0000 [thread overview]
Message-ID: <200103311304.f2VD4np04670@delius.kettenis.local> (raw)
The following patch fixes a problem on *BSD (or at least FreeBSD) with
returning structs that have a single floating point member (which is
tested for a `double' in the testsuite).
Note that when debugging code generated with older versions of GCC
(<=2.7.2.3) there are still problems, since the compiler returns
struct such as those mentioned to be returned in memory, wheras newer
GCC versions put them in a register. That problem should be addressed
in USE_STRUCT_CONVENTION, but I don't think it is possible to
distinguish between those GCC's.
Checked in.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i386-tdep.c (i386_extract_return_value): If the type of the
return value is TYPE_STRUCT and the number of fields is one, call
ourselves with TYPE set tp the type of the first field.
(i386_store_return_value): Likewise.
This fixes a problem with returning structs consisting of a single
`float' or `double' on *BSD.
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.23
diff -u -p -r1.23 i386-tdep.c
--- i386-tdep.c 2001/03/26 12:11:13 1.23
+++ i386-tdep.c 2001/03/31 12:58:24
@@ -733,7 +733,12 @@ i386_extract_return_value (struct type *
{
int len = TYPE_LENGTH (type);
- if (TYPE_CODE_FLT == TYPE_CODE (type))
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && TYPE_NFIELDS (type) == 1)
+ return i386_extract_return_value (TYPE_FIELD_TYPE (type, 0),
+ regbuf, valbuf);
+
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
if (NUM_FREGS == 0)
{
@@ -790,8 +795,12 @@ void
i386_store_return_value (struct type *type, char *valbuf)
{
int len = TYPE_LENGTH (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && TYPE_NFIELDS (type) == 1)
+ return i386_store_return_value (TYPE_FIELD_TYPE (type, 0), valbuf);
- if (TYPE_CODE_FLT == TYPE_CODE (type))
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
if (NUM_FREGS == 0)
{
reply other threads:[~2001-03-31 5:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103311304.f2VD4np04670@delius.kettenis.local \
--to=kettenis@wins.uva.nl \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox