Move scattered debug functions into one #ifndef-guarded place.