forked from Imagelibrary/binutils-gdb
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.
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
Copyright 2012-2017 Free Software Foundation, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
extern int myfunction2 (int arg);
|
|
|
|
static int
|
|
myfunction (int arg)
|
|
{
|
|
int i, j, r;
|
|
|
|
j = 0; /* myfunction location */
|
|
r = arg;
|
|
|
|
top:
|
|
++j; /* top location */
|
|
|
|
if (j == 10)
|
|
goto done;
|
|
|
|
for (i = 0; i < 10; ++i)
|
|
{
|
|
r += i;
|
|
if (j % 2)
|
|
goto top;
|
|
}
|
|
|
|
done:
|
|
return r;
|
|
}
|
|
|
|
static int
|
|
my_unique_function_name (int arg)
|
|
{
|
|
int j = 0;
|
|
|
|
/* Just do something random. We only care about the unique function
|
|
name. */
|
|
if (arg == 50)
|
|
j = 10;
|
|
|
|
return j;
|
|
}
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int i, j;
|
|
|
|
/* Call the test function repeatedly, enough times for all our tests
|
|
without running forever if something goes wrong. */
|
|
for (i = 0, j = 0; i < 1000; ++i)
|
|
j += myfunction (0);
|
|
|
|
my_unique_function_name (j);
|
|
|
|
return myfunction2 (j);
|
|
}
|