Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.93k stars 552 forks source link

debugger examine broken #16359

Open p5pRT opened 6 years ago

p5pRT commented 6 years ago

Migrated from rt.perl.org#132715 (status was 'open')

Searchable as RT132715$

p5pRT commented 6 years ago

From @craigberry

Something fairly recent as of v5.27.7-130-g4d7e83bba2 broke the "x" command in the debugger. From within t/ after a successful build​:

$ ./perl -d -I../lib io/fs.t

Loading DB routines from perl5db.pl version 1.53 Editor support available.

Enter h or 'h h' for help\, or 'man perldebug' for more help.

main​::(io/fs.t​:11)​: my $Is_VMSish = ($^O eq 'VMS'); DB\<1> b 195 DB\<2> c 1..61 ok 1 - umask ok 2 - link a b ok 3 - link b c ok 4 - link count of triply-linked file ok 5 - mode of triply-linked file ok 6 - chmod succeeding ok 7 - chmod going through ok 8 - chmod two files ok 9 - chmod going through to c ok 10 - chmod going through to x ok 11 - unlink two files ok 12 - ino of removed file b should be undef ok 13 - ino of removed file x should be undef ok 14 - open a ok 15 - fchmod main​::(io/fs.t​:195)​: is($mode & 0777\, 0\, "perm reset"); DB\<2> x $mode Died at ../lib/perl5db.pl line 6390. at ../lib/perl5db.pl line 6390.   DB​::dumpit(GLOB(0x7fca31182bf0)\, ARRAY(0x7fca312ba2a0)) called at ../lib/perl5db.pl line 767   DB​::eval called at ../lib/perl5db.pl line 3138   DB​::DB called at io/fs.t line 195 # Looks like you planned 61 tests but ran 15. Debugged program terminated. Use q to quit or R to restart\, use o inhibit_exit to avoid stopping after program termination\, h q\, h R or h o to get additional info. DB\<3>

$ ./perl -I../lib -V Summary of my perl5 (revision 5 version 27 subversion 8) configuration​: Commit id​: 4d7e83bba2968618bd9026ce17ae87f5529e5f38 Platform​:   osname=darwin   osvers=17.3.0   archname=darwin-2level   uname='darwin triamond.local 17.3.0 darwin kernel version 17.3.0​: thu nov 9 18​:09​:22 pst 2017; root​:xnu-4570.31.3~1release_x86_64 x86_64 '   config_args='-Dusedevel -des'   hint=recommended   useposix=true   d_sigaction=define   useithreads=undef   usemultiplicity=undef   use64bitint=define   use64bitall=define   uselongdouble=undef   usemymalloc=n   default_inc_excludes_dot=define   bincompat5005=undef Compiler​:   cc='cc'   ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.13 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV'   optimize='-O3'   cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.13 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include'   ccversion=''   gccversion='4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)'   gccosandvers=''   intsize=4   longsize=8   ptrsize=8   doublesize=8   byteorder=12345678   doublekind=3   d_longlong=define   longlongsize=8   d_longdbl=define   longdblsize=16   longdblkind=3   ivtype='long'   ivsize=8   nvtype='double'   nvsize=8   Off_t='off_t'   lseeksize=8   alignbytes=8   prototype=define Linker and Libraries​:   ld='cc'   ldflags =' -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib'   libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib /usr/lib   libs=-lpthread -ldbm -ldl -lm -lutil -lc   perllibs=-lpthread -ldl -lm -lutil -lc   libc=   so=dylib   useshrplib=false   libperl=libperl.a   gnulibc_version='' Dynamic Linking​:   dlsrc=dl_dlopen.xs   dlext=bundle   d_dlsymun=undef   ccdlflags=' '   cccdlflags=' '   lddlflags=' -mmacosx-version-min=10.13 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl)​: Compile-time options​:   HAS_TIMES   PERLIO_LAYERS   PERL_COPY_ON_WRITE   PERL_DONT_CREATE_GVSV   PERL_MALLOC_WRAP   PERL_OP_PARENT   PERL_PRESERVE_IVUV   PERL_USE_DEVEL   PERL_USE_SAFE_PUTENV   USE_64_BIT_ALL   USE_64_BIT_INT   USE_LARGE_FILES   USE_LOCALE   USE_LOCALE_COLLATE   USE_LOCALE_CTYPE   USE_LOCALE_NUMERIC   USE_LOCALE_TIME   USE_PERLIO   USE_PERL_ATOF Built under darwin Compiled at Jan 12 2018 17​:47​:17 @​INC​:   ../lib   /usr/local/lib/perl5/site_perl/5.27.8/darwin-2level   /usr/local/lib/perl5/site_perl/5.27.8   /usr/local/lib/perl5/5.27.8/darwin-2level   /usr/local/lib/perl5/5.27.8   /usr/local/lib/perl5/site_perl

p5pRT commented 6 years ago

From @craigberry

On Fri\, Jan 12\, 2018 at 10​:08 PM\, Craig A.Berry \perlbug\-followup@&#8203;perl\.org wrote​:

# New Ticket Created by Craig A. Berry # Please include the string​: [perl #132715] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=132715 >

Something fairly recent as of v5.27.7-130-g4d7e83bba2 broke the "x" command in the debugger. From within t/ after a successful build​:

It's not actually that recent. I've reproduced it in v5.27.5.

$ ./perl -d -I../lib io/fs.t

Loading DB routines from perl5db.pl version 1.53 Editor support available.

Enter h or 'h h' for help\, or 'man perldebug' for more help.

main​::(io/fs.t​:11)​: my $Is_VMSish = ($^O eq 'VMS'); DB\<1> b 195 DB\<2> c 1..61 \ main​::(io/fs.t​:195)​: is($mode & 0777\, 0\, "perm reset"); DB\<2> x $mode Died at ../lib/perl5db.pl line 6390. at ../lib/perl5db.pl line 6390. DB​::dumpit(GLOB(0x7fca31182bf0)\, ARRAY(0x7fca312ba2a0)) called at ../lib/perl5db.pl line 767 DB​::eval called at ../lib/perl5db.pl line 3138 DB​::DB called at io/fs.t line 195 # Looks like you planned 61 tests but ran 15.

The code in perl5db.pl that looks like this is failing​:

  # Load dumpvar.pl unless we've already got the sub we need from it.   unless ( defined &main​::dumpValue ) {   do 'dumpvar.pl' or die $@​;   }

The current working directory is t/\ and @​INC consists only of C\<../lib>\, so it can't find dumpvar.pl. An installed perl would likely not have this problem as the @​INC entries would be absolute paths\, but debugging test failures in a core build is a pretty key feature.

I don't know why the debugger defers the loading of dumpvar.pl rather than just requiring it up top. Surely there would be few debug sessions that never dump a variable?

One approach to fix this might be a self locator as was done for loc_tools.pl in​:

\https://perl5.git.perl.org/perl.git/commitdiff/9969000e1134387c0ed173e5d1b3f3b760a1d00c

However\, that uses File​::Spec\, which perl5db.pl does not currently use\, and there may be a reason for that. The debugger does use Cwd and saves the variable C\<$_initial_cwd>\, but knowing what directory we started in doesn't really help us unless we combine it with each entry in @​INC (and only when those entries are relative).

p5pRT commented 6 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 6 years ago

From @jkeenan

On Sat\, 13 Jan 2018 18​:18​:37 GMT\, craig.a.berry@​gmail.com wrote​:

On Fri\, Jan 12\, 2018 at 10​:08 PM\, Craig A.Berry \perlbug\-followup@&#8203;perl\.org wrote​:

# New Ticket Created by Craig A. Berry # Please include the string​: [perl #132715] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=132715 >

Something fairly recent as of v5.27.7-130-g4d7e83bba2 broke the "x" command in the debugger. From within t/ after a successful build​:

It's not actually that recent. I've reproduced it in v5.27.5.

$ ./perl -d -I../lib io/fs.t

Loading DB routines from perl5db.pl version 1.53 Editor support available.

Enter h or 'h h' for help\, or 'man perldebug' for more help.

main​::(io/fs.t​:11)​: my $Is_VMSish = ($^O eq 'VMS'); DB\<1> b 195 DB\<2> c 1..61 \ main​::(io/fs.t​:195)​: is($mode & 0777\, 0\, "perm reset"); DB\<2> x $mode Died at ../lib/perl5db.pl line 6390. at ../lib/perl5db.pl line 6390. DB​::dumpit(GLOB(0x7fca31182bf0)\, ARRAY(0x7fca312ba2a0)) called at ../lib/perl5db.pl line 767 DB​::eval called at ../lib/perl5db.pl line 3138 DB​::DB called at io/fs.t line 195 # Looks like you planned 61 tests but ran 15.

I encountered this myself several weeks ago\, but wrote it off as my own clumsiness in using the debugger.

It's very old. I started to do git checkouts of tags and got as far back as this​:

##### tag v5.15.0 $ git show --format=fuller | head -5 commit 00b4043708e2509400eff8f5e4cb870d388854d4 Author​: David Golden \dagolden@&#8203;cpan\.org AuthorDate​: Mon Jun 20 19​:07​:28 2011 -0400 Commit​: David Golden \dagolden@&#8203;cpan\.org CommitDate​: Mon Jun 20 19​:07​:28 2011 -0400 ##### [t] 522 $ ./perl -I../lib -d io/fs.t

Loading DB routines from perl5db.pl version 1.34 Editor support available.

Enter h or `h h' for help\, or `man perldebug' for more help.

main​::(io/fs.t​:11)​: my $Is_VMSish = ($^O eq 'VMS');   DB\<1> b 178   DB\<2> c 1..51 ok 1 - umask ok 2 - link a b ok 3 - link b c ok 4 - link count of triply-linked file ok 5 - mode of triply-linked file ok 6 - chmod succeeding ok 7 - chmod going through ok 8 - chmod two files ok 9 - chmod going through to c ok 10 - chmod going through to x ok 11 - unlink two files ok 12 - ino of removed file b should be undef ok 13 - ino of removed file x should be undef ok 14 - open a ok 15 - fchmod main​::(io/fs.t​:178)​: skip "no mode checks"\, 1 if $skip_mode_checks;   DB\<2> x $mode Died at ../lib/perl5db.pl line 5619. at ../lib/perl5db.pl line 5619   DB​::dumpit('GLOB(0x11d5ce0)'\, 'ARRAY(0x169f028)') called at ../lib/perl5db.pl line 675   DB​::eval called at ../lib/perl5db.pl line 3442   DB​::DB called at io/fs.t line 178 # Looks like you planned 51 tests but ran 15. Debugged program terminated. Use q to quit or R to restart\,   use o inhibit_exit to avoid stopping after program termination\,   h q\, h R or h o to get additional info.
#####

The code in perl5db.pl that looks like this is failing​:

# Load dumpvar.pl unless we've already got the sub we need from it. unless ( defined &main​::dumpValue ) { do 'dumpvar.pl' or die $@​; }

The current working directory is t/\ and @​INC consists only of C\<../lib>\, so it can't find dumpvar.pl. An installed perl would likely not have this problem as the @​INC entries would be absolute paths\, but debugging test failures in a core build is a pretty key feature.

I don't know why the debugger defers the loading of dumpvar.pl rather than just requiring it up top. Surely there would be few debug sessions that never dump a variable?

One approach to fix this might be a self locator as was done for loc_tools.pl in​:

\https://perl5.git.perl.org/perl.git/commitdiff/9969000e1134387c0ed173e5d1b3f3b760a1d00c

However\, that uses File​::Spec\, which perl5db.pl does not currently use\, and there may be a reason for that. The debugger does use Cwd and saves the variable C\<$_initial_cwd>\, but knowing what directory we started in doesn't really help us unless we combine it with each entry in @​INC (and only when those entries are relative).

-- James E Keenan (jkeenan@​cpan.org)