Skip Menu |
Report information
Id: 131674
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: kes-kes [at] yandex.ru
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.24.1
Fixed In: (no value)



To: perlbug <perlbug [...] perl.org>
Subject: Feature request: implement $DB::method variable
Date: Thu, 29 Jun 2017 02:16:53 +0300
From: KES <kes-kes [...] yandex.ru>
Download (untitled) / with headers
text/plain 4.9k
Reply-To: kes-kes@yandex.ru Message-Id: <5.24.1_19046_1498690094@kes-X751SA> Subject: Feature request: implement $DB::method variable Cc: kes-kes@yandex.ru To: perlbug@perl.org From: 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.1. ----------------------------------------------------------------- [Please describe your issue here] When I want to debug return values from some subroutine I analize $DB::sub variable at DB::sub. But faced into the problem when the method call is done. [perldebguts](https://perldoc.perl.org/perldebguts.html) states: Show quoted text
>When execution of the program reaches **a subroutine call**,
a call to &DB::sub (args) is made instead, with $DB::sub holding the name of the called subroutine But when execution of the next program reaches 11 line: $cat $test.pl package Test1; sub t1 {}; package Test2; push @ISA, 'Test1'; package main; Test2->t1; # <<<<<<< 11 line The $DB::sub contain `Test1::t1` instead of expected `Test2::t2` when `Test2` do not implement `t1` method And $DB::sub contain `Test2::t1` when `Test2` implement `t1` method This stops me to setup breakpoint without knowing the hierarchy of debugging object. (Complexity raises with multiple inheritance) I understand that DOC describes **a subroutine call** but lack of `$DB::method` cause the inconvenience. Please provide $DB::method variable with value of called method [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.24.1: Configured by kes at Sun Apr 30 22:40:30 EEST 2017. Summary of my perl5 (revision 5 version 24 subversion 1) configuration: Platform: osname=linux, osvers=4.4.0-53-generic, archname=x86_64-linux uname='linux kes-x751sa 4.4.0-53-generic #74-ubuntu smp fri dec 2 15:59:10 utc 2016 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 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:/home/kes/bin:/home/kes/.local/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.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_VERSION=0.78 PERL_BADLANG (unset) SHELL=/bin/bash
Download bugreport.tar
application/x-tar 10k

Message body not shown because it is not plain text.

Date: Thu, 29 Jun 2017 09:01:34 +0100
From: Zefram <zefram [...] fysh.org>
Subject: Re: [perl #131674] Feature request: implement $DB::method variable
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
KES wrote: Show quoted text
>When I want to debug return values from some subroutine I analize $DB::sub >variable at DB::sub. But faced into the problem when the method call is done.
This mechanism behaves precisely as I would expect: Test1::t1 is in fact the subroutine being called, and $DB::sub identifies it correctly. If $DB::sub were to say "Test2::t1" instead, that would break debugging, because there is no subroutine by that name. Show quoted text
>Please provide $DB::method variable with value of called method
At the point the call is made and invokes debugger hooks, there is no distinction between a method call and a direct subroutine call. If you really want to intercept method calls, you'll need to catch the op that performs the method lookup. I'm not going to advise you how to do that: you'd only get further out of your depth. Show quoted text
>This stops me to setup breakpoint without knowing the hierarchy of >debugging object. (Complexity raises with multiple inheritance)
I think that by "debugging object" you mean "the invocant". The ->can method would seem to address this issue. Please learn Perl before you report any more supposed bugs. Writing a debugger is not the way to learn Perl: it is an especially tricky task that only expert Perl programmers should undertake. -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org