Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some code does not work under debugger #16201

Open
p5pRT opened this issue Oct 14, 2017 · 6 comments
Open

Some code does not work under debugger #16201

p5pRT opened this issue Oct 14, 2017 · 6 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Oct 14, 2017

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

Searchable as RT132304$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 14, 2017

From @KES777

Created by @KES777

Next program​:
$ cat t.pl
#!/usr/bin/env perl

use DateTime;
use DateTime​::Format​::Pg;

my $x=DateTime->new( year => 2004 );
$x->set_formatter( DateTime​::Format​::Pg->new );
print $x->formatter

works fine​:
$ ./t.pl
DateTime​::Format​::Pg=HASH(0x1df0918)

but not under debugger​:
perl -d ./t.pl

Loading DB routines from perl5db.pl version 1.49_04
Editor support available.

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

main​::(./t.pl​:6)​: my $x=DateTime->new( year => 2004 );
  DB<1> n
main​::(./t.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
  DB<1> n
Can't call method "can" on unblessed reference at (eval 203)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line 1.
at (eval 203)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line 1.
  Eval​::Closure​::Sandbox_186​::__ANON__[(eval 203)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149]​:34] called at (eval 203)[/home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34
  DateTime​::_check_set_formatter_params(DateTime​::Format​::Pg=HASH(0x3277670)) called at /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/DateTime.pm line 2076
  DateTime​::set_formatter(DateTime=HASH(0x33b5f78), DateTime​::Format​::Pg=HASH(0x3277670)) called at ./t.pl line 7
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<1> n

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.24.0:

Configured by kes at Wed Oct 19 14:07:47 EEST 2016.

Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=4.4.0-43-generic, archname=x86_64-linux
    uname='linux work 4.4.0-43-generic #63-ubuntu smp wed oct 12 13:48:03 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-5.24.0 -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.4.0 20160609', 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 =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.38


@INC for perl 5.24.0:
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0
    .


Environment for perl 5.24.0:
    HOME=/home/kes
    LANG=en_US.UTF-8
    LANGUAGE=en
    LC_ADDRESS=uk_UA.UTF-8
    LC_IDENTIFICATION=uk_UA.UTF-8
    LC_MEASUREMENT=uk_UA.UTF-8
    LC_MESSAGES=en_US.UTF-8
    LC_MONETARY=uk_UA.UTF-8
    LC_NAME=uk_UA.UTF-8
    LC_NUMERIC=uk_UA.UTF-8
    LC_PAPER=uk_UA.UTF-8
    LC_TELEPHONE=uk_UA.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin:/home/kes/bin:/home/kes/bin:/home/kes/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    PERLBREW=command perlbrew
    PERLBREW_BASHRC_VERSION=0.78
    PERLBREW_HOME=/home/kes/.perlbrew
    PERLBREW_MANPATH=/home/kes/perl5/perlbrew/perls/perl-5.24.0/man
    PERLBREW_PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin
    PERLBREW_PERL=perl-5.24.0
    PERLBREW_ROOT=/home/kes/perl5/perlbrew
    PERLBREW_VERSION=0.78
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 15, 2017

From @jkeenan

On Sat, 14 Oct 2017 18​:22​:25 GMT, kes-kes@​yandex.ru wrote​:

From​: kes-kes@​yandex.ru
Cc​: kes-kes@​yandex.ru
Message-Id​: <5.24.0_17258_1508005034@​work>
To​: perlbug@​perl.org
Subject​: Some code do not work under debugger
Reply-To​: kes-kes@​yandex.ru

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]
Next program​:
$ cat t.pl
#!/usr/bin/env perl

use DateTime;
use DateTime​::Format​::Pg;

my $x=DateTime->new( year => 2004 );
$x->set_formatter( DateTime​::Format​::Pg->new );
print $x->formatter

works fine​:
$ ./t.pl
DateTime​::Format​::Pg=HASH(0x1df0918)

but not under debugger​:
perl -d ./t.pl

Loading DB routines from perl5db.pl version 1.49_04
Editor support available.

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

