-
Notifications
You must be signed in to change notification settings - Fork 584
Document OP_NEXT's use of OPf_SPECIAL in op.h #20611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hrm; your link shows the code where the flag is tested by |
Ah, I see it. It's directly in the parser as a direct consequence of
|
On Fri, Dec 16, 2022 at 02:39:27AM -0800, Paul Evans wrote:
Hrm; your link shows the code where the flag is tested by `pp_next`.
I've been hunting around for the code which sets it but so far I've come
up blank. `OP_NEXT` doesn't have an opchecker, nor does `peep.c` have
much to do with an `OP_NEXT` at all.
perly.y: for the LOOPEX without arg case, it calls newOP($LOOPEX, OPf_SPECIAL)
There's a relatively easy way to answer 'where does this flag get set' in
gdb. Break at a point where you know the flag has been set, set a watchpoint
on the flag's storage location, then rerun and continue until the flag
changes:
$ PERL_HASH_SEED=0 gdb ./perl
(gdb) b Perl_pp_next
(gdb) run -e'for (1) { next; }'
Breakpoint 1, Perl_pp_next (my_perl=0xa8f2a0) at pp_ctl.c:2715
2715 cx = CX_CUR();
(gdb) p my_perl->Iop->op_flags
$1 = 0x81
(gdb) wa -l my_perl->Iop->op_flags
(gdb) r
Hardware watchpoint 2: -location my_perl->Iop->op_flags
Old value = <unreadable>
New value = 0x0
0x00007ffff7ccb25b in __memset_evex_unaligned_erms () from /lib64/libc.so.6
(gdb) c
Hardware watchpoint 2: -location my_perl->Iop->op_flags
Old value = 0x0
New value = 0x80
Perl_newOP (my_perl=0xa8f2a0, type=0xd2, flags=0x80) at op.c:5418
5418 o->op_next = o;
(gdb) up
#1 0x00000000004f5d9f in Perl_yyparse (my_perl=0xa8f2a0, gramtype=0x102)
at /home/davem/perl5/git/bleed/perly.y:1356
1356 { $$ = newOP($LOOPEX, OPf_SPECIAL);
…--
A major Starfleet emergency breaks out near the Enterprise, but
fortunately some other ships in the area are able to deal with it to
everyone's satisfaction.
-- Things That Never Happen in "Star Trek" #13
|
Ah interesting. I've never had much luck with rerunning programs in gdb like that because often it gets different memory addresses. But that hint of |
Yes thank you.
I think that's what https://rr-project.org/ aims to solve? |
See cd97dc8 for its meaning
All ops that use the OPf_SPECIAL flag should be documented in op.h where OPf_SPECIAL is defined. This one is missing and should be pretty easy to add.
The text was updated successfully, but these errors were encountered: