From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id CBB713858296; Sat, 26 Nov 2022 13:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBB713858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669469378; bh=M3YZ3FeJB7+fBC40bIueNBHYtaycuGHrWWCzWKKerIM=; h=From:To:Subject:Date:From; b=sqSlOkQjElziwydvUlD+uFdFZtF2HXDJC7/UFmQc0h7GyEcIrks5ndM1mcYowht8I QSiAxSpkfPqlv4V426fj98GgkS4oR2rTx0nk0V1JHZeAt8ubJuR6vBiOtyv5RHkso6 5ehlE9iAz+6X5jxtQEcp36phvwM91Q61Ws0TuPLI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 05ad0d60341f0933501dc90002da3d4594c30438 X-Git-Newrev: 7a0daa48da726f9c05a752e85fefe128bf848916 Message-Id: <20221126132938.CBB713858296@sourceware.org> Date: Sat, 26 Nov 2022 13:29:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7a0daa48da72= 6f9c05a752e85fefe128bf848916 commit 7a0daa48da726f9c05a752e85fefe128bf848916 Author: Tom de Vries Date: Sat Nov 26 14:29:10 2022 +0100 [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp =20 When running test-case gdb.base/bt-on-fatal-signal.exp on powerpc64le-l= inux I noticed: ... FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: scan for backtrace (timeou= t) ... =20 The timeout is 10 seconds, but generating the core file takes more than= a minute, probably due to slow NFS. =20 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. =20 Fix this by preventing the core file from being generated, using a wrap= per around gdb that does "ulimit -c 0". =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/gdb.base/bt-on-fatal-signal.exp | 5 ++++- gdb/testsuite/lib/gdb.exp | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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} { =20 # Restart GDB. - clean_restart $binfile + save_vars { GDB } { + set GDB [gdb_no_core] + clean_restart $binfile + } =20 # 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 7d05fbe557b..a73437a419f 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6322,6 +6322,17 @@ proc cached_file { filename txt {executable 0}} { return $filename } =20 +# 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.