Scott Walters wrote:
> Dear kind Perl porters,
>
> cat >t.pl <<EOF
> my freegame_multipliers;
> $freegame_multipliers[0] = 0;
> EOF
>
> perl -MO=Debug t.pl
>
> Output:
> ...
> ...
> SVOP (0x8140390)
> op_next 0x81437e8
> op_sibling 0x8134400
> op_ppaddr PL_ppaddr[OP_AELEMFAST]
> op_targ 4
> op_type 126
> op_seq 7216
> op_flags 178
> op_private 0
> Segmentation fault
>
> Some Background
>
> I know the Bytecode compiler isn't supported, but as a
matter of definition,
> I need the bleedin' thing (Navada Gaming Commision
requires all game code
> to be compiled or they just won't approve it). We're
using other compilers
> too but the Bytecode compiler is the only way I know of
to attach to
> "compiled" modules at run-time, short of
embedding Perl in Perl ;)
> So I'd like to frame my question as a general request
for edjamacation
> on Perl internals and try to fix this myself.
>
> The basic observeration was that arrays subscripted
with constants caused
> the compiler to coredump.
>
> B::Concise and B: eparse
work as expected; B::Bytecode also coredumps.
>
> My bag of tricks is a small one and I've running low at
the moment.
> Since core modules make the thing crash (at least at
this installation)
> and something apparently simple ain't workin' right, I
thought I'd
> appeal for help. Thoughts, anyone? Suggestions?
Resources?
> All I can figure is that some B:: modules are smart
enough to handle
> some optimization that was introduced recently in 5.8.x
and some
> aren't, but I know aelemfast has been around a while,
so I'm miffed.
>
> Depending on the exact contents of the test program
(whether strict
> and warnings are used, how many variables are declared
first, etc)
> it'll sometimes not coredump but instead give a message
such as:
>
> "Can't call method "ix" on unblessed
reference at
/home/knoppix/lib/perl5/5.8.8/i686-linux/B/Bytecode.pm line
595."
>
> (Yes, my main workstation runs an antique version of
Knoppix.
> Slack was dropped on top of it, if you really care.)
>
> I've changed that code to read as follows:
>
> sub B::SVOP::bsave {
> my ($op,$ix) = _;
> use Devel::Peek; Dump($op->sv); # added this
> my $svix = $op->sv->ix;
>
> $op->B::OP::bsave($ix);
> asm "op_sv", $svix;
> }
>
> And this is the output:
>
> SV = RV(0x814e844) at 0x825b9e4
> REFCNT = 1
> FLAGS = (TEMP,ROK)
> RV = 0x825bce4
> SV = PVMG(0x81712c0) at 0x825bce4
> REFCNT = 1
> FLAGS = (OBJECT,IOK,pIOK)
> IV = 134931536
> NV = 0
> PV = 0
> STASH = 0x825bcb4
"Uxe5WVSxecxe8]xffxffxc3xc2"
>
> Warm regards,
> -scott
>
> P.S.:
>
> My stack, in the case of B: ebug:
>
> 0x401a4d15 in make_sv_object () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> (gdb) bt
> #0 0x401a4d15 in make_sv_object () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #1 0x401a8644 in XS_B__SVOP_sv () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #2 0x080b4b81 in Perl_pp_entersub ()
> #3 0x080ae3c8 in Perl_runops_standard ()
> #4 0x08062106 in S_call_body ()
> #5 0x0806203f in Perl_call_sv ()
> #6 0x401a54b8 in walkoptree () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #7 0x401a5515 in walkoptree () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #8 0x401a5515 in walkoptree () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #9 0x401a5515 in walkoptree () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #10 0x401a634e in XS_B_walkoptree () from
/home/knoppix/lib/perl5/5.8.8/i686-linux/auto/B/B.so
> #11 0x080b4b81 in Perl_pp_entersub ()
> #12 0x080ae3c8 in Perl_runops_standard ()
> #13 0x08062106 in S_call_body ()
> #14 0x08061f38 in Perl_call_sv ()
> #15 0x080654b3 in S_call_list_body ()
> #16 0x080652cb in Perl_call_list ()
> #17 0x08060672 in perl_parse ()
> #18 0x0805e873 in main ()
>
> Host:
>
> Linux fluffy 2.4.31 #31 Sun Jun 5 19:25:20 PDT 2005
i686 unknown unknown GNU/Linux
>
> Perl:
>
> Summary of my perl5 (revision 5 version 8 subversion 8)
configuration:
> Platform:
> osname=linux, osvers=2.4.27, archname=i686-linux
> uname='linux blacklight.slowass.net 2.4.27 #2 smp
mo aug 9 00:39:37 cest 2004 i686 gnulinux '
> config_args='-Dprefix=/home/knoppix -de'
> hint=recommended, useposix=true,
d_sigaction=define
> usethreads=undef use5005threads=undef
useithreads=undef usemultiplicity=undef
> useperlio=define d_sfio=undef uselargefiles=define
usesocks=undef
> use64bitint=undef use64bitall=undef
uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='cc', ccflags ='-fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
> optimize='-O2',
> cppflags='-fno-strict-aliasing -pipe
-I/usr/local/include'
> ccversion='', gccversion='3.3.4 (Debian
1:3.3.4-9)', gccosandvers=''
> intsize=4, longsize=4, ptrsize=4, doublesize=8,
byteorder=1234
> d_longlong=define, longlongsize=8,
d_longdbl=define, longdblsize=12
> ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
> alignbytes=4, prototype=define
> Linker and Libraries:
> ld='cc', ldflags =' -L/usr/local/lib'
> libpth=/usr/local/lib /lib /usr/lib
> libs=-lnsl -ldl -lm -lcrypt -lutil -lc
> perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
> libc=/lib/libc-2.3.2.so, so=so, useshrplib=false,
libperl=libperl.a
> gnulibc_version='2.3.2'
> Dynamic Linking:
> dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,-E'
> cccdlflags='-fpic', lddlflags='-shared
-L/usr/local/lib'
>
>
> Characteristics of this binary (from libperl):
> Compile-time options: PERL_MALLOC_WRAP
SPRINTF_RETURNS_STRLEN
> USE_LARGE_FILES USE_PERLIO
> Locally applied patches:
> RC1
> Built under linux
> Compiled at Jan 25 2006 00:10:13
>
> Regards,
> -scott
>
>
>
>
>
>
as of 31864, it appears to work (not segfault)
are you constrained to stay on 5.8.8 ?
[jimc harpo bleadperl]$ ./perl -Ilib -MO=Debug -e 'my mult;
$mult[0] = 0;'
LISTOP (0x954ac20)
op_next 0x0
op_sibling 0x0
op_ppaddr PL_ppaddr[OP_LEAVE]
op_targ 1
op_type 181
op_opt 1
op_flags 13
op_private 64
op_first 0x954ad10
op_last 0x954afd8
op_children 5
OP (0x954ad10)
op_next 0x954afa0
op_sibling 0x954afa0
op_ppaddr PL_ppaddr[OP_ENTER]
op_targ 0
op_type 180
op_opt 1
op_flags 0
op_private 0
COP (0x954afa0)
op_next 0x954ab68
op_sibling 0x954ab68
op_ppaddr PL_ppaddr[OP_NEXTSTATE]
op_targ 0
op_type 177
op_opt 1
op_flags 1
op_private 0
cop_label
cop_stashpv main
cop_file -e
cop_seq 541
cop_arybase 0
cop_line 1
cop_warnings 0x6
cop_io ""
OP (0x954ab68)
op_next 0x954aff8
op_sibling 0x954aff8
op_ppaddr PL_ppaddr[OP_PADAV]
op_targ 1
op_type 10
op_opt 1
op_flags 33
op_private 128
COP (0x954aff8)
op_next 0x954b0c8
op_sibling 0x954afd8
op_ppaddr PL_ppaddr[OP_NEXTSTATE]
op_targ 0
op_type 177
op_opt 1
op_flags 1
op_private 0
cop_label
cop_stashpv main
cop_file -e
cop_seq 542
cop_arybase 0
cop_line 1
cop_warnings 0x6
cop_io ""
BINOP (0x954afd8)
op_next 0x954ac20
op_sibling 0x0
op_ppaddr PL_ppaddr[OP_SASSIGN]
op_targ 0
op_type 36
op_opt 1
op_flags 69
op_private 2
op_first 0x954b0c8
op_last 0x954b1b8
SVOP (0x954b0c8)
op_next 0x954ad48
op_sibling 0x954b1b8
op_ppaddr PL_ppaddr[OP_CONST]
op_targ 2
op_type 5
op_opt 1
op_flags 2
op_private 0
op_sv 0x0
Nullsv
UNOP (0x954b1b8)
op_next 0x954afd8
op_sibling 0x0
op_ppaddr PL_ppaddr[OP_NULL]
op_targ 128
op_type 0
op_opt 0
op_flags 182
op_private 2
op_first 0x954ad48
OP (0x954ad48)
op_next 0x954afd8
op_sibling 0x954ac00
op_ppaddr PL_ppaddr[OP_AELEMFAST]
op_targ 1
op_type 127
op_opt 1
op_flags 178
op_private 0
OP (0x954ac00)
op_next 0x954b1b8
op_sibling 0x0
op_ppaddr PL_ppaddr[OP_NULL]
op_targ 5
op_type 0
op_opt 0
op_flags 2
op_private 0
-e syntax OK
out of curiosity...
//depot/perl/ext/B/B/Debug.pm
... #30 change 31461 edit on 2007/06/25 by rgs stcosmo
(text) 'Subject: [PATCH] remove op_stat'
... #29 change 31164 edit on 2007/05/07 by nicholas nicholas-z1 (text) 'Given that optype and special'
... #28 change 30569 edit on 2007/03/13 by nicholas nicholas-saigo (text) 'Bump versions of modules that
a'
... ... edit into
//depot/maint-5.8/perl/ext/B/B/Debug.pm#11
... #27 change 26091 edit on 2005/11/12 by nicholas nicholas-saigo (text) 'Make the removal of references
'
... ... copy into //depot/maint-5.8/perl/ext/B/B/Debug.pm#9
... #26 change 24518 edit on 2005/05/20 by nicholas ship-in-a-bottle (text) 'Goodbye AvFLAGS '
... ... ignored by
//depot/maint-5.8/perl/ext/B/B/Debug.pm#9
... #25 change 23278 edit on 2004/09/08 by nicholas nicholas-saigo (text) 'backport B to work on 5.8.x,
so'
... ... copy into //depot/maint-5.8/perl/ext/B/B/Debug.pm#8
... #24 change 22353 edit on 2004/02/21 by rgs rgs-home
(text) 'Subject: Re: op_seq (was: Freei'
... ... ignored by
//depot/maint-5.8/perl/ext/B/B/Debug.pm#8
//depot/perl/ext/B/B.xs
... #138 change 31461 edit on 2007/06/25 by rgs stcosmo
(text) 'Subject: [PATCH] remove op_stat'
... #137 change 31333 edit on 2007/06/05 by rgs stcosmo
(text) 'Remove support for assertions a'
... #136 change 31153 edit on 2007/05/05 by nicholas nicholas-saigo (text) 'Tweak change 30841 so that B
wo'
... ... copy into //depot/maint-5.8/perl/ext/B/B.xs#35
... #135 change 30865 edit on 2007/04/07 by nicholas nicholas-saigo (text) 'Turn op_pmreplroot in struct
pm'
... ... ignored by //depot/maint-5.8/perl/ext/B/B.xs#35
... #134 change 30860 edit on 2007/04/06 by nicholas nicholas-saigo (text) 'Merge op_pmreplstart and
op_pms'
... ... ignored by //depot/maint-5.8/perl/ext/B/B.xs#35
... #133 change 30853 edit on 2007/04/06 by nicholas nicholas-saigo (text) 'Remove op_pmnext from PMOPs,
an'
... ... ignored by //depot/maint-5.8/perl/ext/B/B.xs#35
... #132 change 30841 edit on 2007/04/04 by rgs stcosmo
(text) 'Subject: Re: pmdynflags and thr'
... ... ignored by //depot/maint-5.8/perl/ext/B/B.xs#35
|