ActiveState Powered by ActiveState

ActiveState Community


Perl remote debugging

Posted by Jaroslav on 2007-09-25 05:05

hi

I am trying to get working PERL remote debugging on my RHEL4. I hade created a directory for my perl scripts as following: /home/perl/utv and in this directori is a simple perl script test_01.pl:

#!/usr/bin/perl -w
print "Hallo World!";

Then I downloaded activestates Komodo 4.1 Perl remote Debugging for linux and unpacked this to /home/perl/Komodo-PerlRemoteDebugging-4.1.1
Then I configured environment variables as following:

[root@trfmlmftp utv]# export PERL5LIB=/home/perl/Komodo-PerlRemoteDebugging-4.1.1/
[root@trfmlmftp utv]# export PERLDB_OPTS="RemotePort=192.168.100.1:9000"
[root@trfmlmftp utv]# export DBGP_IDEKEY="perl"

The I configured my Komodo IDE 4.1.1 as following:
Server type: SCP
Hostname: ip address
port:22
user name perl (configured user of RHEL4 with all needed access)
password
Default path: /home/perl/utv

as last configuration step I started Listen for debugging connection in Komodo IDE.
Then I run test_01.pl script as following:
perl -d /home/perl/utv/test_01.pl

and I get back this message:
Unable to connect to remote host: 192.168.116.10:9000 (Bad file descriptor)
Running program outside the debugger...

I must to tell you when I am using XDEBUG remoten debugging for PHP and it works nice also through port 9000. I am connected to RHEL4 by VPN tunell. The Totaly connection number never increased with perl debugging, only when I debugg PHP.

Can anybode help me please?
Thanks for any sugestions.

/ Jaroslav

ericp | Tue, 2007-09-25 09:54

You told Perl to connect to
export PERLDB_OPTS="RemotePort=192.168.100.1:9000"

but the error message is:
Unable to connect to remote host: 192.168.116.10:9000 ...

Could you retry with these environment variables:

perl_dbgp_path=/home/perl/Komodo-PerlRemoteDebugging-4.1.1
export PERL5LIB=$perl_dbgp_path
export PERL5DB="BEGIN { require q/$perl_dbgp_path/perl5db.pl}"
export PERLDB_OPTS="RemotePort=192.168.100.1:9000"
export DBGP_IDEKEY="perl"

- Eric

Jaroslav | Wed, 2007-09-26 00:39

Eric,

I don't know why thise IP addresses are different. Now I have done everthing in accordance to your advice. Here is my log. It is not so much I understand there:

