--- run_build.pl.orig 2006-12-28 17:32:14.000000000 -0500 +++ run_build.pl.new 2006-12-29 10:59:39.000000000 -0500 @@ -299,6 +299,20 @@ unlink $forcefile; } +# try to allow core files to be produced. +# another way would be for the calling environment +# to call ulimit. We do this in an eval so failure is +# not fatal. +eval +{ + require BSD::Resource; + BSD::Resource->import(); + # explicit sub calls here using & keeps compiler happy + my $coreok = setrlimit(&RLIMIT_CORE,&RLIM_INFINITY,&RLIM_INFINITY); + die "setrlimit" unless $coreok; +}; +warn "failed to unlimit core size: $@" if $@; + # the time we take the snapshot my $now=time; my $installdir = "$buildroot/$branch/inst"; @@ -795,6 +809,34 @@ $dbstarted=undef; } + +sub get_stack_trace +{ + my $bindir = shift; + my $pgdata = shift; + + # no core = no result + my @cores = glob("$pgdata/core*"); + return () unless @cores; + + # no gdb = no result + system "gdb --version > /dev/null 2>&1"; + my $status = $? >>8; + return () if $status; + + my @trace; + + foreach my $core (@cores) + { + my @onetrace = `gdb -ex bt --batch $bindir/postgres $core 2>&1`; + push(@trace, + "\n\n================== stack trace: $core ==================\n", + @onetrace); + } + + return @trace; +} + sub make_install_check { my @checkout = `cd $pgsql/src/test/regress && $make installcheck 2>&1`; @@ -814,6 +856,11 @@ } close($handle); } + if ($status) + { + my @trace = get_stack_trace("$installdir/bin","$installdir/data"); + push(@checkout,@trace); + } writelog('install-check',\@checkout); print "======== make installcheck log ===========\n",@checkout if ($verbose > 1); @@ -839,6 +886,11 @@ } close($handle); } + if ($status) + { + my @trace = get_stack_trace("$installdir/bin","$installdir/data"); + push(@checkout,@trace); + } writelog('contrib-install-check',\@checkout); print "======== make contrib installcheck log ===========\n",@checkout if ($verbose > 1); @@ -864,6 +916,11 @@ } close($handle); } + if ($status) + { + my @trace = get_stack_trace("$installdir/bin","$installdir/data"); + push(@checkout,@trace); + } writelog('pl-install-check',\@checkout); print "======== make pl installcheck log ===========\n",@checkout if ($verbose > 1); @@ -892,6 +949,13 @@ } close($handle); } + if ($status) + { + my @trace = + get_stack_trace("$pgsql/src/test/regress/install$installdir/bin", + "$pgsql/src/test/regress/tmp_check/data"); + push(@makeout,@trace); + } writelog('check',\@makeout); print "======== make check logs ===========\n",@makeout if ($verbose > 1);