Open p5pRT opened 6 years ago
Depending on the PL_dumpindent the MG_OBJ details are dumped with indentation gap:
Look at output:
PL_dumpindent = 1; SV = PVMG(0x1d74a70) at 0x1bba790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x1bb3bd0 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x1baffe8 SV = IV(0x1baffd8) at 0x1baffe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x1c778b8 SV = PVHV(0x1ba1c60) at 0x1c778b8 ^^ ...
PL_dumpindent = 2; SV = PVMG(0x21aa9d0) at 0x1ff0790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x1fe9b90 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x1fe5fe8 SV = IV(0x1fe5fd8) at 0x1fe5fe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x21a90e8 SV = PVHV(0x1fd7c60) at 0x21a90e8 ^^ ...
PL_dumpindent = 3; SV = PVMG(0x15999c0) at 0x13df790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x13d8b90 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x13d4fe8 SV = IV(0x13d4fd8) at 0x13d4fe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x16c8098 SV = PVHV(0x13c6c60) at 0x16c8098 ^^
So this is unclear where SV belons to Is it belongs to MAGIC or MG_OBJ?
There is no any documentation about PL_dumpindent
Another example of ambiguity: SV = IV(0x2598d20) at 0x2598d30 REFCNT = 1 FLAGS = (TEMP\,ROK) RV = 0x25a3840 SV = PVCV(0x2597c28) at 0x25a3840 REFCNT = 3 FLAGS = () COMP_STASH = 0x2583ff8 "main" START = 0x25aae40 ===> 1 ROOT = 0x27842f0 GVGV::GV = 0x25a3660 "main" :: "t" FILE = "/home/kes/tmp/t3.pl" DEPTH = 1 FLAGS = 0x0 OUTSIDE_SEQ = 2000 PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700) 3. 0x2743170\<1> (2001\,2002) "$x" OUTSIDE = 0x25843d0 (MAIN)
Here we can think that PADNAME is member of PVCV. But from the next out we can understand that PADNAME is child for PADLIST: SV = PVCV(0x2597c28) at 0x25a3840 REFCNT = 2 FLAGS = () COMP_STASH = 0x2583ff8 "main" START = 0x25aae40 ===> 1 ROOT = 0x27842f0 GVGV::GV = 0x25a3660 "main" :: "t" FILE = "/home/kes/tmp/t3.pl" DEPTH = 1 FLAGS = 0x0 OUTSIDE_SEQ = 2000 PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700) 3. 0x2743170\<1> (2001\,2002) "$x" OUTSIDE = 0x25843d0 (MAIN)
Also there are different defaults for PL_dumpindent when dumping from perl script and from XS
On Thu\, 25 Jan 2018 11:16:40 GMT\, kes-kes@yandex.ru wrote:
Message-Id: \5\.24\.0\_11686\_1516878441@​work To: perlbug@perl.org Reply-To: kes-kes@yandex.ru Cc: kes-kes@yandex.ru From: kes-kes@yandex.ru Subject: Devel::Peek: Indentation gap when dumping MG object
This is a bug report for perl from kes-kes@yandex.ru\, generated with the help of perlbug 1.40 running under perl 5.24.0.
----------------------------------------------------------------- [Please describe your issue here]
Depending on the PL_dumpindent the MG_OBJ details are dumped with indentation gap:
Look at output:
PL_dumpindent = 1; SV = PVMG(0x1d74a70) at 0x1bba790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x1bb3bd0 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x1baffe8 SV = IV(0x1baffd8) at 0x1baffe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x1c778b8 SV = PVHV(0x1ba1c60) at 0x1c778b8 ^^ ...
PL_dumpindent = 2; SV = PVMG(0x21aa9d0) at 0x1ff0790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x1fe9b90 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x1fe5fe8 SV = IV(0x1fe5fd8) at 0x1fe5fe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x21a90e8 SV = PVHV(0x1fd7c60) at 0x21a90e8 ^^ ...
PL_dumpindent = 3; SV = PVMG(0x15999c0) at 0x13df790 REFCNT = 1 FLAGS = (GMG\,SMG\,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x13d8b90 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x13d4fe8 SV = IV(0x13d4fd8) at 0x13d4fe8 ^^ REFCNT = 1 FLAGS = (ROK) RV = 0x16c8098 SV = PVHV(0x13c6c60) at 0x16c8098 ^^
Would you be able to provide a short program which a programmer not fluent in XS could run in order to become familiar with this problem. (It's not clear what you did to generate the sample above.)
So this is unclear where SV belons to Is it belongs to MAGIC or MG_OBJ?
There is no any documentation about PL_dumpindent
Confirmed -- but if it's an implementation detail internal to Peek.xs we probably don't want to formally document it. The POD in Peek.pm takes a very cautious approach: 'This document will take a passive\, and safe\, approach to data debugging and for that it will describe only the "Dump()" function.'
Thank you very much.
-- James E Keenan (jkeenan@cpan.org)
The RT System itself - Status changed from 'new' to 'open'
The Devel::Peek makes use of undocumented perlapi function: do_sv_dump
https://metacpan.org/source/XSAWYERX/perl-5.28.0/ext/Devel-Peek/Peek.xs#L337 https://perldoc.perl.org/perlapi.html#do_sv_dump
The issue is about formatting:
PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700)
VS
PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700)
From the output I can not say that PADNAME is member of PADLIST
See an example: https://metacpan.org/pod/Devel::Peek#A-reference-to-a-subroutine
This undocumented function has configuration for the indentation. And this **configuration is applied only to curtain lines** of output. Which lead to confusion.
On Tue\, 04 Sep 2018 08:09:34 GMT\, kes-kes@yandex.ru wrote:
The Devel::Peek makes use of undocumented perlapi function: do_sv_dump
https://metacpan.org/source/XSAWYERX/perl-5.28.0/ext/Devel- Peek/Peek.xs#L337 https://perldoc.perl.org/perlapi.html#do_sv_dump
The issue is about formatting:
PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700)
VS
PADLIST = 0x2774220 PADNAME = 0x27d2970(0x27e0410) PAD = 0x25a36c0(0x26ba700)
From the output I can not say that PADNAME is member of PADLIST
See an example: https://metacpan.org/pod/Devel::Peek#A-reference-to-a- subroutine
This undocumented function has configuration for the indentation. And this **configuration is applied only to curtain lines** of output. Which lead to confusion.
Please find attached a small program\, '132764-devel-peek.pl'\, which Dump-s a reference to a subroutine using a sub name drawn from the Devel::Peek documentation. When I run it (perl-5.28.0)\, I get the output attached as '132764.top_targets.output.txt'.
How would I re-write sub MY::top_targets to make it complicated enough to display the ambiguous indentation you just described?
Thank you very much. -- James E Keenan (jkeenan@cpan.org)
SV = IV(0x25e0568) at 0x25e0578 REFCNT = 1 FLAGS = (TEMP\,ROK) RV = 0x2606fb0 SV = PVCV(0x25fd4b8) at 0x2606fb0 REFCNT = 2 FLAGS = () COMP_STASH = 0x25e03f8 "main" START = 0x2615070 ===> 1 ROOT = 0x2626918 GVGV::GV = 0x2606fe0 "MY" :: "top_targets" FILE = "132764-devel-peek.pl" DEPTH = 0 FLAGS = 0x0 OUTSIDE_SEQ = 389 PADLIST = 0x26110b0 PADNAME = 0x2615b50(0x26835c0) PAD = 0x2606ed8(0x26334f0) OUTSIDE = 0x25e0728 (MAIN)
How would I re-write sub MY::top_targets to make it complicated enough to display the ambiguous indentation you just described?
Actually your dump is already ambigious:
PADNAME is a member of PADLIST\, not the `SV = PVCV(0x25fd4b8) at 0x2606fb0`
Play with this value:
PL_dumpindent = 3;
I change your script and attach the XS
On Tue\, 04 Sep 2018 08:01:39 -0700\, jkeenan wrote:
How would I re-write sub MY::top_targets to make it complicated enough to display the ambiguous indentation you just described?
The attached patch against blead might make this easier to demonstrate.
$ ./perl -Ilib -MDevel::Peek -e '$Devel::Peek::dumpindent = 2; Dump(\$!)' SV = IV(0x55ffb73264f8) at 0x55ffb7326508 REFCNT = 1 FLAGS = (TEMP\,ROK) RV = 0x55ffb7348a88 SV = PVMG(0x55ffb73783c0) at 0x55ffb7348a88 REFCNT = 2 FLAGS = (GMG\,SMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x55ffb734c820 MG_VIRTUAL = &PL_vtbl_sv MG_TYPE = PERL_MAGIC_sv(\0) MG_OBJ = 0x55ffb7326610 MG_LEN = 1 MG_PTR = 0x55ffb73685c0 "!" $ ./perl -Ilib -MDevel::Peek -e '$Devel::Peek::dumpindent = 1; Dump(\$!)' SV = IV(0x55d9bf3cb4f8) at 0x55d9bf3cb508 REFCNT = 1 FLAGS = (TEMP\,ROK) RV = 0x55d9bf3eda88 SV = PVMG(0x55d9bf41d3d0) at 0x55d9bf3eda88 REFCNT = 2 FLAGS = (GMG\,SMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x55d9bf3f5220 MG_VIRTUAL = &PL_vtbl_sv MG_TYPE = PERL_MAGIC_sv(\0) MG_OBJ = 0x55d9bf3cb610 MG_LEN = 1 MG_PTR = 0x55d9bf423bf0 "!"
Tony
Migrated from rt.perl.org#132764 (status was 'open')
Searchable as RT132764$