Hosted: Merge debugf() implementations. Cleanup debug.h.
Fixes debug build for ypr0. Change-Id: I9c0eff651dcf268a3fafed1a71fcc47f3e323d36
This commit is contained in:
parent
cf333a61c7
commit
5b4a6c4267
|
@ -16,6 +16,11 @@ target/hosted/cpuinfo-linux.c
|
||||||
#ifndef SAMSUNG_YPR0 /* uses as3514 rtc */
|
#ifndef SAMSUNG_YPR0 /* uses as3514 rtc */
|
||||||
target/hosted/rtc.c
|
target/hosted/rtc.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (CONFIG_PLATFORM & PLATFORM_ANDROID) == 0
|
||||||
|
target/hosted/debug-hosted.c
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
system.c
|
system.c
|
||||||
usb.c
|
usb.c
|
||||||
|
|
|
@ -29,16 +29,13 @@ extern void debugf(const char* fmt,...) ATTRIBUTE_PRINTF(1, 2);
|
||||||
extern void ldebugf(const char* file, int line, const char *fmt, ...)
|
extern void ldebugf(const char* file, int line, const char *fmt, ...)
|
||||||
ATTRIBUTE_PRINTF(3, 4);
|
ATTRIBUTE_PRINTF(3, 4);
|
||||||
|
|
||||||
#ifndef CODEC
|
#ifndef CODEC
|
||||||
#ifdef __GNUC__
|
|
||||||
|
|
||||||
/* */
|
|
||||||
#if defined(SIMULATOR) && !defined(__PCTOOL__) \
|
#if defined(SIMULATOR) && !defined(__PCTOOL__) \
|
||||||
|| ((CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO|PLATFORM_PANDORA)) && defined(DEBUG))
|
|| (defined(APPLICATION) && defined(DEBUG))
|
||||||
#define DEBUGF debugf
|
#define DEBUGF debugf
|
||||||
#define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__)
|
#define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__)
|
||||||
#else
|
#elif defined(DEBUG) /* DEBUG on native targets */
|
||||||
#if defined(DEBUG)
|
|
||||||
|
|
||||||
#ifdef HAVE_GDB_API
|
#ifdef HAVE_GDB_API
|
||||||
void breakpoint(void);
|
void breakpoint(void);
|
||||||
|
@ -46,19 +43,13 @@ void breakpoint(void);
|
||||||
|
|
||||||
#define DEBUGF debugf
|
#define DEBUGF debugf
|
||||||
#define LDEBUGF debugf
|
#define LDEBUGF debugf
|
||||||
#else
|
|
||||||
|
#else /* !DEBUG */
|
||||||
|
|
||||||
#define DEBUGF(...) do { } while(0)
|
#define DEBUGF(...) do { } while(0)
|
||||||
#define LDEBUGF(...) do { } while(0)
|
#define LDEBUGF(...) do { } while(0)
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif /* SIMULATOR && !__PCTOOL__ || APPLICATION && DEBUG */
|
||||||
#else
|
|
||||||
|
|
||||||
#define DEBUGF debugf
|
|
||||||
#define LDEBUGF debugf
|
|
||||||
|
|
||||||
#endif /* GCC */
|
|
||||||
|
|
||||||
#endif /* CODEC */
|
#endif /* CODEC */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002 Daniel Stenberg
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
static unsigned old_cp;
|
||||||
|
|
||||||
|
void debug_exit(void)
|
||||||
|
{
|
||||||
|
/* Reset console output codepage */
|
||||||
|
SetConsoleOutputCP(old_cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void debug_init(void)
|
||||||
|
{
|
||||||
|
old_cp = GetConsoleOutputCP();
|
||||||
|
/* Set console output codepage to UTF8. Only works
|
||||||
|
* correctly when the console uses a truetype font. */
|
||||||
|
SetConsoleOutputCP(65001);
|
||||||
|
atexit(debug_exit);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void debug_init(void)
|
||||||
|
{
|
||||||
|
/* nothing to be done */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void debugf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start( ap, fmt );
|
||||||
|
vfprintf( stderr, fmt, ap );
|
||||||
|
va_end( ap );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ldebugf(const char* file, int line, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start( ap, fmt );
|
||||||
|
fprintf( stderr, "%s:%d ", file, line );
|
||||||
|
vfprintf( stderr, fmt, ap );
|
||||||
|
va_end( ap );
|
||||||
|
}
|
|
@ -608,46 +608,6 @@ void lc_close(void *handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __PCTOOL__ */
|
#endif /* __PCTOOL__ */
|
||||||
#ifdef WIN32
|
|
||||||
static unsigned old_cp;
|
|
||||||
|
|
||||||
void debug_exit(void)
|
|
||||||
{
|
|
||||||
/* Reset console output codepage */
|
|
||||||
SetConsoleOutputCP(old_cp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void debug_init(void)
|
|
||||||
{
|
|
||||||
old_cp = GetConsoleOutputCP();
|
|
||||||
/* Set console output codepage to UTF8. Only works
|
|
||||||
* correctly when the console uses a truetype font. */
|
|
||||||
SetConsoleOutputCP(65001);
|
|
||||||
atexit(debug_exit);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void debug_init(void)
|
|
||||||
{
|
|
||||||
/* nothing to be done */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void debugf(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start( ap, fmt );
|
|
||||||
vfprintf( stderr, fmt, ap );
|
|
||||||
va_end( ap );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ldebugf(const char* file, int line, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start( ap, fmt );
|
|
||||||
fprintf( stderr, "%s:%d ", file, line );
|
|
||||||
vfprintf( stderr, fmt, ap );
|
|
||||||
va_end( ap );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rockbox off_t may be different from system off_t */
|
/* rockbox off_t may be different from system off_t */
|
||||||
int sim_ftruncate(int fd, long length)
|
int sim_ftruncate(int fd, long length)
|
||||||
|
|
Loading…
Reference in New Issue