Happened onto the cute Devel::GDB module and quickly wiped out a patch to make
t/REPORT attempt to automatically generate back traces for core files it finds in t/


Any interest in this ?


Index: Apache-Test/lib/Apache/TestReport.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestReport.pm,v
retrieving revision 1.14
diff -u -I$Id -r1.14 TestReport.pm
--- Apache-Test/lib/Apache/TestReport.pm        5 Sep 2004 00:11:30 -0000       1.14
+++ Apache-Test/lib/Apache/TestReport.pm        7 Oct 2004 06:30:44 -0000
@@ -21,6 +21,7 @@
 use Apache::TestConfig ();
 
 use File::Spec::Functions qw(catfile);
+use File::Find;
 
 sub new {
     my $class = shift;
@@ -79,6 +80,36 @@
 
 sub executable { $0 }
 
+my $core_dump;
+sub core_dump {
+    my $self = shift;
+    
+    $core_dump = "";
+    
+    if ( eval { require Devel::GDB } ) {
+        find(\&dump_core_file, 't')
+    }
+    
+    $core_dump ||= '[CORE TRACE COMES HERE]';
+    
+    $core_dump;
+}
+
+sub dump_core_file {
+    return unless /^core\.\d+$/;
+    my $core = $_;
+    my $gdb = new Devel::GDB ();
+    my $test_config = Apache::TestConfig->new({thaw=>1});
+    my $httpd = $test_config->{vars}->{httpd};
+    return unless defined $httpd;
+    $core_dump .= join '', 
+           $gdb->get("file $httpd"),
+           $gdb->get('sharedlibrary'),
+           $gdb->get("core $core"),
+           $gdb->get('info threads'),
+           $gdb->get('thread apply all bt');
+}
+
 sub date { scalar gmtime() . " GMT" }
 
 sub template {
@@ -94,7 +125,7 @@
 
 3. This is the core dump trace: (if you get a core dump):
 
-  [CORE TRACE COMES HERE]
[EMAIL PROTECTED]@
 
 This report was generated by @EXECUTABLE@ on @[EMAIL PROTECTED]
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to