* [PATCH] Fix printing functions with complex return on PPC64
@ 2013-01-23 18:37 Tiago Stürmer Daitx
2013-01-23 19:29 ` Ulrich Weigand
0 siblings, 1 reply; 5+ messages in thread
From: Tiago Stürmer Daitx @ 2013-01-23 18:37 UTC (permalink / raw)
To: gdb-patches; +Cc: emachado, Ulrich.Weigand
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);
}
}
}
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] Fix printing functions with complex return on PPC64
@ 2012-11-17 16:01 Tiago Stürmer Daitx
2012-11-26 9:44 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Tiago Stürmer Daitx @ 2012-11-17 16:01 UTC (permalink / raw)
To: gdb-patches
This patch fix the current PPC64 return value code to properly handle complex
types by passing the target type of the COMPLEX value.
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.
---
gdb/ppc-sysv-tdep.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index a221b70..1a0f74d 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1925,7 +1925,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
{
convert_typed_floating ((const bfd_byte *) writebuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype, regval, regtype);
+ TYPE_TARGET_TYPE (valtype), regval,
+ regtype);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + i,
regval);
@@ -1938,7 +1939,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
convert_typed_floating (regval, regtype,
(bfd_byte *) readbuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype);
+ TYPE_TARGET_TYPE (valtype));
}
}
}
--
1.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Fix printing functions with complex return on PPC64
2012-11-17 16:01 Tiago Stürmer Daitx
@ 2012-11-26 9:44 ` Jan Kratochvil
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2012-11-26 9:44 UTC (permalink / raw)
To: Tiago Stürmer Daitx; +Cc: gdb-patches
On Sat, 17 Nov 2012 16:59:39 +0100, Tiago Stürmer Daitx wrote:
> --- a/gdb/ppc-sysv-tdep.c
> +++ b/gdb/ppc-sysv-tdep.c
> @@ -1925,7 +1925,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
> {
> convert_typed_floating ((const bfd_byte *) writebuf +
> i * (TYPE_LENGTH (valtype) / 2),
> - valtype, regval, regtype);
> + TYPE_TARGET_TYPE (valtype), regval,
> + regtype);
> regcache_cooked_write (regcache,
> tdep->ppc_fp0_regnum + 1 + i,
> regval);
> @@ -1938,7 +1939,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
> convert_typed_floating (regval, regtype,
> (bfd_byte *) readbuf +
> i * (TYPE_LENGTH (valtype) / 2),
> - valtype);
> + TYPE_TARGET_TYPE (valtype));
> }
> }
> }
OK for commit.
You could also replace TYPE_LENGTH (valtype) / 2 there
by TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) to make it more clear
(use some variable for TYPE_TARGET_TYPE (valtype); not required.
Thanks,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-23 20:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 18:37 [PATCH] Fix printing functions with complex return on PPC64 Tiago Stürmer Daitx
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox