Fix gdb.linespec/explicit.exp
This patch addresses timeout failures i noticed while testing aarch64-elf.
FAIL: gdb.linespec/explicit.exp: complete unique function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-unique function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-existant function name (timeout)
FAIL: gdb.linespec/explicit.exp: complete unique file name (timeout)
FAIL: gdb.linespec/explicit.exp: complete non-unique file name (timeout)
The timeouts were caused by an attempt to match a bell character (x07) that
doesn't show up on my particular test setup.
The bell character is output whenever one tries to complete a pattern and there
are multiple possible matches. When there is only one possible match, GDB will
complete the input pattern without outputting the bell character.
The reason for the discrepancy in this test's behavior is due to the use of
"main" for a unique name test.
On glibc-based systems, GDB may notice the "main_arena" symbol, which is
a data global part of glibc's malloc implementation. Therefore a bell character
will be output because we have a couple possible completion matches.
GDB should not be outputting such a data symbol as a possible match, but this
problem may/will be addressed in a future change and is besides the point of
this particular change.
On systems that are not based on glibc, GDB will not see any other possible
matches for completing "main", so there will be no bell characters.
The use of main is a bit fragile though, so the patch adds a new local function
with a name that has a greater chance of being unique and adjusts the test to
iuse it.
I've also added the regular expression switch (-re) to all the
gdb_test_multiple calls that were missing it. Hopefully this will reduce the
chances of someone wasting time trying to match a regular expression (a much
more common use case) when, in reality, the pattern is supposed to be matched
literally.
gdb/testsuite/ChangeLog
2017-02-13 Luis Machado <lgustavo@codesourcery.com>
* gdb.linespec/explicit.c (my_unique_function_name): New function.
(main): Call my_unique_function_name.
* gdb.linespec/explicit.exp: Use my_unique_function_name to test
completion of patterns with a single match.
Add missing -re switches to gdb_test_multiple calls.