Discussion:
Bizarre copy of hash in sassign with perldb
(too old to reply)
Steve Fink
2005-09-02 05:24:14 UTC
Permalink
I get this error message in my embedded perl app. I used to get it, then
I cleaned up some refcounting bugs, and it went away. Later, it came
back (very probably due to a different cause). I know I'm not giving
enough information to go on, but can anyone tell me what this means and
give me any tips on how to go about tracking it down?

It only happens when I run under the debugger, and even then it usually
takes a bit of stepping through code before it shows up. Any occurrence
is 100% repeatable, though.
Nicholas Clark
2005-09-02 11:54:15 UTC
Permalink
Post by Steve Fink
I get this error message in my embedded perl app. I used to get it, then
I cleaned up some refcounting bugs, and it went away. Later, it came
back (very probably due to a different cause). I know I'm not giving
enough information to go on, but can anyone tell me what this means and
give me any tips on how to go about tracking it down?
Well, it comes about because the source SV type passed to sv_setsv() isn't
one of the types it can cope with. It's not expecting to copy hashes (or
arrays or a few other things), and usually everyone passes references to
the complex types. I know how to provoke the error with pure perl, but only
for IOs:

$ perl -e '$a = ${*STDOUT{IO}}'
Bizarre copy of IO in sassign at -e line 1.

As to what the debugger is doing, or how to diagnose this better, I don't
really have any clues.

Nicholas Clark
Steve Fink
2005-09-03 00:21:25 UTC
Permalink
Post by Nicholas Clark
Post by Steve Fink
I get this error message in my embedded perl app. I used to get it, then
I cleaned up some refcounting bugs, and it went away. Later, it came
back (very probably due to a different cause). I know I'm not giving
enough information to go on, but can anyone tell me what this means and
give me any tips on how to go about tracking it down?
Well, it comes about because the source SV type passed to sv_setsv() isn't
one of the types it can cope with. It's not expecting to copy hashes (or
arrays or a few other things), and usually everyone passes references to
the complex types. I know how to provoke the error with pure perl, but only
$ perl -e '$a = ${*STDOUT{IO}}'
Bizarre copy of IO in sassign at -e line 1.
As to what the debugger is doing, or how to diagnose this better, I don't
really have any clues.
You are awesome.

That problem has been haunting me for half a year, and I've just been
ignoring it. Your description was enough for me to find the bug within 5
minutes. I had an Inline::CPP function returning an SV*, but I was
casting an HV* to SV* rather than making a reference.

Yay, I have the debugger back! (And I think it fixed another bug that
I've been meaning to hunt down...)

Loading...