summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2003-08-23 21:01:04 +0000
committerHardeep Sidhu <dyp@pobox.com>2003-08-23 21:01:04 +0000
commit71316085de3b025e590297d28634d53c6edfb07c (patch)
treed94b5f5ad8e922a9ee956ac880828786ad0b2d7d /uisimulator
parent50bb7f2de54203a8ccff0f4b30179b49ee3bb6ea (diff)
downloadrockbox-71316085de3b025e590297d28634d53c6edfb07c.tar.gz
rockbox-71316085de3b025e590297d28634d53c6edfb07c.tar.bz2
rockbox-71316085de3b025e590297d28634d53c6edfb07c.zip
Print debug messages to stdout if no debugger present
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3939 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/win32/debug-win32.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/uisimulator/win32/debug-win32.c b/uisimulator/win32/debug-win32.c
index 3152862d37..520473dd71 100644
--- a/uisimulator/win32/debug-win32.c
+++ b/uisimulator/win32/debug-win32.c
@@ -18,6 +18,7 @@
****************************************************************************/
#include <windows.h>
+#include <stdio.h>
char debugmembuf[100];
char debugbuf[200];
@@ -25,7 +26,25 @@ char debugbuf[200];
void debug( const char *message )
{
- OutputDebugString (message);
+ static int debugger = -1;
+
+ if (debugger == -1)
+ {
+ HINSTANCE hInst = LoadLibrary("kernel32.dll");
+ debugger = 0;
+
+ if (hInst != NULL)
+ {
+ FARPROC pIsDebuggerPresent = GetProcAddress(hInst, "IsDebuggerPresent");
+ if (pIsDebuggerPresent != NULL)
+ debugger = pIsDebuggerPresent();
+ }
+ }
+
+ if (debugger)
+ OutputDebugString (message);
+ else
+ printf("%s", message);
}
void debugf(char *fmt, ...)