Also hand debug output to the on-screen debug output.

This commit is contained in:
Michael Lotz
2012-11-27 22:42:33 +01:00
parent 75b481f2a4
commit 18b04bdde1
@@ -16,6 +16,8 @@
#include <stdarg.h> #include <stdarg.h>
extern "C" void platform_video_puts(const char* string);
extern addr_t gPeripheralBase; extern addr_t gPeripheralBase;
static bool sLedState = true; static bool sLedState = true;
@@ -87,6 +89,14 @@ debug_assert(bool condition)
} }
extern "C" void
debug_puts(const char* string, int32 length)
{
platform_video_puts(string);
serial_puts(string, length);
}
extern "C" void extern "C" void
panic(const char* format, ...) panic(const char* format, ...)
{ {
@@ -95,7 +105,7 @@ panic(const char* format, ...)
va_list list; va_list list;
int length; int length;
serial_puts(hint, sizeof(hint)); debug_puts(hint, sizeof(hint));
va_start(list, format); va_start(list, format);
length = vsnprintf(buffer, sizeof(buffer), format, list); length = vsnprintf(buffer, sizeof(buffer), format, list);
va_end(list); va_end(list);
@@ -103,10 +113,10 @@ panic(const char* format, ...)
if (length >= (int)sizeof(buffer)) if (length >= (int)sizeof(buffer))
length = sizeof(buffer) - 1; length = sizeof(buffer) - 1;
serial_puts(buffer, length); debug_puts(buffer, length);
//fprintf(stderr, "%s", buffer); //fprintf(stderr, "%s", buffer);
serial_puts("\nPress key to reboot.", 21); debug_puts("\nPress key to reboot.", 21);
platform_exit(); platform_exit();
} }
@@ -126,7 +136,7 @@ dprintf(const char* format, ...)
if (length >= (int)sizeof(buffer)) if (length >= (int)sizeof(buffer))
length = sizeof(buffer) - 1; length = sizeof(buffer) - 1;
serial_puts(buffer, length); debug_puts(buffer, length);
if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT)
fprintf(stderr, "%s", buffer); fprintf(stderr, "%s", buffer);