summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2021-03-09 16:42:11 +0000
committerDavid Mitchell <davem@iabyn.com>2021-03-09 16:42:11 +0000
commita9bb6a62ae45bb372a5cca98a76d1a79edd89ccb (patch)
treec82af8c708f2cd29866e07882cfe2479760fbcf5 /dump.c
parentedfcb93db2c5e42e47f867b5f2b73a3320a6487e (diff)
downloadperl-a9bb6a62ae45bb372a5cca98a76d1a79edd89ccb.tar.gz
Perl_do_sv_dump(): handle PL_strtab
When dumping this special hash, the values in the HE entry are refcounts rather than SV pointers. sv_dump() used to crash here.
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index 31c8792d47..a72accddb3 100644
--- a/dump.c
+++ b/dump.c
@@ -2231,8 +2231,15 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 6 * SvCUR(keysv), UNI_DISPLAY_QQ));
if (HvEITER_get(hv) == he)
PerlIO_printf(file, "[CURRENT] ");
- PerlIO_printf(file, "HASH = 0x%" UVxf "\n", (UV) hash);
- do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
+ PerlIO_printf(file, "HASH = 0x%" UVxf, (UV) hash);
+
+ if (sv == (SV*)PL_strtab)
+ PerlIO_printf(file, " REFCNT = 0x%" UVxf "\n",
+ (UV)he->he_valu.hent_refcount );
+ else {
+ (void)PerlIO_putc(file, '\n');
+ do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
+ }
}
}
DONEHV:;