mescc: Refactor debug and stub printing.