diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-01-11 17:58:16 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-01-11 17:58:16 +0000 |
commit | b5cfddf53bc50bebe17c82cb8352b6fa08b27cdd (patch) | |
tree | 815f5c9092d8635e7fc054dca4d533b53bb1cd18 /gdb/testsuite/gdb.base/printcmds.exp | |
parent | e0ae4240662bc4d1f9ec5e121897878e1195aed2 (diff) | |
download | binutils-gdb-b5cfddf53bc50bebe17c82cb8352b6fa08b27cdd.tar.gz |
gdb/
Implement binary numbers parsing.
* c-exp.y (parse_number): New case 'b' and 'B'.
gdb/testsuite/
Implement binary numbers parsing.
* gdb.base/printcmds.exp (test_integer_literals_accepted)
(test_integer_literals_rejected): New binary tests.
Diffstat (limited to 'gdb/testsuite/gdb.base/printcmds.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 76265bb32a6..74ea6ede309 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -78,6 +78,13 @@ proc test_integer_literals_accepted {} { gdb_test "p 0xabcdef" " = 11259375" gdb_test "p 0xAbCdEf" " = 11259375" gdb_test "p/x 0x123" " = 0x123" + + # Test various binary values. + + gdb_test "p 0b0" " = 0" + gdb_test "p 0b1111" " = 15" + gdb_test "p 0B1111" " = 15" + gdb_test "p -0b1111" " = -15" } proc test_character_literals_accepted {} { @@ -99,7 +106,8 @@ proc test_character_literals_accepted {} { proc test_integer_literals_rejected {} { global gdb_prompt - test_print_reject "p 0x" + test_print_reject "p 0x" + test_print_reject "p 0b" gdb_test "p ''" "(Empty character constant\\.|A character constant must contain at least one character\\.)" gdb_test "p '''" "(Empty character constant\\.|A character constant must contain at least one character\\.)" test_print_reject "p '\\'" @@ -131,6 +139,11 @@ proc test_integer_literals_rejected {} { test_print_reject "p 0xG" test_print_reject "p 0xAG" + + # Test various binary values. + + test_print_reject "p 0b2" + test_print_reject "p 0b12" } proc test_print_all_chars {} { |