On Tue, Jan 01, 2002 at 10:05:44PM +0000, Nicholas Clark wrote:
> So, what's going wrong, and why all the segvs?
> I figured it was better to start by wondering about the prederef code.
> But I might just go to bed instead. Or fix compiler warnings. or perl5

The first segv is the ret in this (test 8 in basic.t):

        print   "start\n"
        
        bsr     LAB1

        print   "done\n"
        end

LAB1:   print   "lab 1\n"
        ret


Enter runops_prederef like this:

runops_prederef (interpreter=0x804d000, pc=0x8061000, pc_prederef=0x8060100)
    at interpreter.c:304

predref for the first time is the print:

prederef (pc_prederef=0x8060100, interpreter=0x804d000) at interpreter.c:207

215             pc_prederef[i] = (void *)prederef_op_func[pc[i]];
251             pc_prederef[i] = (void *) 

ie
      case PARROT_ARG_OP:
      case PARROT_ARG_SC:

then the op itself:

Parrot_print_sc (cur_opcode=0x8060100, interpreter=0x804d000)
    at core_ops_prederef.c:221

then 8 bytes further on prederef the next op:

prederef (pc_prederef=0x8060108, interpreter=0x804d000) at interpreter.c:207

215             pc_prederef[i] = (void *)prederef_op_func[pc[i]];
235             pc_prederef[i] = (void *)pc[i];

ie

      case PARROT_ARG_OP:
      case PARROT_ARG_IC:

then the op itself:

Parrot_bsr_ic (cur_opcode=0x8060108, interpreter=0x804d000)
    at core_ops_prederef.c:2884

etc to

Parrot_ret (cur_opcode=0x8060124, interpreter=0x804d000)
    at core_ops_prederef.c:2955

which exits with

0x281cfeec in Parrot_ret (cur_opcode=0x8060124, interpreter=0x804d000)
    at core_ops_prederef.c:2956
2956    }
(gdb) 
runops_prederef (interpreter=0x804d000, pc=0x8061000, pc_prederef=0x8061010)
    at interpreter.c:317
317         }
(gdb) 
315           pc_prederef = 
(gdb) 

Program received signal SIGSEGV, Segmentation fault.
0x19 in ?? ()
(gdb) 

and now FreeBSD has done its nice trick of wiping the stack frame.
[which is why I had had to single step forwards to find where the segv was in
the first place. s/core/chocolate teapot/; - it's about as useful]

The other nice FreeBSD trick is that for some reason gdb is refusing to
honour LD_LIBRARY_PATH. Unless I'm debugging as root. :-(
[which doesn't really matter on this machine, as I'm root, and it is totally
trashable]

Would it be possible to be able to static link the opcode libraries for
debugging purposes?


Meanwhile, w.r.t. to the SEGV - I've not got the first idea what bsr & ret
are up to, or quite how they upset the predereferencer. So could someone else
take over please?

Nicholas Clark

Reply via email to