From: Doug Evans Date: Thu, 19 Aug 2010 15:50:02 +0000 (+0000) Subject: PR exp/11926 X-Git-Tag: gdb_7_2-2010-09-02-release~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=747f94fc38d53a03ccd0aa5bc91fb83e3f4b56ec;p=thirdparty%2Fbinutils-gdb.git PR exp/11926 * c-exp.y (parse_number): Handle 0 return from sscanf. testsuite/ * gdb.base/printcmds.exp (test_integer_literals_rejected): Add test of "p 0x1.1". --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5a378e3098d..3aa0bdfb20b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-08-19 Doug Evans + + PR exp/11926 + * c-exp.y (parse_number): Handle 0 return from sscanf. + 2010-08-19 Joel Brobecker * psymtab.c (map_symbol_filenames_psymtab): Call FUN with diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 030554c9823..d83bbf4d8ab 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1371,6 +1371,12 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere) &putithere->typed_val_float.dval, s); p[len] = saved_char; /* restore the input stream */ + if (num == 0) + { + free (s); + return ERROR; + } + if (num == 1) putithere->typed_val_float.type = parse_type->builtin_double; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a07ffcf9215..cf8e9330cd3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-08-19 Doug Evans + + PR exp/11926 + * gdb.base/printcmds.exp (test_integer_literals_rejected): Add + test of "p 0x1.1". + 2010-08-09 Jan Kratochvil * gdb.python/python.exp (show height, set height 10) diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 11e29fa5a65..c602a8b8e13 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -128,6 +128,7 @@ proc test_integer_literals_rejected {} { test_print_reject "p 123DEADBEEF" test_print_reject "p 123foobar.bazfoo3" test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333" + test_print_reject "p 0x1.1" gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition" # Test various octal values.