From 507dd60e28d0ef35ffb7c0880933d6b88cc3f5bd Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 29 Jul 2019 16:24:57 +0200 Subject: [PATCH] [gdb/testsuite, 1/2] Fix gdb.linespec/explicit.exp with check-read1 When running gdb.linespec/explicit.exp with check-read1, we get: ... (gdb) PASS: gdb.linespec/explicit.exp: complete unique file name: break -source "3explicit.c" break -source exp^Glicit^G^M explicit.c explicit2.c ^M (gdb) FAIL: gdb.linespec/explicit.exp: complete non-unique file name ... The problem is that we have a gdb_test_multiple where we match two regexps: ... set tst "complete non-unique file name" send_gdb "break -source exp\t" gdb_test_multiple "" $tst { -re "break -source exp\\\x07licit" { ... } -re "break -source exp\\\x07l" { # This pattern may occur when glibc debuginfo is installed. ... } } ... but since second is a substring of the first, we'll usually match the first, but with check-read1 we'll match the second. Fix this by using a single regexp and merging the related code. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries * gdb.linespec/explicit.exp: Fix gdb_test_multiple regexps where second is a substring of the first for "complete non-unique file name". --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.linespec/explicit.exp | 15 +-------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c2f9d6637b5..498f4e47464 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-29 Tom de Vries + + * gdb.linespec/explicit.exp: Fix gdb_test_multiple regexps where second + is a substring of the first for "complete non-unique file name". + 2019-07-29 Tom de Vries * gdb.python/python.exp: Don't terminate gdb_test_multiple regexp diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp index 11656ca5c5d..90181b3acba 100644 --- a/gdb/testsuite/gdb.linespec/explicit.exp +++ b/gdb/testsuite/gdb.linespec/explicit.exp @@ -241,20 +241,7 @@ namespace eval $testfile { -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" { - send_gdb "\n" - gdb_test "" \ - {Source filename requires function, label, or line offset.} \ - $tst - } - } - } - - -re "break -source exp\\\x07l" { - # This pattern may occur when glibc debuginfo is installed. - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+expl.*\r\n$gdb_prompt" { + -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\(expl.*\)?\r\n$gdb_prompt" { send_gdb "\n" gdb_test "" \ {Source filename requires function, label, or line offset.} \ -- 2.30.2