binutils-gdb/gdb/testsuite/gdb.base/floatn.exp

125 lines
4.6 KiB
Plaintext
Raw Normal View History

# Copyright 2016-2017 Free Software Foundation, Inc.
Support 128-bit IEEE floating-point types on Intel and Power Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:33:15 +02:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is part of the gdb testsuite. It is intended to test that
# gdb could correctly handle floating point constant with a suffix.
standard_testfile .c
proc do_compile { {opts {}} } {
global srcdir subdir srcfile binfile
set ccopts {debug quiet}
foreach opt $opts {lappend ccopts "additional_flags=$opt"}
gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" executable $ccopts
}
if { [do_compile] != "" && [do_compile {-mfloat128}] != "" } {
untested "compiler can't handle _FloatN/_FloatNx types?"
return -1
}
clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
# Run to the breakpoint at return.
gdb_breakpoint [gdb_get_line_number "return"]
gdb_continue_to_breakpoint "return"
# Print the original values of f32, f64, f128, f32x, f64x.
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "print f32" ".* = 1\\.5.*" "the original value of f32 is 1.5"
gdb_test "print f64" ".* = 2\\.25.*" "the original value of f64 is 2.25"
gdb_test "print f128" ".* = 3\\.375.*" "the original value of f128 is 3.375"
gdb_test "print f32x" ".* = 10\\.5.*" "the original value of f32x is 10.5"
gdb_test "print f64x" ".* = 20\\.25.*" "the original value of f64x is 20.25"
Support 128-bit IEEE floating-point types on Intel and Power Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:33:15 +02:00
# Test that gdb could correctly recognize float constant expression with a suffix.
# FIXME: gdb does not yet recognize the suffix for _FloatN/_FloatNx types.
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "print f32=-1.5" ".* = -1\\.5.*" "try to change f32 to -1.5 with 'print f32=-1.5'"
gdb_test "print f64=-2.25" ".* = -2\\.25.*" "try to change f64 to -2.25 with 'print f64=-2.25'"
gdb_test "print f128=-3.375" ".* = -3\\.375.*" "try to change f128 to -3.375 with 'print f128=-3.375'"
gdb_test "print f32x=-10.5" ".* = -10\\.5.*" "try to change f32x to -10.5 with 'print f32=-1.5x'"
gdb_test "print f64x=-20.25" ".* = -20\\.25.*" "try to change f64x to -20.25 with 'print f64=-2.25x'"
Support 128-bit IEEE floating-point types on Intel and Power Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:33:15 +02:00
# Test that gdb could handle the above correctly with "set var" command.
set test "set variable f32 = 10.5"
gdb_test_multiple "set var f32=10.5" "$test" {
-re "$gdb_prompt $" {
pass "$test"
}
-re "Invalid number.*$gdb_prompt $" {
fail "$test (do not recognize 10.5)"
}
}
set test "set variable f64 = 20.25"
gdb_test_multiple "set var f64=20.25" "$test" {
-re "$gdb_prompt $" {
pass "$test"
}
-re "Invalid number.*$gdb_prompt $" {
fail "$test (do not recognize 20.25)"
}
}
set test "set variable f128 = 30.375"
gdb_test_multiple "set var f128=30.375" "$test" {
-re "$gdb_prompt $" {
pass "$test"
}
-re "Invalid number.*$gdb_prompt $" {
fail "$test (do not recognize 30.375)"
}
}
set test "set variable f32x = 100.5"
gdb_test_multiple "set var f32x=100.5" "$test" {
-re "$gdb_prompt $" {
pass "$test"
}
-re "Invalid number.*$gdb_prompt $" {
fail "$test (do not recognize 100.5)"
}
}
set test "set variable f64x = 200.25"
gdb_test_multiple "set var f64x=200.25" "$test" {
-re "$gdb_prompt $" {
pass "$test"
}
-re "Invalid number.*$gdb_prompt $" {
fail "$test (do not recognize 200.25)"
}
}
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "print f32" ".* = 10\\.5.*" "the value of f32 is changed to 10.5"
gdb_test "print f64" ".* = 20\\.25.*" "the value of f64 is changed to 20.25"
gdb_test "print f128" ".* = 30\\.375.*" "the value of f128 is changed to 30.375"
gdb_test "print f32x" ".* = 100\\.5.*" "the value of f32x is changed to 100.5"
gdb_test "print f64x" ".* = 200\\.25.*" "the value of f64x is changed to 200.25"
Support 128-bit IEEE floating-point types on Intel and Power Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:33:15 +02:00
# Print the original values of c32, c64, c128, c32x, c64x.
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "print c32" ".* = 1\\.5 \\+ 1 \\* I.*" "the original value of c32 is 1.5 + 1 * I"
gdb_test "print c64" ".* = 2\\.25 \\+ 1 \\* I.*" "the original value of c64 is 2.25 + 1 * I"
gdb_test "print c128" ".* = 3\\.375 \\+ 1 \\* I.*" "the original value of c128 is 3.375 + 1 * I"
gdb_test "print c32x" ".* = 10\\.5 \\+ 1 \\* I.*" "the original value of c32x is 10.5 + 1 * I"
gdb_test "print c64x" ".* = 20\\.25 \\+ 1 \\* I.*" "the original value of c64x is 20.25 + 1 * I"
Support 128-bit IEEE floating-point types on Intel and Power Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06 17:33:15 +02:00
# FIXME: GDB cannot parse non-trivial complex constants yet.