Helpful emacs & gud/perldb debugging tool

Showing 1-1 of 1 messages
Helpful emacs & gud/perldb debugging tool Steve Fink 2/20/03 10:12 AM
Here's a silly little tool that I've used for a long time to help
debug various programs. I just added perl support to it, so I thought
I'd announce it in case anyone got some use out of it.

To use it, save it into your $PATH somewhere. Then, instead of running
"./someapplication args...", run "debug ./someapplication args..."
instead. If "someapplication" is a compiled binary other than perl, it
will bring up an emacs window with gdb running the application within
it. If "someapplication" is either perl or an executable perl script,
it will bring up an emacs window running perldb with the application
loaded (and it also chdirs to the correct path, instead of perldb's
usual annoying behavior).

There are some environment variables that you can use to control
whether the application will be running under GDB when the window pops
up (the default), or whether it will just set the arguments and give
you a chance to run it yourself. Read the source for details.

Note that this won't help much if you're debugging something that
exec's the thing you really want to debug, but you can usually work
around that by changing the exec to put "debug" in front of the actual
command. This, in fact, is the "killer application" for this script,
since it will then pop up windows no matter how deeply buried the
interesting invocation is, and the whole environment should be set up

If you're trying to use this, or perldb in general, to debug the perl6
driver program, watch out -- perl6 uses *massive* amounts of stack
space, so to get anything useful you'll probably need to set the max
stack depth to 1000 instead of the default 100.

  BEGIN { $DB::deep = 1000 }

should do it, I think. (Once again, my notes on that are at home.)

Let me know if you find this useful, or think I'm stupid for not
knowing a much nicer way of doing this.