Subject: | A program that gets stuck when running under Devel-Cover |
The attached program is what I managed to distill from a bigger
program that got stuck and ate all my memory when running under
Devel-Cover. This programs hangs in the last call to parse_xml(); and
any further tweaks to this program make it run to completion.
I'm using perl-5.8.8, Devel-Cover-0.59 and XML-Parser-2.34, on a Linux
system.
By tweaking the internal debug printouts in Cover.xs I have found that
the run-loop gets stuck running the same 'leavesub' op over and over.
I also found that commenting out the call to cover_logop() in
runops_cover() avoids the problem. Any idea what's going on?
$ perl devel-cover-hang.pl
before at devel-cover-hang.pl line 26.
after at devel-cover-hang.pl line 28.
$ perl -MDevel::Cover devel-cover-hang.pl
Devel::Cover 0.59: Collecting coverage data for branch, condition,
statement, subroutine and time.
Pod coverage is unvailable. Please install Pod::Coverage from
CPAN.
Selecting packages matching:
Ignoring packages matching:
/Devel/Cover[./]
Ignoring packages in:
.
/opt/perl/debug1/lib
/opt/perl/debug1/site/lib
before at devel-cover-hang.pl line 26.
Subject: | devel-cover-hang.pl |
sub parse_xml {
require XML::Parser::Expat;
my $p = XML::Parser::ExpatNB->new;
my $handler = sub {};
$p->setHandlers(
Start => sub {
$_[0]->xpcroak("Unrecognized tag") if $_[1] eq "CROAK";
},
End => sub {
if ($_[1] eq "FOO") {
$handler->();
return;
}
},
);
eval {
$p->parse_more($_[0]);
$p->parse_done;
};
}
parse_xml("<FOO/>");
parse_xml("<CROAK>");
parse_xml("<FOO/>");
warn "before";
parse_xml("<FOO><X/></FOO>");
warn "after";