all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Debugging Perl with Emacs / perldb
@ 2010-08-01 13:34 William L Brown
  2010-08-02 14:31 ` Gary
       [not found] ` <mailman.8.1280759507.17287.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: William L Brown @ 2010-08-01 13:34 UTC (permalink / raw)
  To: help-gnu-emacs

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
line:
    (eval 6)[/home/bbrown/newTmp/emacsDebugTests/foo.pl:8]: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.

             Bill

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 foo.pl

Loading DB routines from perl5db.pl version 1.32
Editor support available.

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

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

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging Perl with Emacs / perldb
  2010-08-01 13:34 Debugging Perl with Emacs / perldb William L Brown
@ 2010-08-02 14:31 ` Gary
       [not found] ` <mailman.8.1280759507.17287.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Gary @ 2010-08-02 14:31 UTC (permalink / raw)
  To: help-gnu-emacs

William L Brown wrote:
> 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.

Have you tried http://www.khngai.com/emacs/perl.php for example?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging Perl with Emacs / perldb
       [not found] <mailman.4.1280755881.17287.help-gnu-emacs@gnu.org>
@ 2010-08-02 21:42 ` Ilya Zakharevich
  0 siblings, 0 replies; 4+ messages in thread
From: Ilya Zakharevich @ 2010-08-02 21:42 UTC (permalink / raw)
  To: help-gnu-emacs

On 2010-08-01, William L Brown <bbrown@addtoit.com> wrote:
>   Nothing but an indicator of what line I am running with no view of the
> line:
>     (eval 6)[/home/bbrown/newTmp/emacsDebugTests/foo.pl:8]:7:0

From this info, an external program cannot deduce what happens.  We
know that we are on 7th line of $foo, and that

     eval $foo

was called on the 8th line of
/home/bbrown/newTmp/emacsDebugTests/foo.pl.  But how would Emacs know
what is the contents of $foo?

Perl's debugger is not READING scripts to find "the code on line 6 of
bar.pl"; Perl (in debugging mode) just keeps the array of lines SEEN
by the compiler (an array per each file).  For Perl, this $foo becomes
just another "input file", so it has the associated array, and Perl's
debugger can inspect what is on 7th line of this $foo.

Emacs' debugging, on the other hand, is based on reading "raw files"
from the filesystem.  I see no easy way to communicate the needed info by
IPC... [*]

Hope this helps,
Ilya

P.S. [*] Of course, one can extract the relevant arrays from Perl
	 (using, e.g., the `l' operator).  But this would require some
	 extra parsing...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugging Perl with Emacs / perldb
       [not found] ` <mailman.8.1280759507.17287.help-gnu-emacs@gnu.org>
@ 2010-08-03 18:45   ` Joseph Brenner
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Brenner @ 2010-08-03 18:45 UTC (permalink / raw)
  To: help-gnu-emacs


Gary <help-gnu-emacs@garydjones.name> writes:
> William L Brown wrote:

>>     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.
>
> Have you tried http://www.khngai.com/emacs/perl.php for example?

What are you talking about?  There are three fairly basic subjects
discussed there, and none look like they have any bearing on what
William is asking about.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-03 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-01 13:34 Debugging Perl with Emacs / perldb William L Brown
2010-08-02 14:31 ` Gary
     [not found] ` <mailman.8.1280759507.17287.help-gnu-emacs@gnu.org>
2010-08-03 18:45   ` Joseph Brenner
     [not found] <mailman.4.1280755881.17287.help-gnu-emacs@gnu.org>
2010-08-02 21:42 ` Ilya Zakharevich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.