Partially re-add debugging stuff that got clobbered by Olof. Still more
work to do for the debug attribute.