develooper Front page | perl.perl5.porters | Postings from March 2012

[perl #71678] Bug [5.11.3] debugger bug in evaluation of user actions ('a' command)

Thread Next
From:
James E Keenan via RT
Date:
March 27, 2012 18:24
Subject:
[perl #71678] Bug [5.11.3] debugger bug in evaluation of user actions ('a' command)
Message ID:
rt-3.6.HEAD-4610-1332897867-555.71678-15-0@perl.org
On Tue Sep 28 01:07:49 2010, hexcoder wrote:
> Greetings,
> 
> 
> But it should be evaluated _once_ instead of thrice in your  test script
> because control reaches line 11 only once.
> The definition of the 'a' command is according to the debugger book
> 'Pro Perl Debugging' from Richard Foley and Andy Lester
> like this (on page 241):
> "Create an action to run the supplied perl expression each time the code
> on the given line number is about to be executed."
> 
> So the evaluation needs to take the line number into account, which it 
> currently does not.
> Once the action is activated, it is performed on each line upto the end 
> of the scope (at least).
> 
> Note: this is not related to perlbug #71806 'perldb does not setup 
> %dbline with shebang option -d',
> because the behaviour is present also without shebang option -d.
> > I don’ think it has to do with the end of the program. This script
> > displays the message three times. I’ve never used the debugger before,
> > so I don’t know whether this is correct. But it seems to me that $action
> > needs to be cleared elsewhere in the debugger.
> >
> > BEGIN {
> > 	push @DB::typeahead, 'a 11 print "thrext\n"', 'c 8', ('s')x3, 'q';
> > 	$DB::single = 0;
> > }
> > use strict; use warnings;
> >
> > greet('Hello');
> >
> > sub greet
> > {
> > 	my $arg = shift;
> > 	print "$arg\n";
> > 	return;
> > }
> > __END__
> >
> >
> >
> >   
> 
> I propose this example (see attachment), which uses a lexical variable 
> from the inner scope:
> ==== quote ========
> BEGIN {
>     push @DB::typeahead, 'a 12 print "${arg}__${arg}\n"', ('s')x4, 'q';
>     $DB::single = 0;
> }
> use strict; use warnings;
> 
> greet('Hello');   # first stop in debugger
> 
> sub greet
> {
>     my $arg = shift;
>     $arg = ''; # line 12
>     return;
> }
> ===== end quote =======
> 
> Thanks, hexcoder
> 

Discussion of this issue petered out about a year-and-a-half ago.  Is
there anyone familiar with debugger issues who could review this RT?

Thank you very much.
Jim Keenan


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=71678

Thread Next


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