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 prints '1' when an reference or object is thrown #16217
Comments
From jkahrman@mathworks.comThis is a bug report for perl from jkahrman@mathworks.com, If an exception object is thrown while stepping through the debugger, the The same behavior can be demonstrated more simply with unblessed references: % perl -e 'die({});' || echo % perl -de 'die({});' || echo Loading DB routines from perl5db.pl version 1.44 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): die({}); This behavior is because perl5db.pl is calling Carp::longmess in scalar context I've attached a patch (debug_exception_1.patch) that calls Carp::longmess in Flags: Site configuration information for perl 5.20.2: Configured by Debian Project at Mon Jan 11 23:24:04 UTC 2016. Summary of my perl5 (revision 5 version 20 subversion 2) configuration: Locally applied patches: @INC for perl 5.20.2: Environment for perl 5.20.2: |
From jkahrman@mathworks.comexception_bug% perl -MError -e 'Error::Simple->new('Hello')->throw;'
Hello at -e line 1.
% perl -MError -de 'Error::Simple->new('Hello')->throw;'
Loading DB routines from perl5db.pl version 1.44
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(-e:1): Error::Simple->new(Hello)->throw;
DB<1> c
1 at /usr/share/perl/5.20/perl5db.pl line 8616.
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<1> q
|
From jkahrman@mathworks.comdebug_exception_1.patch--- perl5.20.2/lib/perl5db.pl 2017-02-06 20:00:13.000000000 -0500
+++ perl5.20.2_db_patch/lib/perl5db.pl 2017-02-06 20:00:13.000000000 -0500
@@ -8553,7 +8553,7 @@
# We can call Carp::longmess without its being "debugged" (which we
# don't want - we just want to use it!). Capture this for later.
- my $mess = Carp::longmess(@_);
+ my ($mess) = Carp::longmess(@_);
# Restore $single and $trace to their original values.
( $single, $trace ) = ( $mysingle, $mytrace );
@@ -8610,7 +8610,7 @@
{
package Carp; # Do not include us in the list
- eval { $mess = Carp::longmess(@_); };
+ eval { ($mess) = Carp::longmess(@_); };
}
( $single, $trace ) = ( $mysingle, $mytrace );
die $mess;
--- perl5.20.2/lib/perl5db.t 2017-02-06 20:00:13.000000000 -0500
+++ perl5.20.2_db_patch/lib/perl5db.t 2017-02-06 20:00:13.000000000 -0500
@@ -29,7 +29,7 @@
$ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
}
-plan(125);
+plan(126);
my $rc_filename = '.perldb';
@@ -2357,6 +2357,24 @@
);
}
+# Test message from exception caught by debugger
+{
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ 'c',
+ 'q',
+ ],
+ prog => '../lib/perl5db/t/ref_warn_die',
+ }
+ );
+
+ $wrapper->output_like(qr{^\QHASH(0x\E\w+\)},
+ 'Test message from exception caught by debugger',
+ );
+}
+
# Test the dieLevel option
{
my $wrapper = DebugWrap->new(
--- perl5.20.2/lib/perl5db/t/ref_warn_die 1969-12-31 19:00:00.000000000 -0500
+++ perl5.20.2_db_patch/lib/perl5db/t/ref_warn_die 2017-10-31 16:40:43.938018834 -0400
@@ -0,0 +1,5 @@
+#!*perl*
+
+warn([]);
+
+die({});
|
From @jkeenanOn Wed, 01 Nov 2017 01:03:53 GMT, jkahrman@mathworks.com wrote:
I can reproduce this behavior in perl-5.20 and -5.22 -- but it appears to have been fixed in -5.24. 5.20 Loading DB routines from perl5db.pl version 1.44_01 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): die({}); 5.22 Loading DB routines from perl5db.pl version 1.49_001 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): die({}); 5.24 Loading DB routines from perl5db.pl version 1.49_05 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): die({});
Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @SmylersJames E Keenan via RT writes:
Fixed by 6ca94a7, which changes Carp (specifically changing what That became Carp 1.39. The most recent standalone Carp on Cpan is 1.38. Smylers |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#132383 (status was 'resolved')
Searchable as RT132383$
The text was updated successfully, but these errors were encountered: