- Enable PowerPC to print 128-bit long double variables (BZ 237872).

- New testcase for 32bit inferiors on 64bit hosts.
- Resolves: rhbz#237872
- Related: rhbz#232014
This commit is contained in:
Jan Kratochvil 2007-04-25 21:13:29 +00:00
parent 8336d588bf
commit a32d62ae37
3 changed files with 352 additions and 1 deletions

View File

@ -0,0 +1,124 @@
2007-04-20 Luis Machado <luisgpm@br.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Set the long double format for
powerpc64.
* configure.host : Set the host long double format for powerpc64 to be
a 128-bit type defined in libiberty/floatformat.c.
* ppc-linux-tdep.c (ppc_linux_init_abi): Remove code that sets long double
size to 8 bytes. This breaks expression evaluation by overriding the
default.
* floatformat.c : Introduce default floatformat structs to describe the
128-bit long double found on the powerpc64. Description does not fully
describe this format which is actually a pair of 64-bit doubles. However
we are relying on floatformat_to_doublest() recognizing that this is
also the default host floatformat.
* floatformat.h : Default floatformat structs for powerpc64 128-bit
long doubles.
Index: ./gdb/configure.host
===================================================================
--- ./gdb/configure.host.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/configure.host 2007-04-21 23:51:09.000000000 -0300
@@ -179,6 +179,11 @@
gdb_host_double_format="&floatformat_ieee_double_big"
gdb_host_long_double_format="&floatformat_m68881_ext"
;;
+powerpc64-*-*)
+ gdb_host_float_format=0
+ gdb_host_double_format=0
+ gdb_host_long_double_format="&floatformat_ppc64_long_double_big"
+ ;;
*)
gdb_host_float_format=0
gdb_host_double_format=0
Index: ./gdb/rs6000-tdep.c
===================================================================
--- ./gdb/rs6000-tdep.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./gdb/rs6000-tdep.c 2007-04-21 23:51:09.000000000 -0300
@@ -3442,7 +3442,19 @@
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
if (sysv_abi)
- set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ {
+ int byte_order = gdbarch_byte_order (gdbarch);
+
+ if (byte_order == BFD_ENDIAN_BIG)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
+ else if (byte_order == BFD_ENDIAN_LITTLE)
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
+ else
+ internal_error (__FILE__, __LINE__,
+ _("rs6000_gdbarch_init: "
+ "bad byte order"));
+ set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ }
else
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
Index: ./include/floatformat.h
===================================================================
--- ./include/floatformat.h.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./include/floatformat.h 2007-04-21 23:51:09.000000000 -0300
@@ -118,6 +118,9 @@
extern const struct floatformat floatformat_ia64_spill_little;
extern const struct floatformat floatformat_ia64_quad_big;
extern const struct floatformat floatformat_ia64_quad_little;
+/* ppc64 long double implemented as 2 doubles */
+extern const struct floatformat floatformat_ppc64_long_double_big;
+extern const struct floatformat floatformat_ppc64_long_double_little;
/* Convert from FMT to a double.
FROM is the address of the extended float.
Index: ./libiberty/floatformat.c
===================================================================
--- ./libiberty/floatformat.c.orig 2007-04-21 23:51:06.000000000 -0300
+++ ./libiberty/floatformat.c 2007-04-21 23:51:09.000000000 -0300
@@ -106,6 +106,25 @@
floatformat_always_valid
};
+/* floatformats for ppc64 long double, big and little endian. */
+/* The layout is a pair of doubles. Don't use this description to pass */
+/* information to get_field(). The bit size is the important thing. */
+const struct floatformat floatformat_ppc64_long_double_big =
+{
+ floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_big",
+ floatformat_always_valid
+};
+
+const struct floatformat floatformat_ppc64_long_double_little =
+{
+ floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_ppc64_long_double_little",
+ floatformat_always_valid
+};
+
/* floatformat for IEEE double, little endian byte order, with big endian word
ordering, as on the ARM. */
Index: ./gdb/ppc-linux-tdep.c
===================================================================
--- ./gdb/ppc-linux-tdep.c.orig 2007-04-21 19:48:50.000000000 -0300
+++ ./gdb/ppc-linux-tdep.c 2007-04-22 00:29:50.000000000 -0300
@@ -1059,7 +1059,8 @@
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
+#if 0
+ /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
Supplement says that long doubles are sixteen bytes long.
However, as one of the known warts of its ABI, PPC GNU/Linux uses
eight-byte long doubles. GCC only recently got 128-bit long
@@ -1068,6 +1069,7 @@
double' on PPC GNU/Linux are non-conformant. */
/* NOTE: cagney/2005-01-25: True for both 32- and 64-bit. */
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+#endif
if (tdep->wordsize == 4)
{

215
gdb-6.6-gcore32-test.patch Normal file
View File

@ -0,0 +1,215 @@
Test GCORE on 32bit inferiors on 64bit platforms.
UNSUPPORTED results are valid for `-m64' on 32bit targets.
--- ./gdb/testsuite/gdb.base/gcore.exp 9 Jan 2007 17:59:11 -0000 1.9
+++ ./gdb/testsuite/gdb.base/gcore.exp 23 Apr 2007 19:20:12 -0000
@@ -31,9 +31,14 @@ set testfile "gcore"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested gcore.exp
- return -1
+# `-static-libgcc' to avoid dependency on `libgcc.{i386,ppc}'.
+foreach additional_flags {{} {-m32 -static-libgcc} {-m64 -static-libgcc}} {
+
+set prefix "arch{$additional_flags}:"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$additional_flags]] != "" } {
+ unsupported "${prefix} gcore.exp"
+ continue
}
# Start with a fresh gdb.
@@ -48,23 +52,23 @@ send_gdb "help gcore\n"
gdb_expect {
-re "Undefined command: .gcore.*$gdb_prompt $" {
# gcore command not supported -- nothing to test here.
- unsupported "gdb does not support gcore on this target"
- return -1;
+ unsupported "${prefix} gdb does not support gcore on this target"
+ continue
}
-re "Save a core file .*$gdb_prompt $" {
- pass "help gcore"
+ pass "${prefix} help gcore"
}
-re ".*$gdb_prompt $" {
- fail "help gcore"
+ fail "${prefix} help gcore"
}
timeout {
- fail "help gcore (timeout)"
+ fail "${prefix} help gcore (timeout)"
}
}
if { ! [ runto_main ] } then {
- untested gcore.exp
- return -1
+ untested "${prefix} gcore.exp"
+ continue
}
proc capture_command_output { command prefix } {
@@ -78,7 +82,7 @@ proc capture_command_output { command pr
set output_string $expect_out(1,string)
}
default {
- fail "capture_command_output failed on $command."
+ fail "${prefix} capture_command_output failed on $command."
}
}
return $output_string
@@ -109,15 +113,15 @@ set pre_corefile_extern_array \
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
- "save a corefile" \
+ "${prefix} save a corefile" \
{
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
- pass "save a corefile"
+ pass "${prefix} save a corefile"
global core_supported
set core_supported 1
}
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
- unsupported "save a corefile"
+ unsupported "${prefix} save a corefile"
global core_supported
set core_supported 0
}
@@ -125,7 +129,7 @@ gdb_test_multiple "gcore ${objdir}/${sub
global core_supported
if {!$core_supported} {
- return -1
+ continue
}
# Now restart gdb and load the corefile.
@@ -137,31 +141,31 @@ gdb_load ${binfile}
send_gdb "core ${objdir}/${subdir}/gcore.test\n"
gdb_expect {
-re ".* is not a core dump:.*$gdb_prompt $" {
- fail "re-load generated corefile (bad file format)"
+ fail "${prefix} re-load generated corefile (bad file format)"
# No use proceeding from here.
- return;
+ continue
}
-re ".*: No such file or directory.*$gdb_prompt $" {
- fail "re-load generated corefile (file not found)"
+ fail "${prefix} re-load generated corefile (file not found)"
# No use proceeding from here.
- return;
+ continue
}
-re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
- fail "re-load generated corefile (incomplete note section)"
+ fail "${prefix} re-load generated corefile (incomplete note section)"
}
-re "Core was generated by .*$gdb_prompt $" {
- pass "re-load generated corefile"
+ pass "${prefix} re-load generated corefile"
}
-re ".*$gdb_prompt $" {
- fail "re-load generated corefile"
+ fail "${prefix} re-load generated corefile"
}
timeout {
- fail "re-load generated corefile (timeout)"
+ fail "${prefix} re-load generated corefile (timeout)"
}
}
send_gdb "where\n"
-gdb_expect_list "where in corefile" ".*$gdb_prompt $" {
+gdb_expect_list "${prefix} where in corefile" ".*$gdb_prompt $" {
".*\[\r\n\]+#0 .* terminal_func \\(\\) at "
".*\[\r\n\]+#1 .* array_func \\(\\) at "
".*\[\r\n\]+#2 .* factorial_func \\(value=1\\) at "
@@ -175,61 +179,64 @@ gdb_expect_list "where in corefile" ".*$
set post_corefile_regs [capture_command_output "info registers" ""]
if ![string compare $pre_corefile_regs $post_corefile_regs] then {
- pass "corefile restored general registers"
+ pass "${prefix} corefile restored general registers"
} else {
- fail "corefile restored general registers"
+ fail "${prefix} corefile restored general registers"
}
set post_corefile_allregs [capture_command_output "info all-reg" ""]
if ![string compare $pre_corefile_allregs $post_corefile_allregs] then {
- pass "corefile restored all registers"
+ pass "${prefix} corefile restored all registers"
} else {
- fail "corefile restored all registers"
+ fail "${prefix} corefile restored all registers"
}
set post_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
- pass "corefile restored extern array"
+ pass "${prefix} corefile restored extern array"
} else {
- fail "corefile restored extern array"
+ fail "${prefix} corefile restored extern array"
}
set post_corefile_static_array \
[capture_command_output "print static_array" "$print_prefix"]
if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
- pass "corefile restored static array"
+ pass "${prefix} corefile restored static array"
} else {
- fail "corefile restored static array"
+ fail "${prefix} corefile restored static array"
}
set post_corefile_uninit_array \
[capture_command_output "print un_initialized_array" "$print_prefix"]
if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
- pass "corefile restored un-initialized array"
+ pass "${prefix} corefile restored un-initialized array"
} else {
- fail "corefile restored un-initialized array"
+ fail "${prefix} corefile restored un-initialized array"
}
set post_corefile_heap_string \
[capture_command_output "print heap_string" "$print_prefix"]
if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
- pass "corefile restored heap array"
+ pass "${prefix} corefile restored heap array"
} else {
- fail "corefile restored heap array"
+ fail "${prefix} corefile restored heap array"
}
set post_corefile_local_array \
[capture_command_output "print array_func::local_array" "$print_prefix"]
if ![string compare $pre_corefile_local_array $post_corefile_local_array] {
- pass "corefile restored stack array"
+ pass "${prefix} corefile restored stack array"
} else {
- fail "corefile restored stack array"
+ fail "${prefix} corefile restored stack array"
}
set post_corefile_backtrace [capture_command_output "backtrace" ""]
if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] {
- pass "corefile restored backtrace"
+ pass "${prefix} corefile restored backtrace"
} else {
- fail "corefile restored backtrace"
+ fail "${prefix} corefile restored backtrace"
+}
+
+# $additional_flags:
}

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.6
# The release always contains a leading reserved number, start it at 1.
Release: 11%{?dist}
Release: 12%{?dist}
License: GPL
Group: Development/Debuggers
@ -338,6 +338,12 @@ Patch246: gdb-6.6-bz237096-watchthreads-testcasefix.patch
# Notify user of a child forked process being detached (BZ 235197).
Patch247: gdb-6.6-bz234468-fork-detach-info.patch
# New testcase for 32bit inferiors on 64bit hosts.
Patch249: gdb-6.6-gcore32-test.patch
# Enable PowerPC to print 128-bit long double variables (BZ 237872).
Patch251: gdb-6.5-bz237872-ppc-long-double.patch
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
BuildRequires: flex bison sharutils expat-devel
@ -478,6 +484,8 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch245 -p1
%patch246 -p1
%patch247 -p1
%patch249 -p1
%patch251 -p1
# Change the version that gets printed at GDB startup, so it is RedHat
# specific.
@ -625,6 +633,10 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Wed Apr 25 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-12
- Enable PowerPC to print 128-bit long double variables (BZ 237872).
- New testcase for 32bit inferiors on 64bit hosts.
* Tue Apr 24 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-11
- Package review, analysed by Ralf Corsepius (BZ 225783).
- Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783).