From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ED0fFuT0B2GhSQAAWB0awg (envelope-from ) for ; Mon, 02 Aug 2021 09:36:36 -0400 Received: by simark.ca (Postfix, from userid 112) id 54C671EDFB; Mon, 2 Aug 2021 09:36:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 A3C0E1E4A3 for ; Mon, 2 Aug 2021 09:36:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 684D03836022 for ; Mon, 2 Aug 2021 13:36:35 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D84B43839835 for ; Mon, 2 Aug 2021 13:33:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D84B43839835 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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-out2.suse.de (Postfix) with ESMTPS id 0BC811FF98 for ; Mon, 2 Aug 2021 13:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627911217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=P6zSt6G8hqjf2tnO7em4c8oFPwspCjAuZ4vJFwxw8/c=; b=ymZ4TjWcFltiJJ+X5hv0QuoRBPEfh+qhsdcftOMWSCEtv5qxkaEw1dAk1sEeYPT6Ul4UaA 4T0xKT0XH9pTtsDawXpjoQGXHFzbi3jQCZqoXWdV0RIR8PnS/ISuj7bAjVDF0q4IH6nQiM aOAC6NLNsD8fW1gTtuJ4s0gmoTAHabA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627911217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=P6zSt6G8hqjf2tnO7em4c8oFPwspCjAuZ4vJFwxw8/c=; b=6IWYOv2v8y/JBvOTt5vujA8ulB/+dbTyXQXybSqJgQgHiqxW3IxfSD24uKuidaDdjRuIyQ uOpzgqZZNbSRFsAw== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id EDEBC13983 for ; Mon, 2 Aug 2021 13:33:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id JzEUOTD0B2FSZwAAGKfGzw (envelope-from ) for ; Mon, 02 Aug 2021 13:33:36 +0000 Date: Mon, 2 Aug 2021 15:33:35 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-dwz-m Message-ID: <20210802133334.GA8669@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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running with target board cc-with-dwz-m, we run into: ... (gdb) file dw2-using-debug-str-no-debug-str^M Reading symbols from dw2-using-debug-str-no-debug-str...^M (gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str ... With native, the .debug_str section is present in the dw2-using-debug-str executable, and removed from the dw2-using-debug-str-no-debug-str executable. When loading the latter, a dwarf error is triggered. With cc-with-dwz-m, the .debug_str section is not present in the dw2-using-debug-str executable, because it's already moved to .tmp/dw2-using-debug-str.dwz. Consequently, the removal has no effect, and no dwarf error is triggered, which causes the FAIL. The same problem arises with target board cc-with-gnu-debuglink. Fix this by detecting whether the .debug_str section is missing, and skipping the remainder of the test-case. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-dwz-m gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries * gdb.dwarf2/dw2-using-debug-str.exp: Handle missing .debug_str section in dw2-using-debug-str. --- gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp index 09f58d38f7b..e274d0c9ab9 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp @@ -100,6 +100,19 @@ if ![runto_main] { # field names, all of which are stored in the .debug_str section. gdb_test "p global_var" " = \\{aa = 0, bb = 0, cc = 0\\}" +# Verify that the executable actually contains a .debug_str section, before +# trying to remove it. This can be missing with target boards +# cc-with-dwz-m.exp and cc-with-gnu-debuglink.exp. Handle this by +# skipping the remainder of the test-case. +set debug_str_section "${binfile}-debug-str" +set args "--dump-section .debug_str=debug_str_section $binfile" +set result [remote_exec host "[gdb_find_objcopy] $args"] +set status [lindex $result 0] +set output [lindex $result 1] +if { $status == 0 && ![string equal $output ""] } { + return -1 +} + # Now copy the executable, and remove the .debug_str section. This # creates an executable with an invalid DWARF configuration. GDB # should give an error when trying to read the debug information from