Skip to content

Commit 4dff8ee

Browse files
committed
dump.c: When dumping SVt_PVOBJ, show field names as well
This way, instead of: Field No. 0 SV = PV(0x5638ccf57fb0) at 0x5638ccf7b9c0 REFCNT = 1 ... You get: Field No. 0 ($name) SV = PV(0x5638ccf57fb0) at 0x5638ccf7b9c0 REFCNT = 1
1 parent b98995e commit 4dff8ee

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dump.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,13 +2607,17 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
26072607
if (nest < maxnest && ObjectFIELDS(sv)) {
26082608
SSize_t count;
26092609
SV **svp = ObjectFIELDS(sv);
2610+
PADNAME **pname = PadnamelistARRAY(HvAUX(SvSTASH(sv))->xhv_class_fields);
26102611
for (count = 0;
26112612
count <= ObjectMAXFIELD(sv) && count < maxnest;
26122613
count++, svp++)
26132614
{
26142615
SV *const field = *svp;
2615-
Perl_dump_indent(aTHX_ level + 1, file, "Field No. %" IVdf "\n",
2616-
(IV)count);
2616+
PADNAME *pn = pname[count];
2617+
2618+
Perl_dump_indent(aTHX_ level + 1, file, "Field No. %" IVdf " (%s)\n",
2619+
(IV)count, PadnamePV(pn));
2620+
26172621
do_sv_dump(level+1, file, field, nest+1, maxnest, dumpops, pvlim);
26182622
}
26192623
}

0 commit comments

Comments
 (0)