Comments in the Perl debugger

acme on 2005-03-29T14:51:28

Here is a list of amusing comments or bits of code I have found in the Perl debugger. They make me laugh, they make me cry:

# Before venturing further into these twisty passages, it is
# wise to read the perldebguts man page or risk the ire of dragons.

# This would probably be better done with "use vars", but that wasn't around # when this code was originally written. (Neither was "use strict".) And on # the principle of not fiddling with something that was working, this was # left alone.

# This was an attempt to clear out the previous values of various # trapped errors. Apparently it didn't help. XXX More info needed!

@RememberOnROptions = qw(DollarCaretP OnlyAssertions);

# Just exactly what part of the word "CORE::" don't you understand?

# Here begin the unreadable code. It needs fixing.

# XXX This looks like a bug to me. # Why copy to @ARGS and then futz with @args?

# No signal is active. $signal = 0;

# Hey, show's over. The debugged program finished # executing already.

# local *dbline = *dbline; # XXX Would this work?!

# If the pattern isn't null ... if ( $inpat ne "" ) {

# Can't run shell commands with Unicode in the debugger, hmm. $cmd =~ /^$sh$sh\s*([\x00-\xff]*)/ && do {

# The following code may be executed now: # BEGIN {warn 4}

# Expand @stack. $#stack = $stack_depth; # Save current single-step setting. $stack[-1] = $single;

# Swing and a miss. Bad syntax.

# Nuke whatever's there.

# De-Perl4-ify the name - ' separators to ::. $subname =~ s/\'/::/g;

# Line didn't make sense.

# Clever test. If you're a mathematician, it's obvious why this # test works. If not:

# XXX Okay, what do $frame and $doret do, again?

# XXX It behooves an OS/2 expert to write the necessary documentation for this!

# is it really less, pretending to be more?

# Drop dead.

# I just *know* there are men without -M

# XXX This may be an extraneous variable.

# I may not be able to resurrect you, but here goes ...

# XXX I have no idea what this is doing. Yet.

# Did we find something that makes sense?

# Do not trace this 1; below!
Funny, eh?


Debugger humor

pemungkah on 2005-03-29T16:29:39

Sometimes you get a little loopy after staring at the debugger for a long time (2+ years to write most of that documentation).

I can't claim credit for the "unreadable code" one though. That was an original, dating back to very close to the debugger's inception.

I'm glad you noticed. I was wondering if anyone would ever actually look at all that work...

MJD?

yDNA Barak on 2005-03-29T17:00:35

Isn't MJD taking a whack at a rewrite of the debugger?

Re:MJD?

pemungkah on 2005-03-29T20:37:05

As far as I know, yes. Don't know how far he's gotten. I think Higher-Order Perl (and being a dad) may have taken up most of his cycles up till now.

For entertainment, look at DB.pm in any recent Perl distribution. Interesting, innit? Sarathy actually put that together a long time ago, and wrote a proof-of-concept debugger called SWAT that used it. If you're interested, I can track down the SWAT source for you.

Re:MJD?

acme on 2005-03-30T01:38:58

Somehow obra convinced me to have a go at a new debugger. Devel::ebug is the result so far. "Devel::ebug is a work in progress."

You missed the best one!!

mugwumpjism on 2005-03-31T18:19:35

# Yes, go down a level.
local $level = $level + 1;

Re:You missed the best one!!

vsergu on 2005-04-01T13:04:03

Nothing wrong with that. Clearly we're in the basement (or the dungeon), where level numbers increase with depth.

warn 4

rjbs on 2008-05-16T10:55:47

# The following code may be executed now:
# BEGIN {warn 4}
Well, better 4 warned...