Re: 5.9.1 release now integrated into ponie

[email protected] (Nicholas Clark) Thu, 8 Apr 2004 16:22:09 +0100
Newsgroups perl.ponie.dev
Message-ID <[email protected]>
On Wed, Apr 07, 2004 at 04:10:25PM +0100, Nicholas Clark wrote:

> Arthur and I met this same problem with test 64 before, and I can't remember
> how we solved it, or whether it just "went away". I can't reproduce it on
> x86 Linux, and valgrind doesn't show anything up.

I find that with a bit of trickery I can get the debugger onto it.
It's in the pad/scope code:

#0  0x00183e90 in Parrot_PMC_get_pointer (interp=0x1000200, pmc=0xfefe183f) at src/extend.c:74
#1  0x0011976c in Perl_macro_AvARRAY (av=0x101dc10) at av.c:26
#2  0x0015e2c0 in Perl_leave_scope (base=0) at scope.c:1049
#3  0x001586ec in Perl_pop_scope () at scope.c:137
#4  0x00012264 in Perl_cv_undef (cv=0x101feb0) at op.c:3876
#5  0x000531d0 in Perl_sv_clear (sv=0x101feb0) at sv.c:5786
#6  0x00053ab8 in Perl_sv_free2 (sv=0x101feb0) at sv.c:5994
#7  0x00076528 in Perl_magic_freeovrld (sv=0x1016160, mg=0xc0ac90) at gv.c:1329
#8  0x00060b64 in Perl_mg_free (sv=0x1016160) at mg.c:389
#9  0x00052fa8 in Perl_sv_clear (sv=0x1016160) at sv.c:5761
#10 0x00053ab8 in Perl_sv_free2 (sv=0x1016160) at sv.c:5994
#11 0x00042bd0 in do_clean_all (sv=0x1016160) at sv.c:448
#12 0x000425b8 in S_visit (f=0x42b20 <do_clean_all>) at sv.c:340
#13 0x00042c28 in Perl_sv_clean_all () at sv.c:466
#14 0x00020538 in perl_destruct (my_perl=0xc00140) at perl.c:714
#15 0x00001ce8 in main (argc=4, argv=0xbffff808, env=0xbffff81c) at perlmain.c:88

We're in parts of perl I don't know. The save stack is getting restored:

	case SAVEt_COMPPAD:
	    PL_comppad = (PAD*)SSPOPPTR;
	    if (PL_comppad)
		PL_curpad = AvARRAY(PL_comppad);
	    else
		PL_curpad = Null(SV**);
	    break;

and the crash is because PL_comppad has just been reloaded with this:

(gdb) print *PL_comppad
$13 = {
  sv_any = 0x101e7c0, 
  sv_refcnt = 0, 
  sv_flags = 255, 
  sv_is_pmc = 1 '\001'
}

so that AvARRAY() kicks in. Should that if(PL_comppad) be checking the SvFLAGS?
And silently treating type 0xFF the same way as PL_comppad of NULL? Or is this
a (perl) bug and it should be pitching a fit?

I'm also trying to work out how that value is on the stack.

[The specific SEGV is because AvARRAY looks up the PMC via MUMBLE:

#define MUMBLE(p) ((void *)((p)?~(UV)(p):0))

ie that value in sv_any wasn't put there by the correct AV macro]

Nicholas Clark