gdb: add missing test for completion of invalid /FMT strings
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 8 Jan 2021 10:27:58 +0000 (10:27 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 8 Jan 2021 15:30:18 +0000 (15:30 +0000)
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/@@<TAB>

Will give:

  (gdb) p/@@ <CURSOR IS HERE>

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
gdb/testsuite/gdb.base/completion.exp

index c53905738ea1fa1e904a34ff0e4acbc61bfcf81c..0c5e3604c8e4b786b21d4cd22c2becbf4c92cecd 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-08  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.base/completion.exp: Add a new test.
+
 2021-01-08  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.fortran/intvar-dynamic-types.exp: New file.
index 98bca554e3a36647a377871e83f5a652af5ec30b..076134cdc330b553db25f4491a86969aba9558c4 100644 (file)
@@ -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"
 
This page took 0.03372 seconds and 4 git commands to generate.