[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debugging Perl with Emacs / perldb

From: William L Brown
Subject: Debugging Perl with Emacs / perldb
Date: Sun, 01 Aug 2010 09:34:27 -0400

Hi Folks,
    With "perl -d" on the command line, the standard perl debugger, I
see the code inside of a perl eval as I execute it.  Eval'ed code is
code that is created from scratch, outside of a code file and which then
becomes part of your program.  Inside if emacs, depending upon my
environment, I either see:

  Nothing but an indicator of what line I am running with no view of the
    (eval 6)[/home/bbrown/newTmp/emacsDebugTests/]:7:0

  or a new buffer pops up in emacs, with name (eval x), with absolutely
no text inside of it.

    How do I fix this issue?  Who can I ask?  The issue seems to fit
snuggly between Emacs experts and Perl experts.

    Thanks very much for your time.


ps.  I included some sample code just to show you how I typically
     use eval.  A transcript of my "perl -d" session, where I see at 
     least one line of the eval at a time, follows.

my $code = "
my (\$foo, \$bar) = \@_;
print \$foo;
print \$bar;
return \$bar;
my $subroutine = "sub { $code }";
my $proc = eval $subroutine;
my $baz = "1\n";    
my $bat = "2\n";
my $output = eval {no strict "refs"; $proc->($baz, $bat); };
print $output;

bbrown@parvathi:~/newTmp/emacsDebugTests$ perl -d

Loading DB routines from version 1.32
Editor support available.

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

main::(       my $code = "
main::(       my (\$foo, \$bar) = \@_;
main::(       print \$foo;
main::(       print \$bar;
main::(       return \$bar;
main::(       ";
  DB<1> n
main::(       my $subroutine = "sub { $code }";
  DB<1> n
main::(       my $proc = eval $subroutine;
  DB<1> n
main::((eval 6)[]:7):   ;
  DB<1> n
main::(       my $baz = "1\n";    
  DB<1> n
main::(      my $bat = "2\n";
  DB<1> n
main::(      my $output = eval {no strict "refs";
$bat); };
  DB<1> s
main::(      my $output = eval {no strict "refs";
$bat); };
  DB<1> s
main::CODE(0x8626a50)((eval 6)[]:2):
2:      my ($foo, $bar) = @_;               <- I can see the source!!!
  DB<1> n
main::CODE(0x8626a50)((eval 6)[]:3):
3:      print $foo;
  DB<1> n
main::CODE(0x8626a50)((eval 6)[]:4):
4:      print $bar;
  DB<1> n
main::CODE(0x8626a50)((eval 6)[]:5):
5:      return $bar;
  DB<1> n
main::(      print $output;
  DB<1> n
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.  


William L. Brown
603-465-2114     [Office]
617-803-9156     [Cell]
603-574-4922     [Skype Phone]
508-322-1146     [Google Voice (experimental)]
williambrown0000 [Skype/AIM/Yahoo IM]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]