How to debug Perl scripts that fork
If you have access to the console and a GUI desktop, run the debugger in an xterm window. The perl debugger works pretty seamlessly with xterms, as the warning message alludes to. As new processes are created, the debugger will open new xterm windows, and you can step through execution in any process in any order.
In either case, clearing the inhibit_exit
flag is helpful, too, for debugging multi-process programs. Run
o inhibit_exit=0
from the debugger prompt. That way, when you spawn a new process running Perl, and there is no reason to break at any point inside the child process, the child process will not interrupt the debugger with the Debugged program terminated. Use q to quit or R to restart ...
message.
Since it's quite likely that you are running under an xterm or similar, you might be being bitten by the Perl debugger's rather narrow view of what an "xterm" is.
It's specifically looking for the string "xterm". It wants to see xterm
in the TERM
environment variable. Not gnome-terminal
. Not xterm-256color
. Just xterm
.
Run with:
TERM=xterm perl -d ...
to make sure it gets the picture. I only figured that one out after ten minutes of grumping at the Perl debugger.
It seems very happy to spawn tons of xterm windows and doesn't seem very good at cleaning them up when it exits, by the way.