From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GA+9G3HnTGGFIQAAWB0awg (envelope-from ) for ; Thu, 23 Sep 2021 16:45:37 -0400 Received: by simark.ca (Postfix, from userid 112) id 6736F1EE25; Thu, 23 Sep 2021 16:45:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AAE321EE14 for ; Thu, 23 Sep 2021 16:45:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 653223857C53 for ; Thu, 23 Sep 2021 20:45:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 653223857C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632429936; bh=xcILNFI07iWgPhZh19fURidIUwCn/IgSznEy2iIvD5o=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xCYWRXTfLtIiOq1fUC3w8ZCDWBGtaXfWZ8fWuCixngQG/e4Q3epRI62a2vj9I5cxd zSsPKDOor6K7PYl8nZv2fyef/Qp3+x74eD3z7pm1DnaU15lMY/HvJ9NWpkEvRbxVHZ nrm+jPXb/ap0SxQIfalIEAGn2aAg93MRTKHSAhk4= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 729EA385803F for ; Thu, 23 Sep 2021 20:43:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 729EA385803F Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A07E422389 for ; Thu, 23 Sep 2021 20:43:31 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8ED2C13EAA for ; Thu, 23 Sep 2021 20:43:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bu/HIfPmTGENGwAAMHmgww (envelope-from ) for ; Thu, 23 Sep 2021 20:43:31 +0000 Date: Thu, 23 Sep 2021 22:43:30 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix probe test in gdb.base/break-interp.exp Message-ID: <20210923204328.GA31968@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.base/break-interp.exp on ubuntu 18.04.5, we have: ... (gdb) bt^M #0 0x00007eff7ad5ae12 in ?? () from break-interp-LDprelinkNOdebugNO^M #1 0x00007eff7ad71f50 in ?? () from break-interp-LDprelinkNOdebugNO^M #2 0x00007eff7ad59128 in ?? () from break-interp-LDprelinkNOdebugNO^M #3 0x00007eff7ad58098 in ?? () from break-interp-LDprelinkNOdebugNO^M #4 0x0000000000000002 in ?? ()^M #5 0x00007fff505d7a32 in ?? ()^M #6 0x00007fff505d7a94 in ?? ()^M #7 0x0000000000000000 in ?? ()^M (gdb) FAIL: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: \ first backtrace: dl bt ... Using the backtrace, the test-case tries to establish that we're stopped in dl_main. However, the backtrace only shows an address, because: - the dynamic linker contains no minimal symbols and no debug info, and - gdb is build without --with-separate-debug-dir so it can't find the corresponding .debug file, which does contain the mimimal symbols and debug info. As in "[gdb/testsuite] Improve probe detection in gdb.base/break-probes.exp", fix this by doing info probes and grepping for the address. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix probe test in gdb.base/break-interp.exp --- gdb/testsuite/gdb.base/break-interp.exp | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp index 545e365b8b5..fd2b166de5d 100644 --- a/gdb/testsuite/gdb.base/break-interp.exp +++ b/gdb/testsuite/gdb.base/break-interp.exp @@ -84,6 +84,16 @@ gdb_test_multiple $test $test { } set interp_system [section_get [standard_output_file $binfile_test] .interp] +clean_restart $interp_system +set dl_main_found 0 +gdb_test_multiple "info addr dl_main" "" { + -re -wrap "Symbol \"dl_main\" is a function at address $hex\\." { + set dl_main_found 1 + } + -re -wrap "No symbol \"dl_main\" in current context\\." { + } +} + set interp_system_debug [system_debug_get $interp_system] verbose -log "$interp_system has debug $interp_system_debug" @@ -381,6 +391,7 @@ proc test_attach {file displacement {relink_args ""}} { proc test_ld {file ifmain trynosym displacement} { global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp + global hex dl_main_found # First test normal `file'-command loaded $FILE with symbols. @@ -413,7 +424,28 @@ proc test_ld {file ifmain trynosym displacement} { with_test_prefix "first backtrace" { gdb_test_no_output "set verbose off" - gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" + gdb_test_multiple "bt" "dl bt" { + -re -wrap "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" { + pass $gdb_test_name + } + -re -wrap "#0 ($hex) .*" { + if { $dl_main_found } { + fail $gdb_test_name + } else { + set pc $expect_out(1,string) + regsub "0x0*" $pc "" pc + gdb_test "p /x 0x$pc" ".*" + gdb_test_multiple "info probes stap rtld" $gdb_test_name { + -re -wrap "(?:init_start|init_complete) +0x0*$pc .*" { + pass $gdb_test_name + } + -re -wrap "" { + fail $gdb_test_name + } + } + } + } + } gdb_test_no_output "set verbose on" }