summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-09-26 15:00:21 +0200
committerYves Orton <demerphq@gmail.com>2022-10-18 15:50:30 +0200
commit40d662ad46f02fed253b998c4691175dd158c128 (patch)
tree387b3d846ee8ccee899f851c8021b70550cf19c9 /proto.h
parentfc9696a5e55c64ae01cfd7890d3b832cb309b822 (diff)
downloadperl-40d662ad46f02fed253b998c4691175dd158c128.tar.gz
dump.c - add ways to dump HV's and AV's and SV's to any depth.
Currently you can use sv_dump() to dump an AV or HV as these are still SV's underneath in C terms, but it will only dump out the top level object and will not dump out its contents, whereas if you have an RV which references the same AV or HV it will dump it out to depth of 4. This adds av_dump() and hv_dump() which dump up to a depth of 3 (thus matching what sv_dump() would have showed had it been used to dump an RV to the same object). It also adds sv_dump_depth() which allows passing in an arbitrary depth. You could argue the former are redundant in light of sv_dump_depth(), but the av_dump() and hv_dump() variants do not require a cast for their arguments. These functions are provided as debugging aids for development. They aren't used directly in the core, and they all wrap the same core routine that is used for sv_dump() (do_sv_dump()).
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index bb9975e243..f4f762ef0d 100644
--- a/proto.h
+++ b/proto.h
@@ -295,6 +295,8 @@ PERL_CALLCONV SV** Perl_av_create_and_unshift_one(pTHX_ AV **const avp, SV *cons
PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags);
#define PERL_ARGS_ASSERT_AV_DELETE \
assert(av)
+PERL_CALLCONV void Perl_av_dump(pTHX_ AV* av);
+#define PERL_ARGS_ASSERT_AV_DUMP
PERL_CALLCONV bool Perl_av_exists(pTHX_ AV *av, SSize_t key)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_AV_EXISTS \
@@ -1613,6 +1615,8 @@ PERL_CALLCONV SV* Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 has
#define PERL_ARGS_ASSERT_HV_DELETE_ENT \
assert(keysv)
#endif
+PERL_CALLCONV void Perl_hv_dump(pTHX_ HV* hv);
+#define PERL_ARGS_ASSERT_HV_DUMP
PERL_CALLCONV HE** Perl_hv_eiter_p(pTHX_ HV *hv)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_HV_EITER_P \
@@ -3929,6 +3933,8 @@ PERL_CALLCONV bool Perl_sv_does_sv(pTHX_ SV* sv, SV* namesv, U32 flags)
PERL_CALLCONV void Perl_sv_dump(pTHX_ SV* sv);
#define PERL_ARGS_ASSERT_SV_DUMP
+PERL_CALLCONV void Perl_sv_dump_depth(pTHX_ SV* sv, I32 depth);
+#define PERL_ARGS_ASSERT_SV_DUMP_DEPTH
#ifndef NO_MATHOMS
PERL_CALLCONV I32 Perl_sv_eq(pTHX_ SV* sv1, SV* sv2);
#define PERL_ARGS_ASSERT_SV_EQ