aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
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
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')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.linespec/explicit.c15
-rw-r--r--gdb/testsuite/gdb.linespec/explicit.exp30
3 files changed, 38 insertions, 15 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index db1a4a5..bd81ad2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2017-02-13 Luis Machado <lgustavo@codesourcery.com>
+
* gdb.arch/i386-biarch-core.exp: Check for i386 arch support and
return if core file is not recognized.
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);
}
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index 637f476..65d78ca 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -154,7 +154,7 @@ namespace eval $testfile {
set tst "complete 'break -$abbrev'"
send_gdb "break -${abbrev}\t"
gdb_test_multiple "" $tst {
- "break -$full " {
+ -re "break -$full " {
send_gdb "\n"
gdb_test_multiple "" $tst {
-re "missing argument for \"-$full\".*$gdb_prompt " {
@@ -185,9 +185,9 @@ namespace eval $testfile {
}
set tst "complete unique function name"
- send_gdb "break -function mai\t"
+ send_gdb "break -function my_unique_func\t"
gdb_test_multiple "" $tst {
- "break -function mai\\\x07n" {
+ -re "break -function my_unique_function_name" {
send_gdb "\n"
gdb_test "" ".*Breakpoint \[0-9\]+.*" $tst
gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint"
@@ -197,7 +197,7 @@ namespace eval $testfile {
set tst "complete non-unique function name"
send_gdb "break -function myfunc\t"
gdb_test_multiple "" $tst {
- "break -function myfunc\\\x07tion" {
+ -re "break -function myfunc\\\x07tion" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
-re "\\\x07\r\nmyfunction\[ \t\]+myfunction2\[ \t\]+myfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " {
@@ -211,7 +211,7 @@ namespace eval $testfile {
set tst "complete non-existant function name"
send_gdb "break -function foo\t"
gdb_test_multiple "" $tst {
- "break -function foo\\\x07" {
+ -re "break -function foo\\\x07" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
-re "\\\x07\\\x07" {
@@ -225,7 +225,7 @@ namespace eval $testfile {
set tst "complete unique file name"
send_gdb "break -source 3ex\t"
gdb_test_multiple "" $tst {
- "break -source 3explicit.c " {
+ -re "break -source 3explicit.c " {
send_gdb "\n"
gdb_test "" \
{Source filename requires function, label, or line offset.} $tst
@@ -235,7 +235,7 @@ namespace eval $testfile {
set tst "complete non-unique file name"
send_gdb "break -source exp\t"
gdb_test_multiple "" $tst {
- "break -source exp\\\x07licit" {
+ -re "break -source exp\\\x07licit" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
-re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\r\n$gdb_prompt" {
@@ -247,7 +247,7 @@ namespace eval $testfile {
}
}
- "break -source exp\\\x07l" {
+ -re "break -source exp\\\x07l" {
# This pattern may occur when glibc debuginfo is installed.
send_gdb "\t\t"
gdb_test_multiple "" $tst {
@@ -264,10 +264,10 @@ namespace eval $testfile {
set tst "complete non-existant file name"
send_gdb "break -source foo\t"
gdb_test_multiple "" $tst {
- "break -source foo" {
+ -re "break -source foo" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
- "\\\x07\\\x07" {
+ -re "\\\x07\\\x07" {
send_gdb "\n"
gdb_test "" \
{Source filename requires function, label, or line offset.} \
@@ -280,7 +280,7 @@ namespace eval $testfile {
set tst "complete filename and unique function name"
send_gdb "break -source explicit.c -function ma\t"
gdb_test_multiple "" $tst {
- "break -source explicit.c -function main " {
+ -re "break -source explicit.c -function main " {
send_gdb "\n"
gdb_test "" ".*Breakpoint .*" $tst
gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint"
@@ -290,7 +290,7 @@ namespace eval $testfile {
set tst "complete filename and non-unique function name"
send_gdb "break -so 3explicit.c -func myfunc\t"
gdb_test_multiple "" $tst {
- "break -so 3explicit.c -func myfunc\\\x07tion" {
+ -re "break -so 3explicit.c -func myfunc\\\x07tion" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
-re "\\\x07\r\nmyfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " {
@@ -304,10 +304,10 @@ namespace eval $testfile {
set tst "complete filename and non-existant function name"
send_gdb "break -sou 3explicit.c -fun foo\t"
gdb_test_multiple "" $tst {
- "break -sou 3explicit.c -fun foo\\\x07" {
+ -re "break -sou 3explicit.c -fun foo\\\x07" {
send_gdb "\t\t"
gdb_test_multiple "" $tst {
- "\\\x07\\\x07" {
+ -re "\\\x07\\\x07" {
send_gdb "\n"
gdb_test "" \
{Function "foo" not defined in "3explicit.c".} $tst
@@ -319,7 +319,7 @@ namespace eval $testfile {
set tst "complete filename and function reversed"
send_gdb "break -func myfunction4 -source 3ex\t"
gdb_test_multiple "" $tst {
- "break -func myfunction4 -source 3explicit.c " {
+ -re "break -func myfunction4 -source 3explicit.c " {
send_gdb "\n"
gdb_test "" "Breakpoint \[0-9\]+.*" $tst
gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint"