diff options
author | Pedro Alves <palves@redhat.com> | 2017-11-07 11:00:31 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-11-07 11:06:49 +0000 |
commit | cee62dbd8771e22856d950c2615fb463305a9fcb (patch) | |
tree | 20897e6e89bdc60afa5ccc71aed126c3f65d4d9c /gdb/testsuite | |
parent | cc638e867c240546b4dbc791761099d3ca5fe4a9 (diff) | |
download | gdb-cee62dbd8771e22856d950c2615fb463305a9fcb.zip gdb-cee62dbd8771e22856d950c2615fb463305a9fcb.tar.gz gdb-cee62dbd8771e22856d950c2615fb463305a9fcb.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/ena-dis-br-range.exp | 38 |
2 files changed, 42 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 76bd960..5698dac 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 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:". 2017-11-07 Xavier Roirand <roirand@adacore.com> diff --git a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp index 8873c4a..c2a3017 100644 --- a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp +++ b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp @@ -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" |