aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.linespec/explicit.c
diff options
context:
space:
mode:
authorLuis Machado <lgustavo@codesourcery.com>2017-02-13 07:16:34 -0600
committerLuis Machado <lgustavo@codesourcery.com>2017-02-13 07:16:34 -0600
commitbf5f525c8908b03f4892433baa707310b0b9959d (patch)
treebf904cfb0c0e0272be704b68241351c2170ac919 /gdb/testsuite/gdb.linespec/explicit.c
parent13a66184d0cb485907bfcad15aac0622fd86d25f (diff)
downloadgdb-bf5f525c8908b03f4892433baa707310b0b9959d.zip
gdb-bf5f525c8908b03f4892433baa707310b0b9959d.tar.gz
gdb-bf5f525c8908b03f4892433baa707310b0b9959d.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite/gdb.linespec/explicit.c')
-rw-r--r--gdb/testsuite/gdb.linespec/explicit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.linespec/explicit.c b/gdb/testsuite/gdb.linespec/explicit.c
index 765f62a..f523b0e 100644
--- a/gdb/testsuite/gdb.linespec/explicit.c
+++ b/gdb/testsuite/gdb.linespec/explicit.c
@@ -42,6 +42,19 @@ myfunction (int arg)
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)
{
@@ -52,5 +65,7 @@ main (void)
for (i = 0, j = 0; i < 1000; ++i)
j += myfunction (0);
+ my_unique_function_name (j);
+
return myfunction2 (j);
}