On Thursday 06 March 2008 06:22:21 Will Coleda wrote:

> in PDD17, the following program (which prints "b\n" in trunk), dies:
>
> $ ../../parrot tcl.pbc -e "puts [concat {expand}[lindex {a b} 1]]"
> argument doesn't array.
>
> This exception is coming from src/inter_call.c:374
>
> 369             dod_register_pmc(interp, st->key);
> 370         }
> 371         else {
> 372             /* src ought to be an array */
> 373             if (!VTABLE_does(interp, p_arg, CONST_STRING(interp,
> "array"))) 374                 real_exception(interp, NULL, E_ValueError,
> "argument doesn't array");
> 375         }
> 376
> 377         st->src.mode   |= CALL_STATE_FLATTEN;
> 378         st->src.slurp   = p_arg;
>
> breaking at 374..
>
> (gdb) p *p_arg
> $1 = {cache = {_b = {_bufstart = 0x835a1ac, _buflen = 3735928559}, _ptrs =
> { _struct_val = 0x835a1ac, _pmc_val = 0xdeadbeef}, _i = {
>       _int_val = 137732524, _int_val2 = -559038737},
>     _num_val = -1.1885954149046845e+148, _string_val = 0x835a1ac},
>   flags = 1146095104, vtable = 0x808a6a0, data = 0x80bc008,
>   pmc_ext = 0x81add58, real_self = 0x835a1c8}
> (gdb) p p_arg->vtable->base_type
> $3 = 61
>
> So, the PMC is a Parrot_Object, and since the vtable is healthy, I
> assume this isn't a GC issue.
>
> If I try to ask the PMC what it's type is (so I can figure out where
> it came from), I get a segfault
>
> (gdb) p p_arg->vtable->name(interp,p_arg)
> #BOOM
>
> So I set a conditional breakpoint on pmc_new and did a bt to find that
> this particular PMC was created during a thaw.
>
> (gdb) b src/pmc_new.c:71 if pmc==0x835a1c8
>
> #0  pmc_new (interp=0x804f008, base_type=34) at src/pmc.c:71
> #1  0xb7c19fd7 in ft_init (interp=0x804f008, info=0xbff6d228)
>     at src/pmc_freeze.c:958
> #2  0xb7c1a081 in todo_list_init (interp=0x804f008, info=0xbff6d228)
>     at src/pmc_freeze.c:983
> #3  0xb7c1b1e3 in run_thaw (interp=0x804f008, image=0x8326cd8,
>     what=VISIT_THAW_NORMAL) at src/pmc_freeze.c:1680
> #4  0xb7c1b490 in Parrot_thaw (interp=0x804f008, image=0x8326cd8)
>     at src/pmc_freeze.c:1808
> #5  0xb7c15da0 in PackFile_Constant_unpack_pmc (interp=0x804f008,
>     constt=0x812c148, self=0x80c78c0, cursor=0xb6ce9978) at
> src/packfile.c:3572 <SNIP>
>
> And here my limited c-fu petered out.

Can you dump the Tcl program to a PIR program, or at least tell me how to do 
it?  I have an idea what this might be.

-- c

Reply via email to