debug: clean up sources

Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>
lib: tweak stdio functions

Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>
debug: move device function declaration to debug_device.h

Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>
lib: tweak return value of getchar

Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>