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 | 5c350e710a0b24bf460760f93bd91933d5214525 (patch) | |
tree | eac1d6cfe81c736d03ee89185bbcfdc197b91cd8 /gdb/testsuite | |
parent | ac474c5f88d874956c729d7540d0cf71b0b6aaac (diff) | |
download | gdb-5c350e710a0b24bf460760f93bd91933d5214525.tar.gz |
* 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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 52 |
2 files changed, 57 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 97490244f64..290ec1b8633 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-11-05 Luis Machado <luisgpm@br.ibm.com> + + * gdb.base/printcmds.exp: New function + test_printf_with_dfp. + 2007-11-02 Doug Evans <dje@google.com> * gdb.disasm/t01_mov.s: Remove carriage returns. diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index a44db01676c..77451160f59 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" |