From: Jim Blandy Date: Thu, 29 May 2003 23:00:02 +0000 (+0000) Subject: * gdb.base/corefile.exp: Find corefiles on Linux, which names them X-Git-Tag: ezannoni_pie-20030916-branchpoint~1535 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9ecd949862fcccc0af5829d1b5c09b596de91f3;p=external%2Fbinutils.git * gdb.base/corefile.exp: Find corefiles on Linux, which names them 'core.PID'. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f0e5d82..eb505c4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-05-29 Jim Blandy + + * gdb.base/corefile.exp: Find corefiles on Linux, which names them + 'core.PID'. + 2003-05-22 Jim Blandy * gdb.base/corefile.exp: Tolerate stuff after argument parens in diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index 7321777..d059ef5 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -54,16 +54,30 @@ if [get_compiler_info ${binfile}] { # 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". +# 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 -catch "system \"(cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" +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 "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { +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,11 +91,15 @@ if { $found == 0 } { 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 - } +if { $found == 0 } { + warning "can't generate a core file - core tests suppressed - check ulimit -c" + return 0 } #