aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-08-19 13:33:15 +0000
committerDoug Evans <dje@google.com>2010-08-19 13:33:15 +0000
commitd30f5e1f70ffa9fab08ccdacdba1bd6365d2511d (patch)
treea578156b090268842ed34a2a077d2eb6b6519cd2 /gdb/testsuite/gdb.base/printcmds.exp
parentFix regression in -file-list-exec-source-files command. (diff)
downloadbinutils-gdb-d30f5e1f70ffa9fab08ccdacdba1bd6365d2511d.tar.gz
binutils-gdb-d30f5e1f70ffa9fab08ccdacdba1bd6365d2511d.tar.bz2
binutils-gdb-d30f5e1f70ffa9fab08ccdacdba1bd6365d2511d.zip
PR exp/11926
* parser-defs.h (parse_float, parse_c_float): Declare. * parse.c (parse_float, parse_c_float): New function. * c-exp.y (parse_number): Call parse_c_float. * objc-exp.y (parse_number): Ditto. * p-exp.y (parse_number): Ditto. Use ANSI/ISO-style definition. * jv-exp.y (parse_number): Call parse_float, fix suffix handling. testsuite/ * gdb.base/printcmds.exp (test_float_accepted): New function. Move existing float tests there. Add tests for floats with suffixes. (test_float_rejected): New function. * gdb.java/jv-print.exp (test_float_accepted): New function. (test_float_rejected): New function. * gdb.objc/print.exp: New file. * gdb.pascal/print.exp: New file. * lib/objc.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/printcmds.exp')
-rw-r--r--gdb/testsuite/gdb.base/printcmds.exp43
1 files changed, 32 insertions, 11 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 4c82ab31015..d377597c59b 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -102,17 +102,6 @@ proc test_integer_literals_rejected {} {
test_print_reject "p DEADBEEF"
- # Gdb currently fails this test for all configurations. The C
- # lexer thinks that 123DEADBEEF is a floating point number, but
- # then fails to notice that atof() only eats the 123 part.
- # FIXME: This should be put into PRMS.
- # Fixed, 4/25/97, by Bob Manson.
-
- test_print_reject "p 123DEADBEEF"
- test_print_reject "p 123foobar.bazfoo3"
- test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
- gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
-
# Test various octal values.
test_print_reject "p 09"
@@ -129,6 +118,36 @@ proc test_integer_literals_rejected {} {
test_print_reject "p 0b12"
}
+proc test_float_accepted {} {
+ # This test is useful to catch successful parsing of the first fp value.
+ gdb_test "p 123.4+56.7" " = 180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
+
+ # Test all the suffixes (including no suffix).
+ gdb_test "p 1." " = 1"
+ gdb_test "p 1.5" " = 1.5"
+ gdb_test "p 1.f" " = 1"
+ gdb_test "p 1.5f" " = 1.5"
+ gdb_test "p 1.l" " = 1"
+ gdb_test "p 1.5l" " = 1.5"
+}
+
+proc test_float_rejected {} {
+ # Gdb use to fail this test for all configurations. The C
+ # lexer thought that 123DEADBEEF was a floating point number, but
+ # then failed to notice that atof() only eats the 123 part.
+ # Fixed, 4/25/97, by Bob Manson.
+ test_print_reject "p 123DEADBEEF"
+
+ test_print_reject "p 123foobar.bazfoo3"
+ test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
+ test_print_reject "p 0x1.1"
+
+ # Test bad suffixes.
+ test_print_reject "p 1.1x"
+ test_print_reject "p 1.1ff"
+ test_print_reject "p 1.1ll"
+}
+
proc test_print_all_chars {} {
global gdb_prompt
@@ -781,6 +800,8 @@ if ![runto_main] then {
test_integer_literals_accepted
test_integer_literals_rejected
+test_float_accepted
+test_float_rejected
test_character_literals_accepted
test_print_all_chars
test_print_repeats_10