From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2847B385BF81; Wed, 8 Apr 2020 10:05:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2847B385BF81 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix imported-unit.exp FAIL without psymtabs X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: e21d048f8ad95002e61aec25160fa6fabfab21a4 X-Git-Newrev: 14ca8ecfcb8628485f734af4b548933124990436 Message-Id: <20200408100537.2847B385BF81@sourceware.org> Date: Wed, 8 Apr 2020 10:05:37 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2020 10:05:37 -0000 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14ca8ecfcb8628485f734af4b548933124990436 commit 14ca8ecfcb8628485f734af4b548933124990436 Author: Tom de Vries Date: Wed Apr 8 12:05:34 2020 +0200 [gdb/testsuite] Fix imported-unit.exp FAIL without psymtabs The test-case gdb.dwarf2/imported-unit.exp contains a test testing partial symbols, so when we run the test-case using either target board readnow, cc-with-gdb-index or cc-with-debug-names, we run into: ... FAIL: gdb.dwarf2/imported-unit.exp: no static partial symbols in importing unit ... Fix this by marking the test unsupported if there are no partial symbols. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-08 Tom de Vries * lib/gdb.exp (psymtabs_p): New proc. * gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in importing unit" unsupported if there are no partial symbols. Diff: --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.dwarf2/imported-unit.exp | 26 ++++++++++++++++---------- gdb/testsuite/lib/gdb.exp | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 066a41ec5bb..16b982bfc9c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-04-08 Tom de Vries + + * lib/gdb.exp (psymtabs_p): New proc. + * gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in + importing unit" unsupported if there are no partial symbols. + 2020-04-08 Tom de Vries PR testsuite/25760 diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit.exp b/gdb/testsuite/gdb.dwarf2/imported-unit.exp index 80d66283572..41a75054594 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit.exp +++ b/gdb/testsuite/gdb.dwarf2/imported-unit.exp @@ -149,19 +149,25 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ gdb_test_no_output "set language c++" +set psymtabs_p [psymtabs_p] + # Verify that the partial symtab for the unit importing the partial unit does # not contain the static partial symbol int, which is defined in the partial # unit. Test-case for PR25646. -gdb_test "main print psymbols" \ - [multi_line \ - " Depends on 1 other partial symtabs\." \ - "\[^\r\n\]*" \ - " Global partial symbols:" \ - " `main', function, $hex" \ - "" \ - ".*"] \ - "no static partial symbols in importing unit" - +set test "no static partial symbols in importing unit" +if { $psymtabs_p } { + gdb_test "main print psymbols" \ + [multi_line \ + " Depends on 1 other partial symtabs\." \ + "\[^\r\n\]*" \ + " Global partial symbols:" \ + " `main', function, $hex" \ + "" \ + ".*"] \ + $test +} else { + unsupported $test +} # Sanity check gdb_test "ptype main" "= int \\(void\\)" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3bd08816b6d..52687ad89ae 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6998,6 +6998,24 @@ proc readnow { } { return 0 } +# Return 1 if partial symbols are available. Otherwise, return 0. + +proc psymtabs_p { } { + global gdb_prompt + + set cmd "maint info psymtab" + gdb_test_multiple $cmd "" { + -re "$cmd\r\n$gdb_prompt $" { + return 0 + } + -re -wrap "" { + return 1 + } + } + + return 0 +} + # Verify that partial symtab expansion for $filename has state $readin. proc verify_psymtab_expanded { filename readin } {