Perl / perl5

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

Perl debugger does not stop at breakpoint #17644

Open KES777 opened 4 years ago

KES777 commented 4 years ago
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.1.

-----------------------------------------------------------------
[Please describe your issue here]

Hi.  Here  I  put breakpoint and expect that debugger will stop script
execution. But it is stopped at some different not expected place:

    69:
   x70: $DB::single = 1   if $table->search( $cond )->count > 1;
    71:
  1>72:     1;
   x73:     1;
    74:
    75:     ## If requested   then update found row by provided $data
   x76:     if( $update ) { $row->update( $data ); }
    77:
    78:
   x79:     return $row;
    80: }
    81:
    82:

    30: # FIXME - this is not really necessary, and is in
    31: # fact going to slow things down a bit
    32: # However it is the right thing to do in order to get
    33: # various install bases to highlight their brokenness
    34: # Remove at some unknown point in the future
  >>35: sub DESTROY { &DBIx::Class::_Util::detected_reinvoked_destructor }
    36:
    37: sub mk_classdata {
   x38:   shift->mk_classaccessor(@_);
    39: }

As    you    can    see    we    are    stopped    at   line   35   of
/home/nazar/work/projects/tucha/monkeyman/app/maitre_d/../..//local/lib/perl5/DBIx/Class.pm
file.  If  we analyze caller's stack frames we will found that DESTROY
is          called          from          line          72          of
/home/nazar/work/projects/tucha/monkeyman/app/maitre_d/../..//lib/S.pm
file.

As you can see the line 72 is just `1;` expression.

If I rewrite my breakpoint condition as:

    68:     };
    69:
   x70:     if( $table->search( $cond )->count > 1 ) {
  >>71:       $DB::single =  1; 1;
    72:     }
    73:
    74:     ## If requested   then update found row by provided $data
   x75:     if( $update ) { $row->update( $data ) }
    76:
    77:
   x78:     return $row;
    79: }

    Then script execution is stopped at expected place.

In  the  past  I  already reported that debugger does not stop on `if`
statements,  but  it  seems  that debugger does not stop and on return
statements.

Expected: at first example, script execution should be stopped on line 72

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.24.1:

Configured by kes at Mon May  7 20:59:03 EEST 2018.

Summary of my perl5 (revision 5 version 24 subversion 1) configuration:

  Platform:
    osname=linux, osvers=4.13.0-26-generic, archname=x86_64-linux
    uname='linux work 4.13.0-26-generic #29~16.04.2-ubuntu smp tue jan 9 22:00:44 utc 2018 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-5.24.1 -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-5.24.1/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.1:
    /home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1
    /home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/5.24.1

---
Environment for perl 5.24.1:
    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.1/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_HOME=/home/kes/.perlbrew
    PERLBREW_MANPATH=/home/kes/perl5/perlbrew/perls/perl-5.24.1/man
    PERLBREW_PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.24.1/bin
    PERLBREW_PERL=perl-5.24.1
    PERLBREW_ROOT=/home/kes/perl5/perlbrew
    PERLBREW_SHELLRC_VERSION=0.86
    PERLBREW_VERSION=0.86
    PERL_BADLANG (unset)
    SHELL=/bin/bash
tonycoz commented 4 years ago

Do you have a complete self-contained test program that demonstrates the problem? I wasn't able to produce a simple reproducer based on what you've supplied.