forked from len0rd/rockbox
Print debug messages to stdout if no debugger present
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3939 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
50bb7f2de5
commit
71316085de
1 changed files with 20 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char debugmembuf[100];
|
char debugmembuf[100];
|
||||||
char debugbuf[200];
|
char debugbuf[200];
|
||||||
|
@ -25,7 +26,25 @@ char debugbuf[200];
|
||||||
|
|
||||||
void debug( const char *message )
|
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, ...)
|
void debugf(char *fmt, ...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue