*/
static void
-S_opdump_link(pTHX_ const OP *o, PerlIO *file)
+S_opdump_link(pTHX_ const OP *base, const OP *o, PerlIO *file)
{
PerlIO_puts(file, " ===> ");
- if (o)
+ if (o == base)
+ PerlIO_puts(file, "[SELF]\n");
+ else if (o)
PerlIO_printf(file, "%" UVuf " [%s 0x%" UVxf "]\n",
sequence_num(o), OP_NAME(o), PTR2UV(o));
else
PerlIO_printf(file, " %s(0x%" UVxf ")",
op_class_names[op_class(o)], PTR2UV(o));
- S_opdump_link(aTHX_ o->op_next, file);
+ S_opdump_link(aTHX_ o, o->op_next, file);
/* print op common fields */
+ if (level == 0) {
+ S_opdump_indent(aTHX_ o, level, bar, file, "PARENT");
+ S_opdump_link(aTHX_ o, op_parent((OP*)o), file);
+ }
+
if (o->op_targ && optype != OP_NULL)
S_opdump_indent(aTHX_ o, level, bar, file, "TARG = %ld\n",
(long)o->op_targ);
case OP_ENTERITER:
case OP_ENTERLOOP:
S_opdump_indent(aTHX_ o, level, bar, file, "REDO");
- S_opdump_link(aTHX_ cLOOPo->op_redoop, file);
+ S_opdump_link(aTHX_ o, cLOOPo->op_redoop, file);
S_opdump_indent(aTHX_ o, level, bar, file, "NEXT");
- S_opdump_link(aTHX_ cLOOPo->op_nextop, file);
+ S_opdump_link(aTHX_ o, cLOOPo->op_nextop, file);
S_opdump_indent(aTHX_ o, level, bar, file, "LAST");
- S_opdump_link(aTHX_ cLOOPo->op_lastop, file);
+ S_opdump_link(aTHX_ o, cLOOPo->op_lastop, file);
break;
case OP_REGCOMP:
case OP_ENTERTRY:
case OP_ONCE:
S_opdump_indent(aTHX_ o, level, bar, file, "OTHER");
- S_opdump_link(aTHX_ cLOGOPo->op_other, file);
+ S_opdump_link(aTHX_ o, cLOGOPo->op_other, file);
break;
case OP_SPLIT:
case OP_MATCH: