Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Remote perl debugging via emacs

by sfink (Deacon)
on Jul 29, 2007 at 15:35 UTC ( #629411=perlquestion: print w/ replies, xml ) Need Help??
sfink has asked for the wisdom of the Perl Monks concerning the following question:

I recently discovered the RemotePort setting in the Perl debugger, but I am addicted to using emacs's perldb interface. Is there a way to use perldb within emacs to debug a separate perl process that has RemotePort set?

Comment on Remote perl debugging via emacs
Re: Remote perl debugging via emacs
by sfink (Deacon) on Jul 29, 2007 at 18:51 UTC
    Answering my own question. Maybe someone has a better way, or warnings about this way.

    • Create an executable shell script in your path called pdbserv:
      #!/bin/sh while true; do nc -l -p 7234; done
    • Start up emacs
    • From within emacs, run perldb
    • When it asks for the command, change it from "perl -d -e 0" to "pdbserv -e 0".
    • Run your program with PERLDB_OPTS=RemotePort=localhost:7234 perl -d (scriptname) -emacs
    Voila!

    Next is to try it with diotalevi's Enbugger stuff. If I get a chance to try it out, I'll crosspost under his thread.

    perldb and emacs both annoy me greatly with their excessively "clever" ways of activating and controlling the debugger and slave editor mode. This is far from the first time I've had to use a silly workaround to avoid argument manhandling and misquoting.

    Update: Oddly, the --chickens version does not work, at least not here. emacs thinks you're trying to do something weird with stdin. Stick to -e 0 (or just 0).

    Also modified the script to keep listening after a shutdown instead of exiting.

      It kind of works, however in order to be able to view the source file it must be available on the same path on both local (where emacs is) and remote (where the program is run) hosts. Or maybe I am missing something.
        I guess "remote" was the wrong word. I only wanted to run the perl debugger within gdb when the perl process was running in a different window. I guess most of the time that would imply that the perl process is on another machine, but in my case Perl is embedded within an application that is using stdout and the terminal for its own purposes.

        So yes, it only makes sense when the two share a filesystem. So you'd probably want NFS or something.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://629411]
Approved by FunkyMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2014-09-22 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls