- Fix crash on 'enable count' (Simon Marchi, BZ 993118). - Fix the changlog entry formatting for 6.3.0.0-0.1.
87 lines
2.6 KiB
Diff
87 lines
2.6 KiB
Diff
http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html
|
|
Subject: [PATCH] "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).
|
|
|
|
They are not as helpful to the user as I would like, but it's better
|
|
than crashing. Suggestions are welcome.
|
|
|
|
Simon
|
|
|
|
gdb/ChangeLog:
|
|
2013-06-26 Simon Marchi <simon.marchi@ericsson.com>
|
|
|
|
* breakpoint.c (map_breakpoint_numbers): Check for empty args
|
|
string.
|
|
(enable_count_command): Check args for NULL value.
|
|
|
|
gdb/testsuite/ChangeLog:
|
|
2013-06-26 Simon Marchi <simon.marchi@ericsson.com>
|
|
|
|
* gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
|
|
---
|
|
gdb/breakpoint.c | 9 +++++++--
|
|
gdb/testsuite/gdb.base/ena-dis-br.exp | 8 ++++++++
|
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
|
index ccd05d9..5a0c5ab 100644
|
|
--- a/gdb/breakpoint.c
|
|
+++ b/gdb/breakpoint.c
|
|
@@ -14389,7 +14389,7 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *,
|
|
int match;
|
|
struct get_number_or_range_state state;
|
|
|
|
- if (args == 0)
|
|
+ if (args == 0 || *args == '\0')
|
|
error_no_arg (_("one or more breakpoint numbers"));
|
|
|
|
init_number_or_range (&state, args);
|
|
@@ -14713,7 +14713,12 @@ do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr)
|
|
static void
|
|
enable_count_command (char *args, int from_tty)
|
|
{
|
|
- int count = get_number (&args);
|
|
+ int count;
|
|
+
|
|
+ if (args == NULL)
|
|
+ error_no_arg (_("hit count"));
|
|
+
|
|
+ count = get_number (&args);
|
|
|
|
map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
|
|
}
|
|
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
|
|
index b08b709..82aef64 100644
|
|
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
|
|
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
|
|
@@ -173,6 +173,14 @@ set bp [break_at $bp_location7 "line $bp_location7"]
|
|
|
|
set bp2 [break_at marker1 " line ($bp_location15|$bp_location16)"]
|
|
|
|
+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 last argument"
|
|
+
|
|
gdb_test_no_output "enable count 2 $bp" "disable break with count"
|
|
|
|
gdb_test "continue" \
|
|
|