diff options
author | Luis Machado <luisgpm@br.ibm.com> | 2007-11-05 11:32:31 +0000 |
---|---|---|
committer | Luis Machado <luisgpm@br.ibm.com> | 2007-11-05 11:32:31 +0000 |
commit | 1a619819d6cb85f66a81d3ca146a960c679edfa4 (patch) | |
tree | d79458b9191b3ac748a1108187608fbf3a01262a /gdb/testsuite/gdb.base/printcmds.exp | |
parent | 9a5e27bd964ba53c203b2c4fe1df4be7f07cb37d (diff) | |
download | gdb-1a619819d6cb85f66a81d3ca146a960c679edfa4.zip gdb-1a619819d6cb85f66a81d3ca146a960c679edfa4.tar.gz gdb-1a619819d6cb85f66a81d3ca146a960c679edfa4.tar.bz2 |
* printcmd.c: (printf_command): Add support for new DFP
modifiers %H, %D and %DD.
* configure.ac: Add check for DECFLOAT printf support.
* configure: Regenerated.
* doc/gdb.texinfo: Update printf command's description.
* testsuite/gdb.base/printcmds.exp: New function
test_printf_with_dfp.
Diffstat (limited to 'gdb/testsuite/gdb.base/printcmds.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index a44db01..7745116 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -668,6 +668,57 @@ proc test_printf {} { 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+" } +#Test printing DFP values with printf +proc test_printf_with_dfp {} { + + # Test various dfp values, covering 32-bit, 64-bit and 128-bit ones + + # _Decimal32 constants, which can support up to 7 digits + gdb_test "printf \"%H\\n\",1.2df" "1.2" + gdb_test "printf \"%H\\n\",-1.2df" "-1.2" + gdb_test "printf \"%H\\n\",1.234567df" "1.234567" + gdb_test "printf \"%H\\n\",-1.234567df" "-1.234567" + gdb_test "printf \"%H\\n\",1234567.df" "1234567" + gdb_test "printf \"%H\\n\",-1234567.df" "-1234567" + + gdb_test "printf \"%H\\n\",1.2E1df" "12" + gdb_test "printf \"%H\\n\",1.2E10df" "1.2E\\+10" + gdb_test "printf \"%H\\n\",1.2E-10df" "1.2E-10" + + # The largest exponent for 32-bit dfp value is 96. + gdb_test "printf \"%H\\n\",1.2E96df" "1.200000E\\+96" + + # _Decimal64 constants, which can support up to 16 digits + gdb_test "printf \"%D\\n\",1.2dd" "1.2" + gdb_test "printf \"%D\\n\",-1.2dd" "-1.2" + gdb_test "printf \"%D\\n\",1.234567890123456dd" "1.234567890123456" + gdb_test "printf \"%D\\n\",-1.234567890123456dd" "-1.234567890123456" + gdb_test "printf \"%D\\n\",1234567890123456.dd" "1234567890123456" + gdb_test "printf \"%D\\n\",-1234567890123456.dd" "-1234567890123456" + + gdb_test "printf \"%D\\n\",1.2E1dd" "12" + gdb_test "printf \"%D\\n\",1.2E10dd" "1.2E\\+10" + gdb_test "printf \"%D\\n\",1.2E-10dd" "1.2E-10" + + # The largest exponent for 64-bit dfp value is 384. + gdb_test "printf \"%D\\n\",1.2E384dd" "1.200000000000000E\\+384" + + # _Decimal128 constants, which can support up to 34 digits + gdb_test "printf \"%DD\\n\",1.2dl" "1.2" + gdb_test "printf \"%DD\\n\",-1.2dl" "-1.2" + gdb_test "printf \"%DD\\n\",1.234567890123456789012345678901234dl" "1.234567890123456789012345678901234" + gdb_test "printf \"%DD\\n\",-1.234567890123456789012345678901234dl" "-1.234567890123456789012345678901234" + gdb_test "printf \"%DD\\n\",1234567890123456789012345678901234.dl" "1234567890123456789012345678901234" + gdb_test "printf \"%DD\\n\",-1234567890123456789012345678901234.dl" "-1234567890123456789012345678901234" + + gdb_test "printf \"%DD\\n\",1.2E1dl" "12" + gdb_test "printf \"%DD\\n\",1.2E10dl" "1.2E\\+10" + gdb_test "printf \"%DD\\n\",1.2E-10dl" "1.2E-10" + + # The largest exponent for 128-bit dfp value is 6144. + gdb_test "printf \"%DD\\n\",1.2E6144dl" "1.200000000000000000000000000000000E\\+6144" +} + # Escape a left curly brace to prevent it from being interpreted as # the beginning of a bound proc gdb_test_escape_braces { args } { @@ -711,6 +762,7 @@ if [set_lang_c] then { test_print_string_constants test_print_array_constants test_printf + test_printf_with_dfp } } else { fail "C print command tests suppressed" |