main​::(./t.pl​:6)​: my $x=DateTime->new( year => 2004 );
DB<1> n
main​::(./t.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
DB<1> n
Can't call method "can" on unblessed reference at (eval
203)[/home/kes/perl5/perlbrew/perls/perl-
5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line
1.
at (eval 203)[/home/kes/perl5/perlbrew/perls/perl-
5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line
1.
Eval​::Closure​::Sandbox_186​::__ANON__[(eval
203)[/home/kes/perl5/perlbrew/perls/perl-
5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149]​:34] called at (eval
203)[/home/kes/perl5/perlbrew/perls/perl-
5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34
DateTime​::_check_set_formatter_params(DateTime​::Format​::Pg=HASH(0x3277670))
called at /home/kes/perl5/perlbrew/perls/perl-
5.24.0/lib/site_perl/5.24.0/x86_64-linux/DateTime.pm line 2076
DateTime​::set_formatter(DateTime=HASH(0x33b5f78),
DateTime​::Format​::Pg=HASH(0x3277670)) called at ./t.pl line 7
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<1> n

I could not reproduce this problem using perl-5.26.0 on Ubuntu Linux 16.04 LTS.

I tried the program both as is, and -- for better readability -- with a "\n" after the final statement. Here's what I got​:

######
$ perl -d 132304-debugger.pl

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

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

main​::(132304-debugger.pl​:6)​: my $x=DateTime->new( year => 2004 );
  DB<1> n
main​::(132304-debugger.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
  DB<1>
main​::(132304-debugger.pl​:9)​: print $x->formatter, "\n";
  DB<1>
DateTime​::Format​::Pg=HASH(0x25af138)
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<1> q
#####

No problem there for me.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 15, 2017

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 15, 2017

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

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 16, 2017

From @KES777

Can not confirm (Just check with perl-5.26.1). But agree that this may be something with my environment.

I use perlbrew​:

env | grep PERL
PERLBREW_VERSION=0.78
PERLBREW_PERL=perl-5.26.1
PERLBREW_BASHRC_VERSION=0.78
PERLBREW_ROOT=/home/kes/perl5/perlbrew
PERLBREW_HOME=/home/kes/.perlbrew
PERLBREW_MANPATH=/home/kes/perl5/perlbrew/perls/perl-5.26.1/man
PERLBREW_PATH=/home/kes/perl5/perlbrew/bin​:/home/kes/perl5/perlbrew/perls/perl-5.26.1/bin
PERLBREW=command perlbrew

kes@​work ~/s $ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2017, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http​://www.perl.org/, the Perl Home Page.

kes@​work ~/s $ PERL5LIB=/home/kes/s/local/lib/perl5 perl -d t.pl

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

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

main​::(t.pl​:6)​: my $x=DateTime->new( year => 2004 );
  DB<1> n
main​::(t.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
  DB<1>
Can't call method "can" on unblessed reference at (eval 203)[/home/kes/s/local/lib/perl5/Eval/Closure.pm​:149] line 34, <DATA> line 1.
at (eval 203)[/home/kes/s/local/lib/perl5/Eval/Closure.pm​:149] line 34, <DATA> line 1.
  Eval​::Closure​::Sandbox_186​::__ANON__[(eval 203)[/home/kes/s/local/lib/perl5/Eval/Closure.pm​:149]​:34] called at (eval 203)[/home/kes/s/local/lib/perl5/Eval/Closure.pm​:149] line 34
  DateTime​::_check_set_formatter_params(DateTime​::Format​::Pg=HASH(0xb9bb78)) called at /home/kes/s/local/lib/perl5/x86_64-linux/DateTime.pm line 2076
  DateTime​::set_formatter(DateTime=HASH(0x29cbc88), DateTime​::Format​::Pg=HASH(0xb9bb78)) called at t.pl line 7
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.

How to reproduce environment​:

$ perlbrew install perl-5.26.1
$ cpanm Carton
$ carton
cpanfile in attachment

$ uname -a
Linux work 4.4.0-57-generic #78-Ubuntu SMP Fri Dec 9 23​:50​:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Here is Linux Mint 18

15.10.2017, 10​:58, "James E Keenan via RT" <perlbug-followup@​perl.org>​:

On Sat, 14 Oct 2017 18​:22​:25 GMT, kes-kes@​yandex.ru wrote​:

 From​: kes-kes@​yandex.ru
 Cc​: kes-kes@​yandex.ru
 Message-Id​: <5.24.0_17258_1508005034@​work>
 To​: perlbug@​perl.org
 Subject​: Some code do not work under debugger
 Reply-To​: kes-kes@​yandex.ru

 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]
 Next program​:
 $ cat t.pl
 #!/usr/bin/env perl

 use DateTime;
 use DateTime​::Format​::Pg;

 my $x=DateTime->new( year => 2004 );
 $x->set_formatter( DateTime​::Format​::Pg->new );
 print $x->formatter

 works fine​:
 $ ./t.pl
 DateTime​::Format​::Pg=HASH(0x1df0918)

 but not under debugger​:
 perl -d ./t.pl

 Loading DB routines from perl5db.pl version 1.49_04
 Editor support available.

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

 main​::(./t.pl​:6)​: my $x=DateTime->new( year => 2004 );
   DB<1> n
 main​::(./t.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
   DB<1> n
 Can't call method "can" on unblessed reference at (eval
 203)[/home/kes/perl5/perlbrew/perls/perl-
 5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line
 1.
  at (eval 203)[/home/kes/perl5/perlbrew/perls/perl-
 5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34, <DATA> line
 1.
     Eval​::Closure​::Sandbox_186​::__ANON__[(eval
 203)[/home/kes/perl5/perlbrew/perls/perl-
 5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149]​:34] called at (eval
 203)[/home/kes/perl5/perlbrew/perls/perl-
 5.24.0/lib/site_perl/5.24.0/Eval/Closure.pm​:149] line 34
     DateTime​::_check_set_formatter_params(DateTime​::Format​::Pg=HASH(0x3277670))
 called at /home/kes/perl5/perlbrew/perls/perl-
 5.24.0/lib/site_perl/5.24.0/x86_64-linux/DateTime.pm line 2076
     DateTime​::set_formatter(DateTime=HASH(0x33b5f78),
 DateTime​::Format​::Pg=HASH(0x3277670)) called at ./t.pl line 7
 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<1> n

I could not reproduce this problem using perl-5.26.0 on Ubuntu Linux 16.04 LTS.

I tried the program both as is, and -- for better readability -- with a "\n" after the final statement. Here's what I got​:

######
$ perl -d 132304-debugger.pl

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

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

main​::(132304-debugger.pl​:6)​: my $x=DateTime->new( year => 2004 );
  DB<1> n
main​::(132304-debugger.pl​:7)​: $x->set_formatter( DateTime​::Format​::Pg->new );
  DB<1>
main​::(132304-debugger.pl​:9)​: print $x->formatter, "\n";
  DB<1>
DateTime​::Format​::Pg=HASH(0x25af138)
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<1> q
#####

No problem there for me.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant