New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C<c ln> broken in blead's debugger #11779
Comments
From @craigberryIn 5.14.2: % cat foo.pl Loading DB routines from perl5db.pl version 1.33 Enter h or `h h' for help, or `man perldebug' for more help. main::(foo.pl:2): my $x = 'hello world'; Everything is peachy. But in blead it breezes past the breakpoint % ./perl -Ilib -d foo.pl Loading DB routines from perl5db.pl version 1.34 Enter h or 'h h' for help, or 'man perldebug' for more help. DB<1> c 3 And if I do a C<b 3> followed by C<c>, which should be equivalent to C<c 3>, the breakpoint apparently fires but does not display the source line without the addition of an explicit list command: % ./perl -Ilib -d foo.pl Loading DB routines from perl5db.pl version 1.34 Enter h or 'h h' for help, or 'man perldebug' for more help. DB<1> b 3 which turns out to be just a subset of the fact that no line display happens at all when stepping through the code in the debugger that currently ships with blead. And a manual bisect (because it was really easy to guess what broke it commit e09195a Add enable/disable commands for breakpoints in perl -d I think this needs to be reverted or fixed before 5.16. I've seen this on a couple of platforms, but the examples in this report are from: % ./perl -Ilib -V Characteristics of this binary (from libperl): ________________________________________ "... getting out of a sonnet is much more |
From @cpansproutOn Mon Nov 28 17:32:00 2011, craigberry wrote:
That latter bug has been fixed with commit bdba49a. ‘c 3’ is still -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @craigberryOn Dec 3, 2011, at 11:40 AM, Father Chrysostomos via RT wrote:
True, it now displays the first line of code. But after 'n' or 's' it still doesn't display the *second* or any subsequent lines of code.
Yes. ________________________________________ "... getting out of a sonnet is much more |
From @shlomifOn Sun Dec 04 06:26:09 2011, craigberry wrote:
It seems to be OK on bleadperl: [SHELL] Loading DB routines from perl5db.pl version 1.33 Enter h or `h h' for help, or `man perldebug' for more help. main::(foo.pl:2): my $x = 'hello world'; Maybe we should still add a test. Regards, -- Shlomi Fish |
From @craigberryOn Dec 06, 2011, at 12:46 PM, Shlomi Fish via RT <perlbug-followup@perl.org> wrote:
Note that the version of the debugger that's in blead is 1.34: <http://perl5.git.perl.org/perl.git/blob/HEAD:/lib/perl5db.pl#l522> Don't know how you got it, but the debugger you're running does not appear to be what is shipping with blead. And the version number of the debugger is not really getting properly maintained as there have been a number of changes since it was last bumped in May.
|
From @shlomifAttached is a patch to the "c ln" problem that was reported here. All |
From @shlomif0001-Made-c-line_num-working-again.patchFrom bf32ddea2b141fc03f42815d8c6076900a683ca9 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@iglu.org.il>
Date: Wed, 7 Dec 2011 19:36:39 +0200
Subject: [PATCH] Made "c [line_num]" working again.
This is a bug-fix to
https://rt.perl.org/rt3//Public/Bug/Display.html?id=104820 .
Both the fix and a regression tests were added.
---
lib/perl5db.pl | 31 +++++++++++++++++++++++++++++--
lib/perl5db.t | 24 +++++++++++++++++++++++-
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index d8b6894..45e7615 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -1956,7 +1956,10 @@ sub DB {
elsif ($stop) {
$evalarg = "\$DB::signal |= 1 if do {$stop}";
&eval;
- $dbline{$line} =~ s/;9($|\0)/$1/;
+ # If the breakpoint is temporary, then delete its enabled status.
+ if ($dbline{$line} =~ s/;9($|\0)/$1/) {
+ _cancel_breakpoint_temp_enabled_status($filename, $line);
+ }
}
} ## end if ($dbline{$line} && ...
@@ -2812,6 +2815,7 @@ in this and all call levels above this one.
# Yes. Set up the one-time-break sigil.
$dbline{$i} =~ s/($|\0)/;9$1/; # add one-time-only b.p.
+ _enable_breakpoint_temp_enabled_status($filename, $i);
} ## end if ($i)
# Turn off stack tracing from here up.
@@ -4002,10 +4006,33 @@ sub _set_breakpoint_enabled_status {
return;
}
+sub _enable_breakpoint_temp_enabled_status {
+ my ($filename, $line) = @_;
+
+ _get_breakpoint_data_ref($filename, $line)->{'temp_enabled'} = 1;
+
+ return;
+}
+
+sub _cancel_breakpoint_temp_enabled_status {
+ my ($filename, $line) = @_;
+
+ my $ref = _get_breakpoint_data_ref($filename, $line);
+
+ delete ($ref->{'temp_enabled'});
+
+ if (! %$ref) {
+ _delete_breakpoint_data_ref($filename, $line);
+ }
+
+ return;
+}
+
sub _is_breakpoint_enabled {
my ($filename, $line) = @_;
- return _get_breakpoint_data_ref($filename, $line)->{'enabled'};
+ my $data_ref = _get_breakpoint_data_ref($filename, $line);
+ return ($data_ref->{'enabled'} || $data_ref->{'temp_enabled'});
}
=head2 C<cmd_wrapper()> (API)
diff --git a/lib/perl5db.t b/lib/perl5db.t
index 0adae25..ba5d585 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(19);
+plan(20);
my $rc_filename = '.perldb';
@@ -434,6 +434,28 @@ EOF
"Restart and delete all breakpoints work properly.");
}
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'c 15',
+ q/print "X={$x}\n";/,
+ 'c',
+ 'q',
+ );
+
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/disable-breakpoints-1'); +
+ like($output, qr/
+ X=\{ThirdVal\}
+ /msx,
+ "'c line_num' is working properly.");
+}
+
END {
1 while unlink ($rc_filename, $out_fn);
}
--
1.7.8
|
From @tonycozOn Wed Dec 07 13:38:22 2011, shlomif wrote:
Thanks, applied. The n/s not showing the code line appears to have been fixed in Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
From @craigberryOn Fri, Dec 9, 2011 at 7:15 AM, Tony Cook via RT
It does seem to be a modest improvement. I do appreciate folks' I suggest leaving the ticket open as a So here's another, but in the same vein. We can now see the line % cat foo.pl % ./perl -Ilib -d foo.pl Loading DB routines from perl5db.pl version 1.35 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(foo.pl:2): my $x = 'hello world'; There should be a line that looks like: main::back(foo.pl:7): print "hello back\n"; and with 5.14.2 it's there: % perl -d foo.pl Loading DB routines from perl5db.pl version 1.33 Enter h or `h h' for help, or `man perldebug' for more help. main::(foo.pl:2): my $x = 'hello world'; |
@tonycoz - Status changed from 'resolved' to 'open' |
From @shlomifOn Fri Dec 09 17:19:44 2011, craig.a.berry@gmail.com wrote:
“The shoe-maker has no shoes”? Seriously now, I normally use the system Moreover, lately I did not find a lot of need to use the perl debugger,
Well, you've opened it by your reply. And I wouldn't go as far as saying
As much as I care about the changes that were incorporated into the
Thanks! I'll investigate and submit another patch. Regards, -- Shlomi Fish |
From @shlomifHere is a patch to the recent bug reported by Craig here. It can also be found here: https://github.com/shlomif/perl/tree/perl-d-add-tests-3 Regards, — Shlomi Fish |
From @shlomif0001-perl-d-display-lines-inside-subroutines.patchFrom 60115e18c528d4292689bb7fe78678c461d83758 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Sat, 10 Dec 2011 13:35:41 +0200
Subject: [PATCH] perl -d: display lines inside subroutines.
This is another fix to the perl debugger while making sure that lines
inside subroutines will be printed in the run-time display of the perl
debugger: https://rt.perl.org/rt3/Ticket/Display.html?id=104820 .
---
MANIFEST | 1 +
lib/perl5db.pl | 15 +++++++++++----
lib/perl5db.t | 27 ++++++++++++++++++++++++++-
lib/perl5db/t/with-subroutine | 17 +++++++++++++++++
4 files changed, 55 insertions(+), 5 deletions(-)
create mode 100644 lib/perl5db/t/with-subroutine
diff --git a/MANIFEST b/MANIFEST
index c6eb168..0cdb712 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4250,6 +4250,7 @@ lib/perl5db/t/rt-61222 Tests for the Perl debugger
lib/perl5db/t/rt-66110 Tests for the Perl debugger
lib/perl5db/t/symbol-table-bug Tests for the Perl debugger
lib/perl5db/t/taint Tests for the Perl debugger
+lib/perl5db/t/with-subroutine Tests for the Perl debugger
lib/PerlIO.pm PerlIO support module
lib/Pod/Functions.pm used by pod/splitpod
lib/Pod/t/eol.t end of line agnosticism
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index f62f2ab..e1c5f9b 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -2057,9 +2057,13 @@ won't cause trouble, and we say that the program is over.
=cut
+ # Make sure that we always print if asked for explicitly regardless
+ # of $trace_to_depth .
+ my $explicit_stop = ($single || $was_signal);
+
# Check to see if we should grab control ($single true,
# trace set appropriately, or we got a signal).
- if ( $single || ( $trace & 1 ) || $was_signal ) {
+ if ( $explicit_stop || ( $trace & 1 ) ) {
# Yes, grab control.
if ($slave_editor) {
@@ -2104,6 +2108,7 @@ number information, and print that.
else {
+
# Still somewhere in the midst of execution. Set up the
# debugger prompt.
$sub =~ s/\'/::/; # Swap Perl 4 package separators (') to
@@ -2131,7 +2136,7 @@ number information, and print that.
"$line:\t$dbline[$line]$after" );
}
else {
- depth_print_lineinfo($position);
+ depth_print_lineinfo($explicit_stop, $position);
}
# Scan forward, stopping at either the end or the next
@@ -2159,7 +2164,7 @@ number information, and print that.
"$i:\t$dbline[$i]$after" );
}
else {
- depth_print_lineinfo($incr_pos);
+ depth_print_lineinfo($explicit_stop, $incr_pos);
}
} ## end for ($i = $line + 1 ; $i...
} ## end else [ if ($slave_editor)
@@ -3906,7 +3911,9 @@ sub lsub : lvalue {
# Abstracting common code from multiple places elsewhere:
sub depth_print_lineinfo {
- print_lineinfo( @_ ) if $stack_depth < $trace_to_depth;
+ my $always_print = shift;
+
+ print_lineinfo( @_ ) if ($always_print or $stack_depth < $trace_to_depth);
}
=head1 EXTENDED COMMAND HANDLING AND THE COMMAND API
diff --git a/lib/perl5db.t b/lib/perl5db.t
index ba5d585..73a68b8 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(20);
+plan(21);
my $rc_filename = '.perldb';
@@ -456,6 +456,31 @@ EOF
"'c line_num' is working properly.");
}
+# Testing that the prompt with the information appears inside a subroutine call.
+# See https://rt.perl.org/rt3/Ticket/Display.html?id=104820
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'c back',
+ 'q',
+ );
+
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/with-subroutine');
+
+ like(_out_contents(),
+ qr/
+ ^main::back\([^\)\n]*\bwith-subroutine:15\):[\ \t]*\n
+ ^15:\s*print\ "hello\ back\\n";
+ /msx,
+ "Prompt should display the line of code inside a subroutine.");
+}
+
END {
1 while unlink ($rc_filename, $out_fn);
}
diff --git a/lib/perl5db/t/with-subroutine b/lib/perl5db/t/with-subroutine
new file mode 100644
index 0000000..b1d70fe
--- /dev/null
+++ b/lib/perl5db/t/with-subroutine
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $x = 'hello world';
+
+print "$x\n";
+
+back();
+
+exit;
+
+sub back {
+ print "hello back\n";
+}
+
--
1.7.8
|
From @tonycozAnother one: 5.14.1: DB<1> b . $_ > 3 blead: DB<1> b . $_ > 3 Found by inspection, see the first hunk of: http://perl5.git.perl.org/perl.git/blobdiff/2211a10b..076b743:/lib/perl5db.pl but I don't see why that change was made. Tony |
From vadim.konovalov@alcatel-lucent.com
after you've pointed to it, indeed, this change looks like accidental change # Make . the current line number if it's there..
I, for one, use Tk-enabled debugger which appears to be highly convenient Regards, |
From @shlomifOn Mon Dec 12 03:34:31 2011, tonyc wrote:
http://perl5.git.perl.org/perl.git/blobdiff/2211a10b..076b743:/lib/perl5db.pl
You can find the fix to this here: https://github.com/shlomif/perl/tree/perl-d-bug-fixes-2 Apparently, I've mistaken \b for something it wasn't in order to make Regards, -- Shlomi Fish |
From @shlomifHi all, the remaining patch is attached to this message. Please apply it. Regards, -- Shlomi Fish |
From @shlomif0001-perl-d-fixes-b-.-COND.patchFrom 2facfd857cd702d92cf6b625c96a27e5b84d171e Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Mon, 12 Dec 2011 16:51:00 +0200
Subject: [PATCH] perl -d: fixes "b . COND()".
break-dot for filename was broken due to previous commits. It was fixed
now. Also documented it in pod/perldebug.pod, because it was
undocumented.
---
MANIFEST | 1 +
lib/perl5db.pl | 2 +-
lib/perl5db.t | 26 +++++++++++++++++++++++++-
lib/perl5db/t/break-on-dot | 10 ++++++++++
pod/perldebug.pod | 4 ++++
5 files changed, 41 insertions(+), 2 deletions(-)
create mode 100644 lib/perl5db/t/break-on-dot
diff --git a/MANIFEST b/MANIFEST
index c6eb168..b5a0d7b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4235,6 +4235,7 @@ lib/overload.pm Module for overloading perl operators
lib/overload.t See if operator overloading works
lib/perl5db.pl Perl debugging routines
lib/perl5db.t Tests for the Perl debugger
+lib/perl5db/t/break-on-dot Test script used by perl5db.t
lib/perl5db/t/breakpoint-bug Test script used by perl5db.t
lib/perl5db/t/disable-breakpoints-1 Test script used by perl5db.t
lib/perl5db/t/disable-breakpoints-2 Test script used by perl5db.t
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index f62f2ab..4c26e4b 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -4207,7 +4207,7 @@ sub cmd_b {
my $dbline = shift;
# Make . the current line number if it's there..
- $line =~ s/^\.\b/$dbline/;
+ $line =~ s/^\.(\s|\z)/$dbline$1/;
# No line number, no condition. Simple break on current line.
if ( $line =~ /^\s*$/ ) {
diff --git a/lib/perl5db.t b/lib/perl5db.t
index ba5d585..c583a85 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(20);
+plan(21);
my $rc_filename = '.perldb';
@@ -456,6 +456,30 @@ EOF
"'c line_num' is working properly.");
}
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'n',
+ 'n',
+ 'b . $exp > 200',
+ 'c',
+ q/print "Exp={$exp}\n";/,
+ 'q',
+ );
+
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/break-on-dot'); +
+ like($output, qr/
+ Exp=\{256\}
+ /msx,
+ "'b .' is working correctly.");
+}
+
END {
1 while unlink ($rc_filename, $out_fn);
}
diff --git a/lib/perl5db/t/break-on-dot b/lib/perl5db/t/break-on-dot
new file mode 100644
index 0000000..a9ee1a3
--- /dev/null
+++ b/lib/perl5db/t/break-on-dot
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $exp = 1;
+for my $i (1 .. 20)
+{
+ $exp *= 2;
+}
diff --git a/pod/perldebug.pod b/pod/perldebug.pod
index fcdb29c..4a2f07e 100644
--- a/pod/perldebug.pod
+++ b/pod/perldebug.pod
@@ -304,6 +304,10 @@ don't use C<if>:
b 237 ++$count237 < 11
b 33 /pattern/i
+If the line number is C<.>, sets a breakpoint on the current line:
+
+ b . $n > 100
+
=item b [file]:[line] [condition]
X<breakpoint>
X<debugger command, b>
--
1.7.8
|
From @rjbsthat last patch has been applied as 5343a61 Please note that it altered perl5db.pl without upping the version number, which caused Please always run "make test_porting" before sending in patches. (It is possible that due to |
From [Unknown Contact. See original ticket]that last patch has been applied as 5343a61 Please note that it altered perl5db.pl without upping the version number, which caused Please always run "make test_porting" before sending in patches. (It is possible that due to |
@rjbs - Status changed from 'open' to 'resolved' |
From @richardfoleyYou're not the only one using the debugger. There are many, but it's like -- Richard Foley http://www.rfi.net/books.html
|
Migrated from rt.perl.org#104820 (status was 'resolved')
Searchable as RT104820$
The text was updated successfully, but these errors were encountered: