Skip to content
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

[PATCH] Debugger treatment of condition "0" #2327

Closed
p5pRT opened this issue Aug 7, 2000 · 4 comments
Closed

[PATCH] Debugger treatment of condition "0" #2327

p5pRT opened this issue Aug 7, 2000 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 7, 2000

Migrated from rt.perl.org#3651 (status was 'resolved')

Searchable as RT3651$

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2000

From mjtg@cam.ac.uk

In the debugger, a breakpoint condition of '0' is treated as always
true, not always false.

Patch is for bleadperl.

Mike Guy

Inline Patch
--- ./lib/perl5db.pl.orig	Tue Aug  1 03:31:51 2000
+++ ./lib/perl5db.pl	Sun Aug  6 13:23:41 2000
@@ -899,9 +899,9 @@
 			print $OUT "Will stop on load of `@{[join '\', `', sort keys %break_on_load]}'.\n";
 			next CMD; };
 		    $cmd =~ /^b\b\s*(postpone|compile)\b\s*([':A-Za-z_][':\w]*)\s*(.*)/ && do {
-			my $cond = $3 || '1';
+			my $cond = length $3 ? $3 : '1';
 			my ($subname, $break) = ($2, $1 eq 'postpone');
-			$subname =~ s/\'/::/;
+			$subname =~ s/\'/::/g;
 			$subname = "${'package'}::" . $subname
 			  unless $subname =~ /::/;
 			$subname = "main".$subname if substr($subname,0,2) eq "::";
@@ -910,8 +910,8 @@
 			next CMD; };
 		    $cmd =~ /^b\b\s*([':A-Za-z_][':\w]*(?:\[.*\])?)\s*(.*)/ && do {
 			$subname = $1;
-			$cond = $2 || '1';
-			$subname =~ s/\'/::/;
+			$cond = length $2 ? $2 : '1';
+			$subname =~ s/\'/::/g;
 			$subname = "${'package'}::" . $subname
 			  unless $subname =~ /::/;
 			$subname = "main".$subname if substr($subname,0,2) eq "::";
@@ -931,7 +931,7 @@
 			next CMD; };
 		    $cmd =~ /^b\b\s*(\d*)\s*(.*)/ && do {
 			$i = $1 || $line;
-			$cond = $2 || '1';
+			$cond = defined $2 ? $2 : '1';
 			if ($dbline[$i] == 0) {
 			    print $OUT "Line $i not breakable.\n";
 			} else {

End of patch

@p5pRT
Copy link
Author

p5pRT commented Aug 8, 2000

From @jhi

On Mon, Aug 07, 2000 at 09​:49​:58PM +0100, Mike Guy wrote​:

In the debugger, a breakpoint condition of '0' is treated as always
true, not always false.

Patch is for bleadperl.

Applied, thanks.

@p5pRT
Copy link
Author

p5pRT commented Aug 14, 2000

From [Unknown Contact. See original ticket]

I wrote

In the debugger, a breakpoint condition of '0' is treated as always
true, not always false.

Patch is for bleadperl.

Ooops. That patch has a thinko which breaks unconditional breakpoints.
Please apply the attached correction.

Mike Guy

Inline Patch
--- ./lib/perl5db.pl.orig	Fri Aug 11 02:29:48 2000
+++ ./lib/perl5db.pl	Mon Aug 14 08:20:23 2000
@@ -931,7 +931,7 @@
 			next CMD; };
 		    $cmd =~ /^b\b\s*(\d*)\s*(.*)/ && do {
 			$i = $1 || $line;
-			$cond = defined $2 ? $2 : '1';
+			$cond = length $2 ? $2 : '1';
 			if ($dbline[$i] == 0) {
 			    print $OUT "Line $i not breakable.\n";
 			} else {

End of patch

@p5pRT
Copy link
Author

p5pRT commented Aug 14, 2000

From @jhi

On Mon, Aug 14, 2000 at 08​:26​:02AM +0100, Mike Guy wrote​:

I wrote

In the debugger, a breakpoint condition of '0' is treated as always
true, not always false.

Patch is for bleadperl.

Ooops. That patch has a thinko which breaks unconditional breakpoints.
Please apply the attached correction.

Dethinko applied, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant