UNBUILDABLE: Start refactoring of ErrorHelper.

Add -debug option and new methods to generate debug code to call
ErrorHelper.
Second step of refactoring.

Builds at least, untested.