From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 108583988401 for ; Thu, 10 Jun 2021 17:27:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 108583988401 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-IX_MOFsNORaxhTvMpZ_UNA-1; Thu, 10 Jun 2021 13:27:37 -0400 X-MC-Unique: IX_MOFsNORaxhTvMpZ_UNA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D70F6100CF64 for ; Thu, 10 Jun 2021 17:27:36 +0000 (UTC) Received: from f33-1.lan (ovpn-113-207.phx2.redhat.com [10.3.113.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id B132710016F8; Thu, 10 Jun 2021 17:27:36 +0000 (UTC) From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [PATCH 3/4] print-symbol-loading.exp: Allow libc symbols to be already loaded Date: Thu, 10 Jun 2021 10:26:40 -0700 Message-Id: <20210610172641.1052704-4-kevinb@redhat.com> In-Reply-To: <20210610172641.1052704-1-kevinb@redhat.com> References: <20210610172641.1052704-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2021 17:27:40 -0000 One consequence of changing libpthread_name_p() in solib.c to (also) match libc is that the symbols for libc will now be loaded by solib_add() in solib.c. I think this is mostly harmless because we'll likely want these symbols to be loaded anyway, but it did cause two failures in gdb.base/print-symbol-loading.exp. Specifically... 1) sharedlibrary .* (gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib now looks like this: sharedlibrary .* Symbols already loaded for /lib64/libc.so.6 (gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib 2) sharedlibrary .* Loading symbols for shared libraries: .* (gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib now looks like this: sharedlibrary .* Loading symbols for shared libraries: .* Symbols already loaded for /lib64/libc.so.6 (gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib Fixing case #2 ended up being easier than #1. #1 had been using gdb_test_no_output to correctly match this no-output case. I ended up replacing it with gdb_test_multiple, matching the exact expected output for each of the two now acceptable cases. For case #2, I simply added an optional non-capturing group for the potential new output. gdb/testsuite/ChangeLog: * gdb.base/print-symbol-loading.exp (proc test_load_shlib): Allow "Symbols already loaded for..." messages. --- gdb/testsuite/gdb.base/print-symbol-loading.exp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp index b8eb1c844bd..6e176de351e 100644 --- a/gdb/testsuite/gdb.base/print-symbol-loading.exp +++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp @@ -96,6 +96,7 @@ test_load_core full proc test_load_shlib { print_symbol_loading } { global binfile + global gdb_prompt with_test_prefix "shlib ${print_symbol_loading}" { clean_restart ${binfile} gdb_test_no_output "set auto-solib-add off" @@ -106,12 +107,20 @@ proc test_load_shlib { print_symbol_loading } { set test_name "load shared-lib" switch ${print_symbol_loading} { "off" { - gdb_test_no_output "sharedlibrary .*" \ - ${test_name} + set cmd "sharedlibrary .*" + set cmd_regex [string_to_regexp $cmd] + gdb_test_multiple $cmd $test_name { + -re "^$cmd_regex\r\n$gdb_prompt $" { + pass $test_name + } + -re "^$cmd_regex\r\nSymbols already loaded for.*?\\/libc\\..*?\r\n$gdb_prompt $" { + pass $test_name + } + } } "brief" { gdb_test "sharedlibrary .*" \ - "Loading symbols for shared libraries: \\.\\*" \ + "Loading symbols for shared libraries: \\.\\*.*?(?:Symbols already loaded for .*?libc)?" \ ${test_name} } "full" { -- 2.31.1