From d00f086803f2213bf4406278cd3e83d935e27096 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 8 Jan 2021 10:27:58 +0000 Subject: [PATCH] gdb: add missing test for completion of invalid /FMT strings This commit: commit 3df8c6afdd6d38a7622ff5f4b1a64aff80334ab9 Date: Fri Nov 27 10:46:07 2020 +0000 gdb: fix potentially uninitialised variable Was pushed with no test. Naughty! The new test checks how GDB behaves when completing an invalid /FMT string. Currently GDB does no validation of the /FMT string during tab completion, and just assumes that any /FMT string is valid and complete when the user hits TAB. So: (gdb) p/@@ Will give: (gdb) p/@@ We already had a test in place for completion on a valid /FMT string, but the above commit fixed a bug in the logic for completing invalid /FMT strings. Now we have a test for this too. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Add a new test. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/completion.exp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c53905738ea..0c5e3604c8e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2021-01-08 Andrew Burgess + + * gdb.base/completion.exp: Add a new test. + 2021-01-08 Andrew Burgess * gdb.fortran/intvar-dynamic-types.exp: New file. diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 98bca554e3a..076134cdc33 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -938,6 +938,11 @@ foreach_with_prefix spc { " " "" } { test_gdb_complete_none "p${spc}/" test_gdb_complete_unique "p${spc}/d" "p${spc}/d" + # Try completion on an invalid /FMT string. GDB doesn't attempt + # to validate the /FMT string during completion, the string is + # just assumed to be complete when the user hits TAB. + test_gdb_complete_unique "p${spc}/@" "p${spc}/@" + test_gdb_complete_unique "x${spc}/1w values\[0\].b"\ "x${spc}/1w values\[0\].b_field" -- 2.30.2