develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #118185] perl debugger doesn't evaluate user input when it should

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
May 26, 2013 19:29
Subject:
[perl #118185] perl debugger doesn't evaluate user input when it should
Message ID:
rt-3.6.HEAD-2650-1369596570-1385.118185-15-0@perl.org
On Sun May 26 12:00:31 2013, LAWalsh wrote:
> 
> This is a bug report for perl from perl-diddler@tlinx.org,
> generated with the help of perlbug 1.39 running under perl 5.16.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> I was trying to call a function in my program in the debugger.
> 
> I note that it is documented to evaluate user functions in user space
> if they do not conflict with commands.
> 
> I tried to call 'P' to print out the value of a hash.
> 
> (Might not be a bad addition to the debugger).
> 

It already exists: 'p' -- not 'P'.

> Instead of executing my sub, P, I get
> 
> Undefined subroutine &DB::cmd_P called at
>    /usr/lib/perl5/5.16.2/perl5db.pl line 3819.
>         DB::cmd_wrapper(undef, undef, 4) called at
>    /usr/lib/perl5/5.16.2/perl5db.pl line 2366
>         DB::DB called at /home/law/bin/shaper.pl line 4
> 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.
> 
> 
> --- not only does it not call the user's routine, but it kills
> the debugger.
> 

Works as planned. 'P' is not, AFAIK, a valid command in the debugger.

You didn't supply the program you were trying to debug, so I tried this:

#####
$ cat 118185_debug.pl 
use strict;
use warnings;

my %hash = ( qw| alpha beta gamma delta | );

P();

sub P { print "Hello world\n" };
#####
$ perl -d 118185_debug.pl 

Loading DB routines from perl5db.pl version 1.39_09
Editor support available.

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

main::(118185_debug.pl:4):      my %hash = ( qw| alpha beta gamma delta | );
  DB<1> n
main::(118185_debug.pl:6):      P();
  DB<1> p %hash
gammadeltaalphabeta
  DB<2> n
Hello world
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<2> q
[p5p] 512 $ perl -d 118185_debug.pl 

Loading DB routines from perl5db.pl version 1.39_09
Editor support available.

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

main::(118185_debug.pl:4):      my %hash = ( qw| alpha beta gamma delta | );
  DB<1> n
main::(118185_debug.pl:6):      P();
  DB<1> p %hash
alphabetagammadelta
  DB<2> P %hash
Can't use an undefined value as a subroutine reference at
/usr/local/lib/perl5/5.18.0/perl5db.pl line 4442.
 at /usr/local/lib/perl5/5.18.0/perl5db.pl line 4442.
        DB::cmd_wrapper('P', '%hash', 6) called at
/usr/local/lib/perl5/5.18.0/perl5db.pl line 3949
        DB::Obj::_handle_cmd_wrapper_commands('DB::Obj=HASH(0x1a51860)')
called at /usr/local/lib/perl5/5.18.0/perl5db.pl line 2836
        DB::DB called at 118185_debug.pl line 6
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<3> q
#####

There is no bug in Perl here.

Thank you very much.
Jim Keenan

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

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