summaryrefslogtreecommitdiff
path: root/ext/Devel-Peek
Commit message (Collapse)AuthorAgeFilesLines
* dump.c - dump new regexp fields properlyYves Orton2023-01-232-78/+150
| | | | | | | | | | | | | | Show the pointer values and their contents. Also show the "MOTHER_RE" at the *end* of the dump, as otherwise it can be quite hard to read. This patch also includes stripping out the versioned test adjustments for regexp related dumps. Devel-Peek is in ext/ so it won't be used on an older perl and we can just make it correct for the latest state. The test for the dump of a branch reset pattern is also implicitly tests whether branch reset pointer table logic is working correctly. In the process of writing this patch I discovered there was an off by one error. See 8111bf2fc3870f8146bb46652b66bd517e82b4dd for the fix.
* dump.c - in op_dump show the hints and feature bitsYves Orton2022-11-011-0/+1
| | | | | I used to 'FEATS' instead of 'FEATURES' so the values line up nicely.
* ext/Devel-Peek/t/Peek.t - cater for doubledouble where neededsisyphus2022-04-081-6/+37
|
* Devel::Peek::Peek.t: Simplify EBCDIC handlingKarl Williamson2022-03-261-48/+27
| | | | | | | | | | | | | | The prior commit shows what can happen when two branches do the same thing: they can get out of sync Since this test file was originally written, the testing infrastructure has improved so that there are functions that handle the gory details of character set differences for you. This test file hadn't been updated since it wasn't causing a problem, until now. This commit changes to use the new infrastructure, and as a result one branch gets removed each from the two tests that varied depending on character set.
* Devel::Peek::Peek.t: Add missing '\' for EBCDICKarl Williamson2022-03-261-1/+1
| | | | | This file was recently changed, and the EBCDIC side of the change had a typo.
* Add tests for increased NV precision in Devel::Peek::DumpTAKAI Kousuke2022-03-091-0/+23
|
* Make sv_dump() (and Devel::Peek) escape PV contents with hex, not octal.Felipe Gasper2022-03-041-6/+6
| | | | | | This improves the readability of SV dumps for those more familiar with hex than octal--which, in 2022, is probably an outsized majority of programmers.
* Remove DOS/DJGPP supportDagfinn Ilmari Mannsåker2021-11-021-1/+1
| | | | | | DJGPP is a port of the GNU toolchain to 32-bit x86 systems running DOS. The last known attempt to build Perl on it was on 5.20, which only got as far as building miniperl.
* Fix the build and tests when NODEFAULT_SHAREKEYS is definedNicholas Clark2021-10-201-0/+5
| | | | | Defining this macro causes newHV() to create hashes without shared hash key scalars. The default is that hashes are created with shared hash keys.
* Add SvIsBOOL() macro to test for SVs being boolean-intentPaul "LeoNerd" Evans2021-09-101-0/+24
| | | | | | | | | | | These are identified as being static shared COW strings whose string buffer points directly at PL_Yes / PL_No Define sv_setbool() and sv_setbool_mg() macros Use sv_setbool() where appropriate Have sv_dump() annotate when an SV's PV buffer is one of the PL_(Yes|No) special booleans
* Test Devel::Peek with tied hashesNicholas Clark2021-09-031-1/+33
|
* Use new sv_setrv_noinc() in Devel::PeekPaul "LeoNerd" Evans2021-08-252-4/+2
|
* Remove inheritance from Exporter in ext/ modulesMax Maischein2021-06-251-2/+1
| | | | | | | | | | | | | | | | | Inheriting from Exporter adds several subroutines that are not really needed by these modules. The remaining uses of inheritance from Exporter are: re.pm - this uses export_to_level(), which really, really wants the inheritance # Conflicts: # ext/File-Find/lib/File/Find.pm # ext/File-Glob/Glob.pm # ext/GDBM_File/GDBM_File.pm # ext/Opcode/Opcode.pm # ext/Pod-Html/lib/Pod/Html.pm
* Catch errors earlier in Devel-Peek/t/Peek.tNicolas R2020-11-051-1/+6
| | | | | | | | | | | | When testing Devel-Peek we can run some tests inside an eval and do not bother to check if it succeeds or not. As STDERR is redirected to a file, we do not even notice the error message when an error occurs. This commit postpones the redirection of STDERR and 'die' if the eval quoted string from `do_test` fails.
* Fix typosSamanta Navarro2020-10-031-2/+2
| | | | | | | | | For: https://github.com/Perl/perl5/pull/18201 Committer: Samanta Navarro is now a Perl author. To keep 'make test_porting' happy: Increment $VERSION in several files. Regenerate uconfig.h via './perl -Ilib regen/uconfig_h.pl'.
* Remove use of dVAR in coreDagfinn Ilmari Mannsåker2020-07-202-2/+1
| | | | | It only does anything under PERL_GLOBAL_STRUCT, which is gone. Keep the dNOOP defintion for CPAN back-compat
* Fix a bunch of repeated-word typosDagfinn Ilmari Mannsåker2020-05-221-1/+1
| | | | | Mostly in comments and docs, but some in diagnostic messages and one case of 'or die die'.
* Un-revert "[MERGE] add+use si_cxsubix field"David Mitchell2019-09-231-1/+1
| | | | | | | | original merge commit: v5.31.3-198-gd2cd363728 reverted by: v5.31.4-0-g20ef288c53 The commit following this commit fixes the breakage, which that means the revert can be undone.
* Revert "[MERGE] add+use PL_curstackinfo->si_cxsubix field"v5.31.4Max Maischein2019-09-201-1/+1
| | | | | | | | | | | | This reverts commit d2cd363728088adada85312725ac9d96c29659be, reversing changes made to 068b48acd4bdf9e7c69b87f4ba838bdff035053c. This change breaks installing Test::Deep: ... not ok 37 - Test 'isa eq' completed ok 38 - Test 'isa eq' no premature diagnostication ...
* set VOID on OP_ENTERDavid Mitchell2019-09-191-1/+1
| | | | | | | | The OP_ENTER planted at the start of a program (and possibly elsewhere) gets left as UNKNOWN context rather than VOID context, due to op_scope() not honouring the current context. Fixing this makes things infinitesimally faster.
* Provide defined value for $TODO only where test should not run.James E Keenan2019-01-201-10/+9
| | | | | | | | | | Some tests should not be run on older perls. To indicate that, provide an undef rather than a defined but false value. This reflects Test::Builder synch with CPAN for upstream bug fix: https://github.com/Test-More/test-more/commit/9c269ff6e2b8a7be223ef1df7a254a09ec4dad2d Note that these should really be SKIPs rather than TODOs (but we can handle that later).
* Update example of Dump on hashref.James E Keenan2018-10-131-23/+20
| | | | | | | For: RT # 133499 Per Tony Cook, the behavior changed in e1a7ec8d453649a65aea34af90c3042a5137191e (March 2013).
* op_dump(): display PARENT of top-most nodeDavid Mitchell2018-03-211-0/+1
| | | | | When dumping a subtree, display the op_parent() value for the top-most node of the subtree.
* use cv_set_call_checker_flags() where possibleZefram2017-08-082-2/+2
| | | | | | | | | | | | | | | Call checkers established by core code were being set through cv_set_call_checker(), so requiring GVs to be created in some cases where they could be avoided. Make all the checkers non-GV-namegv capable, and set them with cv_set_call_checker_flags(). The checkers for Devel::Peek::Dump() and utf8::{unicode_to_native,native_to_unicode}() were already fit to handle non-GV names, so required no changes. The checker for CORE:: subs, ck_entersub_args_core(), was naughtily using the name to decide which sub it was dealing with in some cases, so move that information into the ckobj that was already being used to identify the sub in most cases. It also required reformulation of some error reporting code to use cv_name().
* sv_dump(): display regex LEN and LV-as-RX regexpDavid Mitchell2017-08-041-1/+4
| | | | | | | | When the len field of a REGEXP isn't usurped, display it (it used to always be skipped for REGEXPs). When it's usurped by a PVLV to point to a 'struct regexp', display it as a pointer.
* give REGEXP SVs the POK flag againDavid Mitchell2017-07-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit v5.17.5-99-g8d919b0 stopped SVt_REGEXP SVs (and PVLVs acting as regexes) from having the POK and pPOK flags set. This made things like SvOK() and SvTRUE() slower, because as well as the quick single test for any I/N/P/R flags, SvOK() also has to test for (SvTYPE(sv) == SVt_REGEXP || (SvFLAGS(sv) & (SVTYPEMASK|SVp_POK|SVpgv_GP|SVf_FAKE)) == (SVt_PVLV|SVf_FAKE)) This commit fixes the issue fixed by g8d919b0 in a slightly different way, which is less invasive and allows the POK flag. Background: PVLV are basically PVMGs with a few extra fields. They are intended to be a superset of all scalar types, so any scalar value can be assigned to a PVLV SV. However, once REGEXPs were made into first-class scalar SVs, this assumption broke - there are a whole bunch of fields in a regex SV body which can't be copied to to a PVLV. So this broke: sub f { my $r = qr/abc/; # $r is reference to an SVt_REGEXP $_[0] = $$r; } f($h{foo}); # the hash access is deferred - a temporary PVLV is # passed instead The basic idea behind the g8d919b0 fix was, for an LV-acting-as-regex, to attach both a PVLV body and a regex body to the SV head. This commit keeps this basic concept; it just changes how the extra body is attached. The original fix changed SVt_REGEXP SVs so that sv.sv_u.svu_pv no longer pointed to the regexp's string representation; instead this pointer was stored in a union made out of the xpv_len field. Doing this necessitated not turning the POK flag on for any REGEXP SVs. This freed up the sv_u to point to the regex body, while the sv_any field could continue to point to the PVLV body. An ReANY() macro was introduced that returned the sv_u field rather than the sv_any field. This commit changes it so that instead, on regexp SVs (and LV-as-regexp SVs), sv_u always points to the string buffer (so they can have POK set again), but on specifically LV-as-regex SVs, the xpv_len_u union of the PVLV body points to the regexp body. This means that SVt_REGEXP SVs are now completely "normal" again, and SVt_PVLV SVs are normal except in the one case where they hold a regex, in which case rather than storing the string buffer's length, the PVLV body stores a pointer to the regex body.
* dump.c: handle GV being really a ref to a CVDavid Mitchell2017-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | RT #129285 These days a 'GV' can actually just be a ref to a CV when the only thing that would be stored in the glob is a CV. Update S_do_op_dump_bar() to handle this. Formerly it would trigger an assert on a non-threaded build. In fact, incorporate the fixed logic into a static function, S_gv_display(), that is shared by both S_do_op_dump_bar() and Perl_debop(); so both perl -Dx and perl -Dt get the benefit. Also for the -Dx case, make it display the raw address of the GV too.
* revamp the op_dump() output formatDavid Mitchell2017-01-211-44/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mainly used for low-level debugging these days (higher level stuff like Concise having since been created), e.g. calling op_dump() from within a debugger or running with -Dx. Make it display more info, and use an ACSII-art tree to show the structure. The main changes are: * added 'ASCII-art' tree structure; * it now displays each op's class and address; * for op_next etc links, it now displays the type and address of the linked-to op in addition to its sequence number; * the following ops now have their op_other field displayed, like op_and etc already do: andassign argdefelem dor dorassign entergiven entertry enterwhen once orassign regcomp substcont * enteriter now has its op_redo etc fields displayed, like enterloop already does; Here is a sample before and after of perl -Dx -e'($x+$y) * $z' Before: { 1 TYPE = leave ===> NULL TARG = 1 FLAGS = (VOID,KIDS,PARENS,SLABBED) PRIVATE = (REFC) REFCNT = 1 { 2 TYPE = enter ===> 3 FLAGS = (UNKNOWN,SLABBED,MORESIB) } { 3 TYPE = nextstate ===> 4 FLAGS = (VOID,SLABBED,MORESIB) LINE = 1 PACKAGE = "main" SEQ = 4294967246 } { 5 TYPE = multiply ===> 1 TARG = 5 FLAGS = (VOID,KIDS,SLABBED) PRIVATE = (0x2) { 6 TYPE = add ===> 7 TARG = 3 FLAGS = (SCALAR,KIDS,PARENS,SLABBED,MORESIB) PRIVATE = (0x2) { 8 TYPE = null ===> (9) (was rv2sv) FLAGS = (SCALAR,KIDS,SLABBED,MORESIB) PRIVATE = (0x1) { 4 TYPE = gvsv ===> 9 FLAGS = (SCALAR,SLABBED) PADIX = 1 } } { 10 TYPE = null ===> (6) (was rv2sv) FLAGS = (SCALAR,KIDS,SLABBED) PRIVATE = (0x1) { 9 TYPE = gvsv ===> 6 FLAGS = (SCALAR,SLABBED) PADIX = 2 } } } { 11 TYPE = null ===> (5) (was rv2sv) FLAGS = (SCALAR,KIDS,SLABBED) PRIVATE = (0x1) { 7 TYPE = gvsv ===> 5 FLAGS = (SCALAR,SLABBED) PADIX = 4 } } } } After: 1 leave LISTOP(0xdecb38) ===> [0x0] TARG = 1 FLAGS = (VOID,KIDS,PARENS,SLABBED) PRIVATE = (REFC) REFCNT = 1 | 2 +--enter OP(0xdecb00) ===> 3 [nextstate 0xdecb80] | FLAGS = (UNKNOWN,SLABBED,MORESIB) | 3 +--nextstate COP(0xdecb80) ===> 4 [gvsv 0xdeb3b8] | FLAGS = (VOID,SLABBED,MORESIB) | LINE = 1 | PACKAGE = "main" | SEQ = 4294967246 | 5 +--multiply BINOP(0xdecbe0) ===> 1 [leave 0xdecb38] TARG = 5 FLAGS = (VOID,KIDS,SLABBED) PRIVATE = (0x2) | 6 +--add BINOP(0xdeb2b0) ===> 7 [gvsv 0xdeb270] | TARG = 3 | FLAGS = (SCALAR,KIDS,PARENS,SLABBED,MORESIB) | PRIVATE = (0x2) | | 8 | +--null (ex-rv2sv) UNOP(0xdeb378) ===> 9 [gvsv 0xdeb338] | | FLAGS = (SCALAR,KIDS,SLABBED,MORESIB) | | PRIVATE = (0x1) | | | 4 | | +--gvsv PADOP(0xdeb3b8) ===> 9 [gvsv 0xdeb338] | | FLAGS = (SCALAR,SLABBED) | | PADIX = 1 | | 10 | +--null (ex-rv2sv) UNOP(0xdeb2f8) ===> 6 [add 0xdeb2b0] | FLAGS = (SCALAR,KIDS,SLABBED) | PRIVATE = (0x1) | | 9 | +--gvsv PADOP(0xdeb338) ===> 6 [add 0xdeb2b0] | FLAGS = (SCALAR,SLABBED) | PADIX = 2 | 11 +--null (ex-rv2sv) UNOP(0xdeb220) ===> 5 [multiply 0xdecbe0] FLAGS = (SCALAR,KIDS,SLABBED) PRIVATE = (0x1) | 7 +--gvsv PADOP(0xdeb270) ===> 5 [multiply 0xdecbe0] FLAGS = (SCALAR,SLABBED) PADIX = 4
* Various .t's: Escape literal '}' and ']' in patternsKarl Williamson2017-01-131-1/+1
| | | | | It is clearer to show that these characters which are sometimes meta and sometimes literal are meant to be taken literally here.
* Switch most open() calls to three-argument form.John Lightsey2016-12-231-5/+5
| | | | | | | | | | Switch from two-argument form. Filehandle cloning is still done with the two argument form for backward compatibility. Committer: Get all porting tests to pass. Increment some $VERSIONs. Run: ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl For: RT #130122
* Change white space to avoid C++ deprecation warningKarl Williamson2016-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | C++11 requires space between the end of a string literal and a macro, so that a feature can unambiguously be added to the language. Starting in g++ 6.2, the compiler emits a warning when there isn't a space (presumably so that future versions can support C++11). Unfortunately there are many such instances in the perl core. This commit fixes those, including those in ext/, but individual commits will be used for the other modules, those in dist/ and cpan/. This commit also inserts space at the end of a macro before a string literal, even though that is not deprecated, and removes useless "" literals following a macro (instead of inserting a blank). The result is easier to read, making the macro stand out, and be clearer as to the intention. Code and modules included with the Perl core need to be compilable using C++. This is so that perl can be embedded in C++ programs. (Actually, only the hdr files need to be so compilable, but it would be hard to test that just the hdrs are compilable.) So we need to accommodate changes to the C++ language.
* eliminate SVpbm_VALID flagDavid Mitchell2016-11-121-3/+3
| | | | | | | | This flag is set on an SV to indicate that it has PERL_MAGIC_bm (fast Boyer-Moore) magic attached. Instead just directly check whether it has such magic. This frees up the 0x40000000 bit for anything except AVs and HVs
* Eliminate SVrepl_EVAL and SvEVALED()David Mitchell2016-11-121-7/+3
| | | | | | | | | | | This flag is only used to indicate that the SV holding the text of the replacement part of a s/// has seen at least one /e. Instead, set the IVX field in the SV to a true value. (We already set the NVX field on that SV to indicate a multi-src-line substitution). This is to reduce the number of odd special cases for the SVpbm_VALID flag.
* dump.c: don't display an ARRAY's ARYLEN fieldDavid Mitchell2016-11-122-6/+1
| | | | | | | | | | | | | Originally xav_arylen was an AV field and was displayed by sv_dump. In 2005, this ield was removed, and replaced by PERL_MAGIC_arylen_p magic when needed. A side effect of this is that sv_dump on a magical AV adds PERL_MAGIC_arylen_p magic to the av as a side-effect. Which is undesirable. This commit just omits displaying 'ARYLEN =' altogether. Any arylen magic will already be displayed as part of dumping the AV, so it's redundant.
* Devel-Peek: use hv_fetchs() when the key is a constant stringYves Orton2016-10-192-15/+15
|
* Change scalar(%hash) to be the same as 0+keys(%hash)Yves Orton2016-06-221-29/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This subject has a long history see [perl #114576] for more discussion. https://rt.perl.org/Public/Bug/Display.html?id=114576 There are a variety of reasons we want to change the return signature of scalar(%hash). One is that it leaks implementation details about our associative array structure. Another is that it requires us to keep track of the used buckets in the hash, which we use for no other purpose but for scalar(%hash). Another is that it is just odd. Almost nothing needs to know these values. Perhaps debugging, but we have several much better functions for introspecting the internals of a hash. By changing the return signature we can remove all the logic related to maintaining and updating xhv_fill_lazy. This should make hot code paths a little faster, and maybe save some memory for traversed hashes. In order to provide some form of backwards compatibility we adds three new functions to the Hash::Util namespace: bucket_ratio(), num_buckets() and used_buckets(). These functions are actually implemented in universal.c, and thus always available even if Hash::Util is not loaded. This simplifies testing. At the same time Hash::Util contains backwards compatible code so that the new functions are available from it should they be needed in older perls. There are many tests in t/op/hash.t that are more or less obsolete after this patch as they test that xhv_fill_lazy is correctly set in various situations. However since we have a backwards compat layer we can just switch them to use bucket_ratio(%hash) instead of scalar(%hash) and keep the tests, just in case they are actually testing something not tested elsewhere.
* Devel::Peek: Fix a couple of pod glitchesKarl Williamson2016-05-251-3/+5
|
* Devel::Peek: document that uses STDERRKarl Williamson2015-11-091-1/+3
|
* rename op_lastsib to op_moresib, and invert logicDavid Mitchell2015-04-191-8/+8
| | | | | | | Rather than having a flag which indicates that there are no more siblings, have a flag which indicates that there are more siblings. This flag was only introduced during the current blead cycle, so no production releases know about it.
* Devel::Peek:Peek.t: Fix to work on EBCDICKarl Williamson2015-03-091-14/+22
|
* Reverse 'const static' to avoid 'old-style-declaration' warning.James E Keenan2015-02-032-2/+2
|
* TODO Peek.t test on VMS.Craig A. Berry2015-01-291-10/+12
| | | | | DumpProg() works just fine but when piped through the broken pipe implementation produces spurious newlines. So mark it TODO on VMS.
* const the custom op struct in Devel::PeekDaniel Dragan2015-01-052-6/+8
| | | | | | This makes the Devel::Peek shared library free of perl caused RW static data vars, and if CC/OS platform allows, removes RW data section from the shared library.
* Fixes to make test pass for regexp nocapture bit addition.Matthew Horsfall (alh)2014-12-281-2/+2
| | | | | | | | | | | * Make Devel-Peek/t/Peek.t less sensitive to regexp flag changes. Devel-Peek had flag names and binary representation hardcoded. Flag names *should* be enough. Otherwise we have to update bits of this test every time we muck with flags that don't affect the flags being tested. * Let B::Deparse know about the new RXf_PMf_CHARSET shift value.
* Increase $Devel::Peek::VERSION to 1.20Father Chrysostomos2014-12-071-1/+1
|
* Change OP_SIBLING to OpSIBLINGFather Chrysostomos2014-12-071-4/+4
| | | | | | | | | to match the existing convention (OpREFCNT, OpSLAB). Dave Mitchell asked me to wait until after his multideref work was merged. Unfortunately, there are now CPAN modules using OP_SIBLING.
* add xs_handshake APIDaniel Dragan2014-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API elevates the amount of ABI compatibility protection between XS modules and the interp. It also makes each boot XSUB smaller in machine code by removing function calls and factoring out code into the new Perl_xs_handshake and Perl_xs_epilog functions. sv.c : - revise padlist duping code to reduce code bloat/asserts on DEBUGGING ext/DynaLoader/dlutils.c : - disable version checking so interp startup is faster, ABI mismatches are impossible because DynaLoader is never available as a shared library ext/XS-APItest/XSUB-redefined-macros.xs : - "" means dont check the version, so switch to " " to make the test in xsub_h.t pass, see ML thread "XS_APIVERSION_BOOTCHECK and XS_VERSION is CPP defined but "", mow what?" ext/re/re.xs : - disable API version checking until #123007 is resolved ParseXS/Utilities.pm : 109-standard_XS_defs.t : - remove context from S_croak_xs_usage similar to core commit cb077ed296 . CvGV doesn't need a context until 5.21.4 and commit ae77754ae2 and by then core's croak_xs_uage API has been long available and this backport doesn't need to account for newer perls - fix test where lack of having PERL_IMPLICIT_CONTEXT caused it to fail
* Deparse Devel::Peek::DumpFather Chrysostomos2014-11-062-1/+11
| | | | | I’m not sure how or where to test this. Maybe we should document this ‘accidental’ plug-in interface for B::Deparse and custom ops.
* Adjust Peek.t for SEQ dumpingFather Chrysostomos2014-11-061-3/+7
|
* Make Peek.t less sensitive to NO_COW config argsFather Chrysostomos2014-11-041-2/+2
| | | | | | Maybe what I am doing is too clever, but I just take the last Configure command line and add an S to -DPERL_NO_COW to disable it. It doesn’t hurt to make Peek.t more robust, though.