aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2015-02-02 14:57:31 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2015-02-06 10:27:01 -0500
commitb9d6130764916fac3d9bcfde2d672053a0ef3316 (patch)
treed276c6a8a853b80b72bdd856847d5e6a47e8febf /gdb/testsuite
parent55325047241cf38dae3c6a577561c740a9024bf3 (diff)
downloadgdb-b9d6130764916fac3d9bcfde2d672053a0ef3316.zip
gdb-b9d6130764916fac3d9bcfde2d672053a0ef3316.tar.gz
gdb-b9d6130764916fac3d9bcfde2d672053a0ef3316.tar.bz2
"enable count" user input error handling (PR gdb/15678)
Typing "enable count" by itself crashes GDB. Also, if you omit the breakpoint number/range, the error message is not very clear: (gdb) enable count 2 warning: bad breakpoint number at or near '' (gdb) enable count Segmentation fault (core dumped) With this patch, the error messages are slightly more helpful: (gdb) enable count 2 Argument required (one or more breakpoint numbers). (gdb) enable count Argument required (hit count). gdb/ChangeLog: PR gdb/15678 * breakpoint.c (map_breakpoint_numbers): Check for empty args string. (enable_count_command): Check args for NULL value. gdb/testsuite/ChangeLog: PR gdb/15678 * gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/ena-dis-br.exp8
2 files changed, 13 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f8ca4e8..c458bd7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-06 Simon Marchi <simon.marchi@ericsson.com>
+
+ PR gdb/15678
+ * gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
+
2015-02-06 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-many-short-lived-threads.c (SECONDS): New
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index adb4001..84f84cae 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -151,6 +151,14 @@ set bp [break_at $bp_location7 "line $bp_location7"]
set bp2 [break_at marker1 " line $bp_location15"]
+gdb_test "enable count" \
+ "Argument required \\(hit count\\)\\." \
+ "enable count missing arguments"
+
+gdb_test "enable count 2" \
+ "Argument required \\(one or more breakpoint numbers\\)\\." \
+ "enable count missing breakpoint number"
+
gdb_test_no_output "enable count 2 $bp" "disable break with count"
gdb_test "continue" \