develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #1726] Debugger: Break gets set on wrong subroutine

Thread Previous
From:
Rocky Bernstein
Date:
September 8, 2013 01:45
Subject:
Re: [perl #1726] Debugger: Break gets set on wrong subroutine
Message ID:
CANCp2gbjutCo=QUp=K7T2y+cgqB33MFAEgaZ+idU7UMbss8Exw@mail.gmail.com
You are correct. And I think you are correct that the best fix is to invoke
the debugger via DB::sub(), rather than all that hoaky code in
find_subline. But doing this probably will requires some extra care. I've
created Issue #24 https://github.com/rocky/Perl-Devel-Trepan/issues/24 so I
don't forget about this.

(Sorry for the delayed reply.)


On Mon, Aug 26, 2013 at 12:01 PM, Father Chrysostomos via RT <
perlbug-followup@perl.org> wrote:

> On Mon Aug 26 08:13:35 2013, bowtie wrote:
> >
> > imho this is DWIM Perl issue
> >
> > the following shows a hacked test file with debugger symbols after a
> > breakpoint has been set against the sub problem ( b main::problem )
> >
> > if you do just a ( c ) all works as expected, so dose ( c problem )
> >
> >
> > /home/kevin/workspace/p5p/script/db-002.pl
> >   1           #!perl
> >   2
> >   3:          use strict;
> >   4:          use warnings;
> >   5
> >   6           sub problem {
> >   7:b                 $SIG{__DIE__} = sub { die "<b problem> will set a
> break point
> > here.\n" };
> >   8:                  warn "This line will run even if you enter <c
> problem>.\n";
> >   9           }
> >  10
> >  11 ==>       problem();
> >  12
> >  13:          exit(0);
> >
> > nb : shows traceable lines
> >
> > suggest we close this ticket as it is not an issue
> >
> > ps try the above and original with trepan.pl, is't even more
> illuminating
>
> You put the anonymous sub on a single line.  The original report had it
> on three lines.  This is still a bug.  This script prints out the
> numeric and string values of each element of @dbline, showing what is
> happening:
>
> #!perl -d:Peek
>
> sub DB::DB {}
>
> sub problem {
>     $SIG{__DIE__} = sub {
>         die "foo"
>     };
>     warn "bar";
> }
>
> for (@{"_<".__FILE__}) {
>     printf "%20u    %s", 0+$_, $_;
>     print "\n" unless /\n\z/;
> }
>
> The result:
>
>                    0
>                    0    use Devel::Peek
> ;
>                    0
>                    0
>      140432449279712    sub DB::DB {}
>                    0
>                    0    sub problem {
>                    0        $SIG{__DIE__} = sub {
>      140432449370824            die "foo"
>      140432453462216        };
>      140432453461816        warn "bar";
>                    0    }
>                    0
>      140432453720360    for (@{"_<".__FILE__}) {
>      140432453634168        printf "%20u    %s", 0+$_, $_;
>      140432453721232        print "\n" unless /\n\z/;
>                    0    }
>
> Notice how the %SIG assignment is breakable on the last line ‘};’.
> That’s because the line number for that statement is the end of the
> statement, not the beginning.
>
> The debugger scans through the line range for the problem sub.  The
> first breakable line is in the anonymous sub.
>
> Whether this can be fixed in perl I don’t know.  I think the debugger
> can work around it by breaking itself in DB::sub instead of depending on
> pp_dbstate to do it.
>
> --
>
> Father Chrysostomos
>
>
> ---
> via perlbug:  queue: perl5 status: open
> https://rt.perl.org:443/rt3/Ticket/Display.html?id=1726
>

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About