From patchwork Wed Nov 16 11:22:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60691 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9540D3959C88 for ; Wed, 16 Nov 2022 11:23:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9540D3959C88 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668597781; bh=bocapVMIXyTnz3w7RQVdVTxPz0t8oXN8/bSejFezcTA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UgJXafCeVxi77C1+pau665AYKcDIuBQwK6cBhLX87iEeJdcdCO7fZtNOavX+pUQYk obkl/jOtXZ7rWxOi3e7Xm6/mwMJhoCDi8JJo0C26doBqyweybcjf1VFqe+8sQRAkAX DuQNoFrW8lT4yce6VKxD/nDSBeJSjmwuC3Exwbpo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 5BBA93945C14 for ; Wed, 16 Nov 2022 11:22:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BBA93945C14 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-out2.suse.de (Postfix) with ESMTPS id 96F0B1F912 for ; Wed, 16 Nov 2022 11:22:36 +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 82704134CE for ; Wed, 16 Nov 2022 11:22:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Z9WnHvzHdGOsagAAMHmgww (envelope-from ) for ; Wed, 16 Nov 2022 11:22:36 +0000 To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp Date: Wed, 16 Nov 2022 12:22:36 +0100 Message-Id: <20221116112236.24224-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When running test-case gdb.base/bt-on-fatal-signal.exp on powerpc64le-linux I noticed: ... FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: scan for backtrace (timeout) ... The timeout is 10 seconds, but generating the core file takes more than a minute, probably due to slow NFS. I managed to reproduce this behaviour independently of gdb, by compiling "int main (void) { __builtin_abort (); }" and running it, which took 1.5 seconds for a core file 50 times smaller than the one for gdb. Fix this by preventing the core file from being generated, using a wrapper around gdb that does "ulimit -c 0". Tested on x86_64-linux. --- gdb/testsuite/gdb.base/bt-on-fatal-signal.exp | 5 ++++- gdb/testsuite/lib/gdb.exp | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) base-commit: 6e5d0bc52fbbfcac6f35f2d014e27afd4506d687 diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp index 8f9d857106d..1af88d50c4c 100644 --- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp +++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp @@ -62,7 +62,10 @@ foreach test_data {{SEGV "Segmentation fault"} \ with_test_prefix ${sig} { # Restart GDB. - clean_restart $binfile + save_vars { GDB } { + set GDB [gdb_no_core] + clean_restart $binfile + } # Capture the pid of GDB. set testpid [spawn_id_get_pid $gdb_spawn_id] diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 042d7ade59f..8b09d548839 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6304,6 +6304,17 @@ proc cached_file { filename txt {executable 0}} { return $filename } +# Return a wrapper around gdb that prevents generating a core file. + +proc gdb_no_core { } { + set script \ + [list \ + "ulimit -c 0" \ + [join [list exec $::GDB {"$@"}]]] + set script [join $script "\n"] + return [cached_file gdb-no-core.sh $script 1] +} + # Set 'testfile', 'srcfile', and 'binfile'. # # ARGS is a list of source file specifications.