Add debug support while we are here. Diff from Travis Cole with input from myself and sthen@. OK sthen@ Thanks!