summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-08-05 16:22:30 +0100
committerDavid Mitchell <davem@iabyn.com>2019-08-05 17:10:55 +0100
commit5de6cd706e406902d8d24f62fe0fb81ebbb8c0dc (patch)
tree9309d6ab92ed83fbef038bb6c63802eb1c691d01 /dump.c
parent28269cae37d6d6f78b7f04769d89a56f5a11c2f4 (diff)
downloadperl-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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/dump.c b/dump.c
index 9de1941b5a..188d267426 100644
--- a/dump.c
+++ b/dump.c
@@ -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",