You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@eXtropia.com> on 2003/01/20 10:58:05 UTC

[Patch] Add support ./t/TEST -debug=valgrind

I've been playing with valgrind for a while, and it never worked with
httpd 2.0 ;-( Well, the latest version of valgrind, 1.0.4 finally fixes
it !

I was able to run mod_perl 2.0 under valgrind for the first time ;-)

So, being lazy, I patched Apache-Test.

Gozer out.

Index: Apache-Test/lib/Apache/TestServer.pm
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
retrieving revision 1.60
diff -u -I'$Id' -I'$Revision' -r1.60 TestServer.pm
--- Apache-Test/lib/Apache/TestServer.pm	1 Jul 2002 08:11:50 -0000	1.60
+++ Apache-Test/lib/Apache/TestServer.pm	20 Jan 2003 09:55:17 -0000
@@ -20,6 +20,7 @@
 my %debuggers = (
     gdb    => 'gdb',
     ddd    => 'gdb',
+    valgrind => 'valgrind',
     strace => 'strace',
 );
 
@@ -124,6 +125,28 @@
     my($self, $strace, $file) = @_;
     #XXX truss, ktrace, etc.
     "$strace -f -o $file -s1024";
+}
+
+sub valgrind_cmd {
+    my($self, $valgrind) = @_;
+    "$valgrind -v --leak-check=yes --show-reachable=yes";
+}
+
+sub start_valgrind {
+    my $self = shift;
+    my $opts = shift;
+    
+    
+    my $config      = $self->{config};
+    my $args        = $self->args;
+    my $one_process = $self->version_of(\%one_process);
+    my $valgrind_cmd = $self->valgrind_cmd($opts->{debugger});
+    my $httpd       = $config->{vars}->{httpd};
+    
+    my $command = "$valgrind_cmd $httpd $one_process $args";
+
+    debug $command;
+    system $command;   
 }
 
 sub start_strace {



Re: [Patch] Add support ./t/TEST -debug=valgrind

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> I've been playing with valgrind for a while, and it never worked with
> httpd 2.0 ;-( Well, the latest version of valgrind, 1.0.4 finally fixes
> it !
> 
> I was able to run mod_perl 2.0 under valgrind for the first time ;-)
> 
> So, being lazy, I patched Apache-Test.

sounds good, committed.

It seems that we have no leaks, but there are quite a few warnings, do you 
know what are they? Looks like they are in the non-modperl library.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org