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.
+2010-01-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Implement binary numbers parsing.
+ * c-exp.y (parse_number): New case 'b' and 'B'.
+
2010-01-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Tristan Gingold <gingold@adacore.com>
2010-01-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Tristan Gingold <gingold@adacore.com>
+ case 'b':
+ case 'B':
+ if (len >= 3)
+ {
+ p += 2;
+ base = 2;
+ len -= 2;
+ }
+ break;
+
case 't':
case 'T':
case 'd':
case 't':
case 'T':
case 'd':
+2010-01-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Implement binary numbers parsing.
+ * gdb.base/printcmds.exp (test_integer_literals_accepted)
+ (test_integer_literals_rejected): New binary tests.
+
2010-01-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gdb.cell/configure: Regenerate.
2010-01-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gdb.cell/configure: Regenerate.
gdb_test "p 0xabcdef" " = 11259375"
gdb_test "p 0xAbCdEf" " = 11259375"
gdb_test "p/x 0x123" " = 0x123"
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 {} {
}
proc test_character_literals_accepted {} {
proc test_integer_literals_rejected {} {
global gdb_prompt
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 '\\'"
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 '\\'"
test_print_reject "p 0xG"
test_print_reject "p 0xAG"
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 {} {
}
proc test_print_all_chars {} {