
nick at ccl4
Aug 17, 2012, 5:49 AM
Post #4 of 11
(125 views)
Permalink
|
On Thu, Aug 16, 2012 at 03:02:18PM -0400, David Golden wrote: > On Thu, Aug 16, 2012 at 12:03 PM, Nicholas Clark <nick [at] ccl4> wrote: > > > > So, is this a crazy idea to investigate further? What did I miss? - ie > > what could possibly go wrong? > > Changing the size of @_ within a sub would also need to trigger a copy. That's already caught by AvREIFY() being true on @_: $ gdb --args ./perl -e 'sub foo {push @_, 1} foo' GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/nick/Perl/perl/perl...done. (gdb) b Perl_av_reify Breakpoint 1 at 0x595278: file av.c, line 32. (gdb) r Starting program: /home/nick/Perl/perl/perl -e sub\ foo\ \{push\ @_,\ 1\}\ foo [Thread debugging using libthread_db enabled] Breakpoint 1, Perl_av_reify (my_perl=0xa25010, av=0xa46498) at av.c:32 32 PERL_ARGS_ASSERT_AV_REIFY; (gdb) where #0 Perl_av_reify (my_perl=0xa25010, av=0xa46498) at av.c:32 #1 0x000000000059822d in Perl_av_store (my_perl=0xa25010, av=0xa46498, key=0, val=0xa27ca0) at av.c:352 #2 0x000000000064591c in Perl_pp_push (my_perl=0xa25010) at pp.c:5049 #3 0x000000000054319d in Perl_runops_debug (my_perl=0xa25010) at dump.c:2126 #4 0x000000000045a661 in S_run_body (my_perl=0xa25010, oldscope=1) at perl.c:2388 #5 0x0000000000459732 in perl_run (my_perl=0xa25010) at perl.c:2305 #6 0x000000000041de4d in main (argc=3, argv=0x7fffffffea98, env=0x7fffffffeab8) at perlmain.c:114 (gdb) up #1 0x000000000059822d in Perl_av_store (my_perl=0xa25010, av=0xa46498, key=0, val=0xa27ca0) at av.c:352 352 av_reify(av); (gdb) call Perl_sv_dump(my_perl, av) SV = PVAV(0xa29c98) at 0xa46498 REFCNT = 2 FLAGS = () ARRAY = 0x0 FILL = -1 MAX = -1 ARYLEN = 0x0 FLAGS = (REIFY) (gdb) call Perl_sv_dump(my_perl, val) SV = IV(0xa27c90) at 0xa27ca0 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1 I think that all the manipulations of @_ that matter are already trapped and end up in Perl_av_reify. (Those that extend it, or manipulate it in place) Nicholas Clark
|