On Wednesday 16 January 2008 11:38:14 Will Coleda via RT wrote:

> On Tue Jan 15 14:16:29 2008, coke wrote:

> > Right now 'make tclsh' invokes the tcl.pbc with no file args, dumping
> > it into interactive mode.
> >
> > It would be most spiffy if it instead generated a binary called
> > 'tclsh' (ala the perl6 target of the same name).

> This now generates a binary.
>
> Which gives a bus error.

This was a neat bug, completely unrelated to GC, so hooray!  We get a nice new 
shiny feature out of it too.

> Reason: KERN_PROTECTION_FAILURE at address: 0x0000000c
> 0x011a024f in Parrot_NameSpace_set_pmc_keyed_str (interp=0x29003d0,
> pmc=0x2877f30, key=0x2c191a0, value=0x0) at ./src/pmc/namespace.pmc:175
> 175                 value->vtable->base_type == enum_class_NameSpace;
> (gdb) bt
> #0  0x011a024f in Parrot_NameSpace_set_pmc_keyed_str (interp=0x29003d0,
> pmc=0x2877f30, key=0x2c191a0, value=0x0) at ./src/pmc/namespace.pmc:175
> #1  0x010794a0 in Parrot_set_global (interp=0x29003d0, ns=0x2877f30,
> globalname=0x2c191a0, val=0x0) at src/global.c:339
> #2  0x010374d7 in Parrot_set_root_global_pc_sc_p (cur_opcode=0x2b1820c,
> interp=0x29003d0) at src/ops/var.ops:366

The problem is right here; this happens in runtime/tcllib.pir:

        # get the name of the executable
        $P1 = interp[.IGLOBALS_EXECUTABLE]
        set_root_global [ '_tcl' ], 'nameofexecutable', $P1

The problem was that .IGLOBALS_EXECUTABLE was null, so crashy crashy when 
trying to do STRINGish things with it.

As it turned out, only src/main.c (that is, the code that becomes the 
C<parrot> exectuable) set that particular iglobal.  pbc_to_exe didn't know 
that it existed (because I didn't either).

After teaching pbc_to_exe about that call and stealing the code from 
src/main.c, the crash went away.

I hate boilerplate though, so now we have a new external function:


        void Parrot_set_executable_name(Parrot_Interp, Parrot_String);

I'm on an airplane now, so I'd tell you the commit numbers which fix this, but 
I won't know them until I push this code.  For now, you'll just have to trust 
me.

-- c

Reply via email to