login as: perl
perl@192.168.116.10's password:
Last login: Wed Sep 26 08:23:38 2007 from 192.168.110.1
[perl@trfmlmftp ~]$ perl_dbgp_path=/home/perl/Komodo-PerlRemoteDebugging-4.1.1/
[perl@trfmlmftp ~]$ export PERL5LIB=$perl_dbgp_path
[perl@trfmlmftp ~]$ export PERL5DB="BEGIN{ require q/$perl_dbgp_path/perl5db.pl} "
[perl@trfmlmftp ~]$ export PERLDB_OPTS="RemotePort=192.168.100.1:9000"
[perl@trfmlmftp ~]$ export DBGP_IDEKEY="perl"
[perl@trfmlmftp ~]$ perl -d /home/perl/utv/test_01.pl
Bareword found where operator expected at /home/perl/utv/test_01.pl line 0, near "q//home"
Bareword found where operator expected at /home/perl/utv/test_01.pl line 1, near "#!/usr"
(Might be a runaway multi-line // string starting on line 0)
(Missing operator before usr?)
syntax error at /home/perl/utv/test_01.pl line 0, near "q//home"
Missing right curly or square bracket at /home/perl/utv/test_01.pl line 2, at en d of line
Execution of /home/perl/utv/test_01.pl aborted due to compilation errors.
[perl@trfmlmftp ~]$

The program is same without any changes.

/Jaroslav

Jaroslav | Wed, 2007-09-26 03:56

Eric,

regarding different addresses the IP address 192.168.116.10:9000 is the server's own IP address. 192.168.100.1 si Ip address of my Komodo client, but why the message tells about server address I don't know.
Here follows my test file test_01.pl file here. I can't see any errors there.
#!/usr/bin/perl -w
print "Hallo World!";

/ Jaroslav

Jaroslav | Wed, 2007-09-26 04:10

Hi Eric,

I have followed your recomendations and get following message:

login as: perl
perl@192.168.116.10's password:
Last login: Wed Sep 26 08:33:13 2007 from 192.168.110.1
[perl@trfmlmftp ~]$ perl_dbgp_path=/home/perl/Komodo-PerlRemoteDebugging-4.1.1
[perl@trfmlmftp ~]$ export PERL5LIB=$perl_dbgp_path
[perl@trfmlmftp ~]$ export PERL5DB="BEGIN {require q/$perl_dbgp_path/perl5db.pl}"
[perl@trfmlmftp ~]$ export PERLDB_OPTS="RemotePort=192.168.100.1:9000"
[perl@trfmlmftp ~]$ export DBGP_IDEKEY="perl"
[perl@trfmlmftp ~]$ perl -d /home/perl/utv/test_01.pl
Bareword found where operator expected at /home/perl/utv/test_01.pl line 0, near "q//home"
syntax error at /home/perl/utv/test_01.pl line 0, near "q//home"
BEGIN not safe after errors--compilation aborted.
[perl@trfmlmftp ~]$

I don't know what the system tells about. I have not any bareword on line 0:
Here is my script:
#!/usr/bin/perl -w
print "Hallo World!";

/ Jaroslav

ericp | Wed, 2007-09-26 07:51

Try this:

export PERL5DB="BEGIN {require q,$perl_dbgp_path/perl5db.pl,}"

The "/" was ending the string, which is why the require failed.

Jaroslav | Wed, 2007-09-26 23:44

ericp

sorry, but the new commandos does not work again. I have got following message:

login as: perl
perl@192.168.116.10's password:
Last login: Wed Sep 26 12:24:10 2007 from 192.168.110.1
[perl@trfmlmftp ~]$ perl_dbgp_path=/home/perl/Komodo-PerlRemoteDebugging-4.1.1
[perl@trfmlmftp ~]$ export PERL5LIB=$perl_dbgp_path
[perl@trfmlmftp ~]$ export PERL5DB="BEGIN {require q,$perl_dbgp_path/perl5db.pl,}"
[perl@trfmlmftp ~]$ export PERLDB_OPTS="remotePort=192.168.100.1:9000"
[perl@trfmlmftp ~]$ export DBGP_IDEKEY="perl"
[perl@trfmlmftp ~]$ perl -d /home/perl/utv/test_01.pl
Unable to connect to remote host: 192.168.100.1:9000 (Bad file descriptor)
Running program outside the debugger...
Hallo World![perl@trfmlmftp ~]$

What the system means with Bad file descriptor and how works DBGP_IDEKEY?
F.Y.I. here is my debugging setup for PHP which works nice with Komodo IDE.

zend_extension="/usr/lib/php/xdebug/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.110.1
xdebug.remote_port=9000
xdebug.idekey=jhejzlar

/ Jaroslav

ericp | Thu, 2007-09-27 10:01

1. Drop the line that sets DBGP_IDEKEY. You can do this in the
current session:

export DBGP_IDEKEY=

There should be nothing after the "="

2. Change the port to be the same one xdebug uses:

export PERLDB_OPTS="remotePort=192.168.110.1:9000"

"Bad file descriptor" means the given port doesn't work.
It's a Perl error message, not Komodo's. Otherwise it
would be more informative (one would hope).

For Perl debugging the DBGP_IDEKEY variable is only needed
when you go through a proxy.

Jaroslav | Thu, 2007-09-27 12:17

Hi ericp,

As you could se I was using the same port as xdebug did. Could I find any more information why perl doesn't use port 9000? It seams to be perl problem. Can I use any special perl script to test port conection to 192.168.100.1 though port 9000?

/ Jaroslav

ericp | Thu, 2007-09-27 12:31

1. Make sure Komodo is waiting on port 9000.

2. On a remote machine, in a shell, type this:

telnet 192.168.110.1 9000

You should see something like this:

Trying 192.168.110.1...
Connected to . (127.0.0.1).
Escape character is '^]'.

At this point type Ctrl-left-square-bracket, to get this:

telnet>

Here type 'q' or Ctrl-D to end the telnet session.

Komodo should report another connection. If this doesn't
happen, there might be a firewall problem, and you might
want to read up on the Komodo debugger proxy.

troyt | Thu, 2007-09-27 12:48

Is it possible that the Debugger Connection preference has changed?

Under Edit|Preferences|Debugger|Connection there's a setting for either using a system-provided free port or setting a specific port. I'm assuming you have this set explicitly to 9000.

Might be worth checking Debug|Listener Status to see that it's listening on the right port.

Jaroslav | Thu, 2007-09-27 13:25

login as: root
root@192.168.116.10's password:
Last login: Wed Sep 26 08:26:56 2007 from 192.168.110.1
[root@trfmlmftp ~]# perl_dbgp_path=/home/perl/Komodo-PerlRemoteDebugging-4.1.1
[root@trfmlmftp ~]# cd /home/perl/Komodo-PerlRemoteDebugging-4.1.1/
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# ls -l
total 168
drwxr-xr-x 7 jhejzlar jhejzlar 4096 Jun 7 03:04 DB
-rwxr-xr-x 1 jhejzlar jhejzlar 1368 Jun 7 03:04 LICENSE.txt
-rwxr-xr-x 1 jhejzlar jhejzlar 137675 Jun 7 03:04 perl5db.pl
drwxr-xr-x 3 jhejzlar jhejzlar 4096 Jun 7 03:04 Syntax
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# export PERL5LIB=$perl_dbgp_path
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# export PERL5DB="BEGIN {require q,$perl_dbgp_path/perl5db.pl,}"
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# export PERLDB_OPTS="RemotePort=192.168.100.1:9000"
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# export DBGP_IDEKEY="jhejzlar"
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# telnet 192.168.100.1 9000
Trying 192.168.100.1...
Quit
[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]#

Telnet is only trying never connected. But PHP debugger by xdebug works through the same port 9000. Is anything different with using of perl debugging versus PHP?

Yes, port 9000 is sett explicitly. Down is text: Summary: Komodo will listen för debugging connections on port 9000. Curently Komodo is listening on port 9000. When I click on Current connection state The debugger listener pop up windows shows me the host port is 9000 and 0 Total Connections.

/ Jaroslav

Jaroslav | Thu, 2007-09-27 13:39

I have forgoten following:

[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# telnet 192.168.100.1 9000
Trying 192.168.100.1...

[root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]# perl -d /home/perl/utv/test_01.pl
Unable to connect to remote host: 192.168.100.1:9000 (Bad file descriptor)
Running program outside the debugger...
Hallo World![root@trfmlmftp Komodo-PerlRemoteDebugging-4.1.1]#

Can PHP XDEBUG allocate port 9000 for his self?

I must also tell you that i have closed my localy windows firewall.

Any other suggestions.

/ Jaroslav

ericp | Thu, 2007-09-27 13:28

I suggested this:

telnet 192.168.110.1 9000

You said you tried this:

telnet 192.168.100.1 9000

Since xdebug is successfully using
the IP address 192.168.110.1, why do
you think Perl should be using
192.168.100.1?

-->