Skip to content

Commit 527d595

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 f197c1d commit 527d595

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
@@ -2660,13 +2660,17 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
26602660
if (nest < maxnest && ObjectFIELDS(sv)) {
26612661
SSize_t count;
26622662
SV **svp = ObjectFIELDS(sv);
2663+
PADNAME **pname = PadnamelistARRAY(HvAUX(SvSTASH(sv))->xhv_class_fields);
26632664
for (count = 0;
26642665
count <= ObjectMAXFIELD(sv) && count < maxnest;
26652666
count++, svp++)
26662667
{
26672668
SV *const field = *svp;
2668-
Perl_dump_indent(aTHX_ level + 1, file, "Field No. %" IVdf "\n",
2669-
(IV)count);
2669+
PADNAME *pn = pname[count];
2670+
2671+
Perl_dump_indent(aTHX_ level + 1, file, "Field No. %" IVdf " (%s)\n",
2672+
(IV)count, PadnamePV(pn));
2673+
26702674
do_sv_dump(level+1, file, field, nest+1, maxnest, dumpops, pvlim);
26712675
}
26722676
}

0 commit comments

Comments
 (0)