gdb: add missing test for completion of invalid /FMT strings

This commit:

  commit 3df8c6afdd
  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.
This commit is contained in:
Andrew Burgess 2021-01-08 10:27:58 +00:00
parent ed20522215
commit d00f086803
2 changed files with 9 additions and 0 deletions

View 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.

View 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"