Mailing List Archive

SEGFAULT in pp_caller
The reasons: it fills @DB:args regardless of whether it is a sub or an
eval. Patch follows.

The patch below is a trojan horse, in fact. It adds yet another
undocumented member of @DB::args to better differentiate between
different kinds of (eval)s. I still have some problem, though. If the
file 't.pm' contains
use Carp;
then
perl -de 'require t'
after an 's' stops on the Carp line, and 'T' shows (on my copy):

main::(-e:1): require t
DB<1> s
main::(t.pm:1): use Carp;
DB<1> T
$ = main::BEGIN() from file `t.pm' line 1
$ = eval {...} from file `t.pm' line 1
$ = require 't.pm' from -e line 1

Now, what is the intermediate (eval) scope?

Ilya

*** pp_ctl.c~ Wed Nov 01 22:19:32 1995
--- pp_ctl.c Mon Nov 06 03:01:16 1995
***************
*** 1084,1091 ****
PUSHs(sv_2mortal(newSViv((I32)cx->blk_gimme)));
if (cx->cx_type == CXt_EVAL && cx->blk_eval.old_op_type == OP_ENTEREVAL)
PUSHs(cx->blk_eval.cur_text);

! if (cx->blk_sub.hasargs && curcop->cop_stash == debstash) {
AV *ary = cx->blk_sub.argarray;
int off = AvARRAY(ary) - AvALLOC(ary);

--- 1084,1100 ----
PUSHs(sv_2mortal(newSViv((I32)cx->blk_gimme)));
if (cx->cx_type == CXt_EVAL && cx->blk_eval.old_op_type == OP_ENTEREVAL)
PUSHs(cx->blk_eval.cur_text);
+ if (cx->cx_type == CXt_EVAL && cx->blk_eval.old_op_type != OP_ENTEREVAL
+ && cx->blk_eval.old_name) { /* Try blocks have old_name = 0 */
+ /* Require, put the name. */
+ SV *name = newSVpv(cx->blk_eval.old_name, 0);

! PUSHs(&sv_undef);
! PUSHs(sv_2mortal(name));
! }
!
! if (cx->cx_type != CXt_EVAL && cx->blk_sub.hasargs
! && curcop->cop_stash == debstash) {
AV *ary = cx->blk_sub.argarray;
int off = AvARRAY(ary) - AvALLOC(ary);