aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.linespec
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2021-12-07 22:26:05 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-02-02 16:27:36 +0000
commit82d0a72cdc9ca6cd37a8987e2bcd2eb707c51149 (patch)
tree871b135651665b27e60d77fd25022ce98b6df31b /gdb/testsuite/gdb.linespec
parent3c5fcec6dccb0e598d1e64640e55d50ed3ddedb6 (diff)
downloadgdb-82d0a72cdc9ca6cd37a8987e2bcd2eb707c51149.zip
gdb-82d0a72cdc9ca6cd37a8987e2bcd2eb707c51149.tar.gz
gdb-82d0a72cdc9ca6cd37a8987e2bcd2eb707c51149.tar.bz2
gdb: handle calls to edit command passing only a linespec condition
While working on the previous commit to fix PR cli/28665, I noticed that the 'edit' command would suffer from the same problem. That is, something like: (gdb) edit task 123 would cause GDB to break. For a full explanation of what's going on here, see the commit message for the previous commit. As with the previous commit, this issue can be prevented by detecting, and throwing, a junk at the end of the line error earlier, before calling decode_line_1. So, that's what this commit does. I've also added some tests for this issue. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28665
Diffstat (limited to 'gdb/testsuite/gdb.linespec')
-rw-r--r--gdb/testsuite/gdb.linespec/errors.exp26
1 files changed, 16 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.linespec/errors.exp b/gdb/testsuite/gdb.linespec/errors.exp
index e258f6b..c895e25 100644
--- a/gdb/testsuite/gdb.linespec/errors.exp
+++ b/gdb/testsuite/gdb.linespec/errors.exp
@@ -29,13 +29,19 @@ gdb_test "list fooc:/foo/bar/baz.c:1" "No source file named fooc."
gdb_test "list fooc:/foo/bar/baz.c" "No source file named fooc."
# PR cli/28665, gdb/28797
-gdb_test "list task 123" \
- "Junk at end of line specification\\."
-gdb_test "list if (0)" \
- "Junk at end of line specification\\."
-gdb_test "list thread 1" \
- "Junk at end of line specification\\."
-gdb_test "list -force-condition" \
- "Junk at end of line specification\\."
-gdb_test "list ,," \
- "Junk at end of line specification\\."
+save_vars { env(EDITOR) } {
+ setenv EDITOR true
+
+ foreach cmd {list edit} {
+ gdb_test "${cmd} task 123" \
+ "Junk at end of line specification\\."
+ gdb_test "${cmd} if (0)" \
+ "Junk at end of line specification\\."
+ gdb_test "${cmd} thread 1" \
+ "Junk at end of line specification\\."
+ gdb_test "${cmd} -force-condition" \
+ "Junk at end of line specification\\."
+ gdb_test "${cmd} ,," \
+ "Junk at end of line specification\\."
+ }
+}