This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix regression in "commands"
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 7 Dec 2017 21:53:02 -0000
- Subject: [binutils-gdb] Fix regression in "commands"
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=99598d713f45d1b26015ec3562d160dc2b3792e4
commit 99598d713f45d1b26015ec3562d160dc2b3792e4
Author: Tom Tromey <tom@tromey.com>
Date: Fri Nov 3 10:26:11 2017 -0600
Fix regression in "commands"
Pedro pointed out a regression in "commands", where trying to clear a
breakpoint's command list would fail:
(top-gdb) commands
Type commands for breakpoint(s) 3, one per line.
End with a line saying just "end".
>end
No breakpoints specified.
(top-gdb)
I believe the bug was introduced by my patch that changes
counted_command_line to be a shared_ptr. This causes the problem
because now the counted_command_line in commands_command_1 can be NULL,
whereas previously it never could be.
After some discussion, we agreed to simply remove the error case from
commands_command_1.
2017-12-07 Tom Tromey <tom@tromey.com>
PR breakpoints/22511:
* breakpoint.c (commands_command_1): Don't throw an exception when
no commands have been read.
2017-12-07 Tom Tromey <tom@tromey.com>
* gdb.base/break.exp: Add test for empty "commands".
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/breakpoint.c | 3 ---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.base/break.exp | 12 ++++++++++++
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8344f6e..3a74e7d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-07 Tom Tromey <tom@tromey.com>
+
+ PR breakpoints/22511:
+ * breakpoint.c (commands_command_1): Don't throw an exception when
+ no commands have been read.
+
2017-12-07 Adam Stylinski <adam.stylinski@etegent.com>
PR c++/21222
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 76bfd53..59a4dad 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1272,9 +1272,6 @@ commands_command_1 (const char *arg, int from_tty,
observer_notify_breakpoint_modified (b);
}
});
-
- if (cmd == NULL)
- error (_("No breakpoints specified."));
}
static void
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7becd10..acad330 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-07 Tom Tromey <tom@tromey.com>
+
+ * gdb.base/break.exp: Add test for empty "commands".
+
2017-12-07 Yao Qi <yao.qi@linaro.org>
* gdb.trace/ftrace.exp (run_trace_experiment): Set breakpoint on
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index 96e2f35..87db2dc 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -854,3 +854,15 @@ gdb_test_no_output "set \$foo=81.5" \
gdb_test "break $srcfile:\$foo" \
"Convenience variables used in line specs must have integer values.*" \
"set breakpoint via non-integer convenience variable disallowed"
+
+
+#
+# Test that commands can be cleared without error.
+#
+
+gdb_test "commands\nprint 232323\nend" ">end" "set some breakpoint commands"
+gdb_test "commands\nend" ">end" "clear breakpoint commands"
+# We verify that the commands were cleared by ensuring that the last
+# breakpoint's location ends the output -- if there were commands,
+# they would have been printed after the location.
+gdb_test "info break" "$srcfile:$line" "verify that they were cleared"