debugging Carp

M

Marc Girod

Hi,

Debugging some problems I had (with map), I got extra errors under the
debugger, while trying to step around calls to warn:

Bizarre copy of ARRAY in sassign at /usr/lib/perl5/5.10/Carp/Heavy.pm
line 104, <GEN1> line 1.

Carp::caller_info(/usr/lib/perl5/5.10/Carp/Heavy.pm:104):
104: my $arg = shift;
DB<10> x @_
Bizarre copy of ARRAY in leaveeval at /usr/lib/perl5/5.10/perl5db.pl
line 638, <GEN1> line 1.

The first occurrence was still under my using 'map'.
I see that Carp itself uses a DB package.
Can there be that it conflicts with the debugger?

The second occurrence happened after I had switched my using map for
grep, and got the expected behaviour without the debugger.

I couldn't narrow the problem down yet.

Thanks,
Marc
 
C

C.DeRykus

Quoth Marc Girod <[email protected]>:






This is a bug in perl, or in the debugger. I'm not terribly surprised:
@_ is deeply weird (especially when you've 'shift'ed it), and the
debugger is deeply weird; mix the two and presto! you get bugs :(. (Carp
uses some of the debugger hooks internally, so it's not surprising it
hits some of the same bugs.)

If you need a solution you could try upgrading to 5.12.1, to see if it's
been fixed; you could also try searchinghttp://rt.perl.org/rt3/Public/
for a known bug. It may be worth reporting a new bug if you don't find
one that matches, especially if you've got a really simple testcase.

http://rt.perl.org/rt3/Public/Bug/Display.html?id=52610looks like your
Carp error; it is unfixed, and appears to fall into the general category
of 'perl's stack isn't refcounted' bugs, which are unfortunately more
common that they should be and extremely difficult to fix (without
breaking half the XS in existence).


A google P5P thread cites this example below.
Pending a fix, a workaround should be possible
in some cases:

use diagnostics;
my @x = 1 .. 10;
sub s1 {
@x = (); # don't do this now!
my $x = qr/a/;
for (@_) {
s2($_);
}
}
sub s2 {
my $y = shift; # error here
print $y;
}

s1(@x);
__END__

(P) Perl detected an attempt to copy an internal value that
is not copyable.
Bizarre copy of ARRAY in sassign ...
 
M

Marc Girod

....
A google P5P thread cites this example below.

Thanks to both of you.
I don't need a fix: it is enough for me to have some reason to trust
my own code (who said I have few?).

And I couldn't narrow my problem into a neat case.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top