From: Tom Tromey Date: Tue, 28 Apr 2009 01:03:24 +0000 (+0000) Subject: gdb X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=379a77b5484ba0d8f29983175acb2b968f56785a;p=binutils-gdb.git gdb * c-exp.y (yylex): Handle '[' and ']' like '(' and ')'. gdb/testsuite * gdb.base/printcmds.exp (test_printf): Test comma operator in []. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d932f85a95..5dd33b21439 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-04-27 Tom Tromey + + * c-exp.y (yylex): Handle '[' and ']' like '(' and ')'. + 2009-04-27 Jerome Guitton * symtab.c (append_exact_match_to_sals): New function, extracted diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 92d6c215a5e..688c060ef2e 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1885,11 +1885,13 @@ yylex () lexptr++; goto retry; + case '[': case '(': paren_depth++; lexptr++; return c; + case ']': case ')': if (paren_depth == 0) return 0; @@ -1991,8 +1993,6 @@ yylex () case '@': case '<': case '>': - case '[': - case ']': case '?': case ':': case '=': diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fa6cd7d4ff0..61aee21934c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-04-27 Tom Tromey + + * gdb.base/printcmds.exp (test_printf): Test comma operator in []. + 2009-04-27 Doug Evans * gdb.threads/watchthreads.c (main): Initialize args before starting diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index b6f8a1f5d84..65ab3a45c15 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -666,6 +666,9 @@ proc test_printf {} { gdb_test "printf \"x=%d,y=%f,z=%d\\n\", 5, 6.0, 7" "x=5,y=6\.0+,z=7" gdb_test "printf \"%x %f, %c %x, %x, %f\\n\", 0xbad, -99.541, 'z',\ 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+" + + # Regression test for C lexer bug. + gdb_test "printf \"%c\\n\", \"x\"\[1,0\]" "x" } #Test printing DFP values with printf