From: "Tiago Stürmer Daitx" <tdaitx@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: emachado@linux.vnet.ibm.com, Ulrich.Weigand@de.ibm.com
Subject: [PATCH] Fix printing functions with complex return on PPC64
Date: Wed, 23 Jan 2013 18:37:00 -0000 [thread overview]
Message-ID: <51002df4.gTlyNYCLGs9Wzueq%tdaitx@linux.vnet.ibm.com> (raw)
This patch fix the current PPC64 return value code to properly handle complex
types by passing the target type of the COMPLEX value. It also makes use of a
variable to hold TYPE_TARGET_TYPE (valtype) for better readability and reuse.
Previously two testcases from gdb.base/callfuncs.exp and another two from
gdb.base/varargs.exp would fail with GDB Interal Error due to improperly
calling convert_typed_floating with a COMPLEX type instead of using the
target type.
Excerpt from a diff between PPC64 run log before and after the fix:
-FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex (GDB internal error)
-FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex (GDB internal error)
-FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) (GDB internal error)
-FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4) (GDB internal error)
+FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)
The existing FAIL is due to the complex arguments and will be fixed by another
patch series.
No regression was detected on PPC (32 bits) testcases.
Regards,
Tiago Daitx
gdb/Changelog
2012-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com>
* ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Set correct
type on float conversion for complex type.
---
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 48b4765..0ffeab9 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1920,11 +1920,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype =
register_type (gdbarch, tdep->ppc_fp0_regnum);
+ struct type *target_type;
+ target_type = check_typedef (TYPE_TARGET_TYPE (valtype));
if (writebuf != NULL)
{
convert_typed_floating ((const bfd_byte *) writebuf +
- i * (TYPE_LENGTH (valtype) / 2),
- valtype, regval, regtype);
+ i * TYPE_LENGTH (target_type),
+ target_type, regval, regtype);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + i,
regval);
@@ -1936,8 +1938,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
regval);
convert_typed_floating (regval, regtype,
(bfd_byte *) readbuf +
- i * (TYPE_LENGTH (valtype) / 2),
- valtype);
+ i * TYPE_LENGTH (target_type),
+ target_type);
}
}
}
next reply other threads:[~2013-01-23 18:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 18:37 Tiago Stürmer Daitx [this message]
2013-01-23 19:29 ` Ulrich Weigand
2013-01-23 20:04 ` Sergio Durigan Junior
-- strict thread matches above, loose matches on Subject: below --
2012-11-17 16:01 Tiago Stürmer Daitx
2012-11-26 9:44 ` Jan Kratochvil
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=51002df4.gTlyNYCLGs9Wzueq%tdaitx@linux.vnet.ibm.com \
--to=tdaitx@linux.vnet.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=emachado@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
/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