develooper Front page | perl.perl5.porters | Postings from June 2011

Re: [PATCH] Add "b <filename>:<line> <cond>" to perl -d

Thread Previous | Thread Next
From:
Shlomi Fish
Date:
June 14, 2011 08:35
Subject:
Re: [PATCH] Add "b <filename>:<line> <cond>" to perl -d
Message ID:
9627134.qbHr7AVNLm@telaviv1.shlomifish.org
Hi Father Chrysostomos (and all),

On Sunday 12 Jun 2011 13:58:43 Father Chrysostomos wrote:
> Shlomi Fish wrote:
> > Hi all!
> > 
> > This link - http://xrl.us/bjrpd2 is a github branch that contains a set
> > of some commits to add this to perl -d :
> > 
> > <POD>
> > 
> > =item b [file]:[line] [condition]
> > X<breakpoint>
> > X<debugger command, b>
> > 
> > Set a breakpoint before the given line in a (possibly different) file. 
> > If a condition is specified, it's evaluated each time the statement is
> > reached: a breakpoint is taken only if the condition is true. 
> > Breakpoints may only be set
> > 
> > on lines that begin an executable statement.  Conditions don't use C<if>:
> >     b lib/MyModule.pm:237 $x > 30
> >     b /usr/lib/perl5/site_perl/CGI.pm:100 ++$count100 < 11
> > 
> > </POD>
> > 
> > I promised this earlier and I did not completely forget about it.
> > 
> > I don't expect it to get in before perl-5.14.0 is, but it's there if
> > anyone is interested. Some of the "make test" fail but it seems to be a
> > problem with t/porting/cmp_version.t .
> 
> When I first tried applying this some time ago, all tests passed. Just now
> when I tried merging it with blead, I got this failure:
> 
> $ cd t
> $ ./perl TEST ../lib/perl5db.t
> t/../lib/perl5db....# Failed at ../lib/perl5db.t line 199
> #      got 'In MyModule.
> # In Main File.
> # Var=
> # '
> # expected /(?^msx:
> #         ^Var=Bar$
> #             .*
> #         ^In\ MyModule\.$
> #             .*
> #         ^In\ Main\ File\.$
> #             .*
> #         )/
> FAILED at test 10
> Failed 1 test out of 1, 0.00% okay.
> 	../lib/perl5db.t
> 
> Is there any chance you could look into that? Just it case it was a mistake
> in the way I applied it, attached is what I applied.
> 

after some investigation, I realised the problem was that perl -d's 
"breakpoint" functionality is completely broken on blead:

<SHELL>

shlomif@lap:~/Download/unpack/perl/p5/git/perl$ cat test.pl
#!/usr/bin/perl

use strict;
use warnings;

print "Foo\n";

for my $x (1 .. 10)
{
    print "Step $x\n";
}
shlomif@lap:~/Download/unpack/perl/p5/git/perl$ ./perl -d test.pl 

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

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

main::(test.pl:6):      print "Foo\n";
  DB<2270> l
6==>    print "Foo\n";
7 

8:      for my $x (1 .. 10)
9       {
10:         print "Step $x\n";
11      }
  DB<2270> b 10
  DB<2271> L
test.pl:
 10:        print "Step $x\n";
   break if (1)
  DB<2271> c
Foo
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9
Step 10
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<2271> q
shlomif@lap:~/Download/unpack/perl/p5/git/perl$ 

</SHELL>

This needs to be fixed with a few tests before applying my patch.

> (BTW, I find it a lot easier to apply things if they are sent as attachments
> to perlbug@perl.org.)

OK, I'll keep it in mind.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does "Zionism" mean? - http://shlom.in/def-zionism

Lone Starr: "Just what we need - a Druish princess."
Barf: "Funny! She doesn't look Druish."
    -- Spaceballs, http://www.imdb.com/title/tt0094012/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Thread Previous | 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