From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22223 invoked by alias); 23 Jun 2003 21:08:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11363 invoked from network); 23 Jun 2003 21:04:15 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 23 Jun 2003 21:04:15 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h5NL4EH04191 for ; Mon, 23 Jun 2003 17:04:14 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h5NL4EI24064 for ; Mon, 23 Jun 2003 17:04:14 -0400 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h5NL4Dd25691; Mon, 23 Jun 2003 17:04:13 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id 85A272CA2F; Mon, 23 Jun 2003 17:11:01 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16119.27877.29199.109565@localhost.redhat.com> Date: Mon, 23 Jun 2003 21:08:00 -0000 To: Jim Blandy Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: find core dumps on Linux In-Reply-To: References: X-SW-Source: 2003-06/txt/msg00738.txt.bz2 Jim Blandy writes: > > I didn't realize this, but for a very long time, gdb.base/coredump.exp > has been broken on Linux. Linux creates core files named 'core.PID'; > the test suite didn't know how to find them, so it suggested you check > your 'ulimit -c' setting and skipped the tests. I think this is ok, and useful. Should go on the branch as well. elena > > 2003-05-22 Jim Blandy > > * gdb.base/corefile.exp: Find corefiles on Linux, which names them > 'core.PID'. > > Index: gdb/testsuite/gdb.base/corefile.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/corefile.exp,v > retrieving revision 1.5 > diff -c -r1.5 corefile.exp > *** gdb/testsuite/gdb.base/corefile.exp 17 Dec 2001 21:03:48 -0000 1.5 > --- gdb/testsuite/gdb.base/corefile.exp 22 May 2003 22:22:43 -0000 > *************** > *** 54,69 **** > # allows us to generate a core on systems where it does. > # > # Some systems append "core" to the name of the program; others append > ! # the name of the program to "core". > set found 0 > ! catch "system \"(cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" > # remote_exec host "${binfile}" > ! foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { > if [remote_file build exists $i] { > remote_exec build "mv $i ${objdir}/${subdir}/corefile" > set found 1 > } > } > if { $found == 0 } { > # The braindamaged HPUX shell quits after the ulimit -c above > # without executing ${binfile}. So we try again without the > --- 54,83 ---- > # allows us to generate a core on systems where it does. > # > # Some systems append "core" to the name of the program; others append > ! # the name of the program to "core"; still others (like Linux, as of > ! # May 2003) create cores named "core.PID". In the latter case, we > ! # could have many core files lying around, and it may be difficult to > ! # tell which one is ours, so let's run the program in a subdirectory. > set found 0 > ! set coredir "${objdir}/${subdir}/coredir.[getpid]" > ! file mkdir $coredir > ! catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" > # remote_exec host "${binfile}" > ! foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { > if [remote_file build exists $i] { > remote_exec build "mv $i ${objdir}/${subdir}/corefile" > set found 1 > } > } > + # Check for "core.PID". > + if { $found == 0 } { > + set names [glob -nocomplain -directory $coredir core.*] > + if {[llength $names] == 1} { > + set corefile [file join $coredir [lindex $names 0]] > + remote_exec build "mv $corefile ${objdir}/${subdir}/corefile" > + set found 1 > + } > + } > if { $found == 0 } { > # The braindamaged HPUX shell quits after the ulimit -c above > # without executing ${binfile}. So we try again without the > *************** > *** 77,87 **** > set found 1 > } > } > > ! if { $found == 0 } { > ! warning "can't generate a core file - core tests suppressed - check ulimit -c" > ! return 0 > ! } > } > > # > --- 91,105 ---- > set found 1 > } > } > + } > + > + # Try to clean up after ourselves. > + remote_file build delete [file join $coredir coremmap.data] > + remote_exec build "rmdir $coredir" > > ! if { $found == 0 } { > ! warning "can't generate a core file - core tests suppressed - check ulimit -c" > ! return 0 > } > > #