Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I had always assumed that perl's debugging hooks would only work if perl was run as perl -d, and would make your program horribly slow. It turns out that neither assumption is true. First, any code compiled while suitable $^P flags are set (see perldebguts), even when Perl is started without "-d", is debuggable. Second, when $DB::trace is 0 and minimal debugging flags are set, there seems to be no appreciable overhead. Specifically, with $^P = 0x303, which allows single-line stepping and gives nice caller information for evals and anonymous subs, debugging is essentially free.
To me, at least, this is seriously cool. I'm surprised this isn't more widely known or used. Update: If you're wondering what prompted this, check out Sepia version 0.90 shortly. It only takes a couple hundred lines of ELisp + Perl to get a pretty decent GUD debugger in Emacs, and a minimal one would probably be less than 100. Once again, thank you Free Software! Here are the benchmarks, with typical runtimes on my system:
In reply to perl -d: faster and less scary than you think by educated_foo
|
|