Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: find core dumps on Linux
@ 2003-05-22 22:30 Jim Blandy
  2003-05-22 22:49 ` Daniel Jacobowitz
  2003-06-23 21:08 ` Elena Zannoni
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Blandy @ 2003-05-22 22:30 UTC (permalink / raw)
  To: gdb-patches


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.

2003-05-22  Jim Blandy  <jimb@redhat.com>

	* 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
  }
  
  #


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: find core dumps on Linux
  2003-05-22 22:30 RFC: find core dumps on Linux Jim Blandy
@ 2003-05-22 22:49 ` Daniel Jacobowitz
  2003-05-29 23:02   ` Jim Blandy
  2003-06-23 21:08 ` Elena Zannoni
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-05-22 22:49 UTC (permalink / raw)
  To: gdb-patches

On Thu, May 22, 2003 at 05:37:52PM -0500, Jim Blandy wrote:
> 
> 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.

Seems reasonable to me.  It'll clean up better than before, too.

> 2003-05-22  Jim Blandy  <jimb@redhat.com>
> 
> 	* gdb.base/corefile.exp: Find corefiles on Linux, which names them
> 	'core.PID'.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: find core dumps on Linux
  2003-05-22 22:49 ` Daniel Jacobowitz
@ 2003-05-29 23:02   ` Jim Blandy
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Blandy @ 2003-05-29 23:02 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches


I've committed this.

Daniel Jacobowitz <drow@mvista.com> writes:

> On Thu, May 22, 2003 at 05:37:52PM -0500, Jim Blandy wrote:
> > 
> > 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.
> 
> Seems reasonable to me.  It'll clean up better than before, too.
> 
> > 2003-05-22  Jim Blandy  <jimb@redhat.com>
> > 
> > 	* gdb.base/corefile.exp: Find corefiles on Linux, which names them
> > 	'core.PID'.
> 
> -- 
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: find core dumps on Linux
  2003-05-22 22:30 RFC: find core dumps on Linux Jim Blandy
  2003-05-22 22:49 ` Daniel Jacobowitz
@ 2003-06-23 21:08 ` Elena Zannoni
  1 sibling, 0 replies; 5+ messages in thread
From: Elena Zannoni @ 2003-06-23 21:08 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

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  <jimb@redhat.com>
 > 
 > 	* 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
 >   }
 >   
 >   #


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: find core dumps on Linux
@ 2003-06-24  3:03 Michael Elizabeth Chastain
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2003-06-24  3:03 UTC (permalink / raw)
  To: ezannoni, jimb; +Cc: gdb-patches

> I think this is ok, and useful. Should go on the branch as well.

It got committed before the branch was cut, so it's on the branch.
And I really appreciate this patch -- it helped me find a bug
that I filed a PR for (pr gdb/1250).

Michael C

===

2003-05-22  Jim Blandy  <jimb@redhat.com>

	* gdb.base/corefile.exp: Find corefiles on Linux, which names them
	'core.PID'.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-06-24  3:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-22 22:30 RFC: find core dumps on Linux Jim Blandy
2003-05-22 22:49 ` Daniel Jacobowitz
2003-05-29 23:02   ` Jim Blandy
2003-06-23 21:08 ` Elena Zannoni
2003-06-24  3:03 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox