Add base 'enable/disable invalid location range' tests

This adds tests that exercise the "bad breakpoint number" paths.
Specifically:

 - malformed ranges
 - use of explicit 0 as bp/loc number.
 - inverted ranges

I'm adding this as a baseline to improve.  This shows that there's a
lot of inconsistency in GDB's output (e.g., "bad" vs "Bad").

Also, IMO, the "0-0" and inverted range cases should be loud errors.

That and more will all be addressed in the next patch.

gdb/testsuite/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* gdb.cp/ena-dis-br-range.exp: Add tests.
This commit is contained in:
Pedro Alves 2017-11-07 11:00:31 +00:00
parent cc638e867c
commit cee62dbd87
2 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.cp/ena-dis-br-range.exp: Add tests.
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.base/ena-dis-br.exp: Don't expect "warning:".

View File

@ -130,3 +130,41 @@ gdb_test_no_output "disable 2.8-6"
gdb_test "info break" [make_info_breakpoint_reply_re y y y y y y] \
"breakpoint info disable 2.8-6"
# Check that invalid/open ranges are handled correctly.
with_test_prefix "open range" {
gdb_test "disable -" "bad breakpoint number at or near: '-'"
gdb_test "disable -1" "bad breakpoint number at or near: '-1'"
gdb_test "disable 1-" "bad breakpoint number at or near: '1-'"
gdb_test "disable 1.-2" "Bad breakpoint location number '-2'"
gdb_test "disable 1.2-" "bad breakpoint number at or near: '2-'"
gdb_test "disable 1.-2-3" "Bad breakpoint location number '-2'"
gdb_test "disable 1-2-3" "bad breakpoint number at or near: '1-2-3'"
}
with_test_prefix "dangling period" {
gdb_test "disable 2." "bad breakpoint number at or near: '2.'"
gdb_test "disable .2" "bad breakpoint number at or near: '.2'"
gdb_test "disable 2.3.4" "bad breakpoint number at or near '2.3.4'"
}
# Check that 0s are handled correctly.
with_test_prefix "zero" {
gdb_test "disable 0" "bad breakpoint number at or near '0'"
gdb_test "disable 0.0" "Bad breakpoint number '0.0'"
gdb_test "disable 0.1" "Bad breakpoint number '0.1'"
gdb_test "disable 0.1-2" "Bad breakpoint number '0.1-2'"
gdb_test "disable 2.0" "bad breakpoint number at or near '2.0'"
# These should really fail...
gdb_test_no_output "disable 2.0-0"
gdb_test_no_output "enable 2.0-0"
gdb_test "disable 2.0-1" "Bad breakpoint location number '0'"
# Likewise, should fail.
gdb_test_no_output "disable 2.1-0"
}
gdb_test "info break" [make_info_breakpoint_reply_re y y y y y y] \
"breakpoint info after invalids"