If we encounter core dumps with the static build, this small fix recommends the right
gdb command to run, since the httpd binary is actually a libtool shell script wrapper
Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.183
diff -u -I$Id -r1.183 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	22 Sep 2004 23:14:29 -0000	1.183
+++ Apache-Test/lib/Apache/TestRun.pm	24 Sep 2004 21:59:37 -0000
@@ -867,7 +867,7 @@
             # more than once and each time it caused a segfault
             $core_files{$core} = -M $core;
             push @msg, "server dumped core, for stacktrace, run:\n" .
-                "gdb $vars->{httpd} -core $core";
+                "gdb ". $self->core_httpd ." -core $core";
         }
     }}, $vars->{top_dir});
 
@@ -875,6 +875,36 @@
 
 }
 
+sub core_httpd {
+    my($self) = @_;
+    my $vars = $self->{test_config}->{vars};
+    my $httpd = $vars->{httpd};
+    my $fh;
+    my $header;
+    open ($fh, "<$httpd") or die $!;
+    sysread($fh, $header, 2);
+    if ($header eq '#!') {
+        my ($program, $progdir);
+        while(<$fh>) {
+            if (/program=(.*)/) {
+                $program = $1;
+            }
+            if (/progdir=(.*)/) {
+                $progdir = $1;
+            }
+            if ($progdir && $program) {
+                my $path = dirname $httpd;
+                $program =~ s/'//g;
+                $progdir =~ s/'//g;
+                $httpd = File::Spec->catfile($path, $progdir, $program);
+                last;
+            }
+        }
+    }
+    close($fh);
+    return $httpd;
+}
+
 sub scan_core {
     my $self = shift;
     my $vars = $self->{test_config}->{vars};
@@ -897,7 +927,7 @@
             my $oh = oh();
             my $again = $times++ ? "again" : "";
             error "oh $oh, server dumped core $again";
-            error "for stacktrace, run: gdb $vars->{httpd} -core $core";
+            error "for stacktrace, run: gdb " . $self->core_httpd . " -core $core";
         }
     }}, $vars->{top_dir});
 }

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to