diff options
author | David Mitchell <davem@iabyn.com> | 2019-08-05 16:22:30 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2019-08-05 17:10:55 +0100 |
commit | 5de6cd706e406902d8d24f62fe0fb81ebbb8c0dc (patch) | |
tree | 9309d6ab92ed83fbef038bb6c63802eb1c691d01 /dump.c | |
parent | 28269cae37d6d6f78b7f04769d89a56f5a11c2f4 (diff) | |
download | perl-5de6cd706e406902d8d24f62fe0fb81ebbb8c0dc.tar.gz |
op_dump(): display a wild parent pointer.
Normally the PARENT is displayed only for top-level ops: lower-level
ops have the obvious parent.
This commit adds a check that a lower-level op has a valid parent (i.e.
non-null, points to an op with OPf_KIDS and one of the kids is us).
If these checks fails, the raw content of op_sibparent is displayed.
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1004,6 +1004,26 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o) S_opdump_indent(aTHX_ o, level, bar, file, "PARENT"); S_opdump_link(aTHX_ o, op_parent((OP*)o), file); } + else if (!OpHAS_SIBLING(o)) { + bool ok = TRUE; + OP *p = o->op_sibparent; + if (!p || !(p->op_flags & OPf_KIDS)) + ok = FALSE; + else { + OP *kid = cUNOPx(p)->op_first; + while (kid != o) { + kid = OpSIBLING(kid); + if (!kid) { + ok = FALSE; + break; + } + } + } + if (!ok) { + S_opdump_indent(aTHX_ o, level, bar, file, + "*** WILD PARENT 0x%p\n", p); + } + } if (o->op_targ && optype != OP_NULL) S_opdump_indent(aTHX_ o, level, bar, file, "TARG = %ld\n", |