1
0
Fork 0
forked from len0rd/rockbox

Redirect (L)DEBUGFs to adb logcat in DEBUG enabled builds.

Exclude compilation of firmware/debug.c for hosted platforms.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28125 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-09-20 17:38:47 +00:00
parent 66f8fb52a9
commit ad500e1063
6 changed files with 62 additions and 15 deletions

View file

@ -20,7 +20,10 @@ rolo.c
#endif /* !defined(BOOTLOADER) || defined(CPU_SH) */ #endif /* !defined(BOOTLOADER) || defined(CPU_SH) */
thread.c thread.c
timer.c timer.c
debug.c
#endif /* PLATFORM_NATIVE */ #endif /* PLATFORM_NATIVE */
panic.c
#ifdef HAVE_SDL #ifdef HAVE_SDL
target/hosted/sdl/button-sdl.c target/hosted/sdl/button-sdl.c
target/hosted/sdl/kernel-sdl.c target/hosted/sdl/kernel-sdl.c
@ -43,8 +46,6 @@ target/hosted/sdl/key_to_touch-sdl.c
target/hosted/sdl/app/button-application.c target/hosted/sdl/app/button-application.c
#endif #endif
#endif #endif
panic.c
debug.c
/* Standard library */ /* Standard library */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(__MINGW32__) || defined(__CYGWIN__) #if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(__MINGW32__) || defined(__CYGWIN__)
@ -1707,6 +1708,9 @@ target/hosted/android/fs-android.c
target/hosted/android/lcd-android.c target/hosted/android/lcd-android.c
target/hosted/android/lc-android.c target/hosted/android/lc-android.c
target/hosted/android/button-android.c target/hosted/android/button-android.c
#ifdef DEBUG
target/hosted/android/debug-android.c
#endif
target/hosted/android/kernel-android.c target/hosted/android/kernel-android.c
target/hosted/android/pcm-android.c target/hosted/android/pcm-android.c
target/hosted/android/powermgmt-android.c target/hosted/android/powermgmt-android.c

View file

@ -35,7 +35,6 @@ static char debugbuf[400];
#endif #endif
#endif #endif
#ifndef SIMULATOR /* allow non archos platforms to display output */
#include "kernel.h" #include "kernel.h"
#include "system.h" #include "system.h"
#include "debug.h" #include "debug.h"
@ -257,4 +256,3 @@ void debugf(const char *fmt, ...)
#endif #endif
} }
#endif

View file

@ -33,13 +33,10 @@ extern void ldebugf(const char* file, int line, const char *fmt, ...)
#ifdef __GNUC__ #ifdef __GNUC__
/* */ /* */
#if defined(SIMULATOR) && !defined(__PCTOOL__) #if (SIMULATOR) && !defined(__PCTOOL__) \
|| ((CONFIG_PLATFORM & PLATFORM_ANDROID) && defined(DEBUG))
#define DEBUGF debugf #define DEBUGF debugf
#define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__)
#elif (CONFIG_PLATFORM & PLATFORM_ANDROID)
#include "system-target.h"
#define DEBUGF LOG
#define LDEBUGF(...)
#else #else
#if defined(DEBUG) #if defined(DEBUG)

View file

@ -0,0 +1,52 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (c) 2010 Thomas Martitz
*
* 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 "config.h"
#ifdef DEBUG
#include <android/log.h>
#include <stdarg.h>
#include <stdio.h>
#define LOG_TAG "Rockbox"
void debug_init(void) {}
void debugf(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
__android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, fmt, ap);
va_end(ap);
}
void ldebugf(const char* file, int line, const char *fmt, ...)
{
va_list ap;
char buf[1024];
snprintf(buf, sizeof(buf), "%s:%d %s", file, line, fmt);
va_start(ap, fmt);
__android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG " L", buf, ap);
va_end(ap);
}
#endif

View file

@ -22,6 +22,7 @@
#include <jni.h> #include <jni.h>
#include <stdbool.h> #include <stdbool.h>
#include <system.h> #include <system.h>
#include "debug.h"
#include "pcm.h" #include "pcm.h"
extern JNIEnv *env_ptr; extern JNIEnv *env_ptr;
@ -73,7 +74,7 @@ Java_org_rockbox_RockboxPCM_pcmSamplesToByteArray(JNIEnv *env,
pcm_play_get_more_callback((void**)&pcm_data_start, &pcm_data_size); pcm_play_get_more_callback((void**)&pcm_data_start, &pcm_data_size);
if (pcm_data_size == 0) if (pcm_data_size == 0)
{ {
LOG("out of data\n"); DEBUGF("out of data\n");
return; return;
} }
if (remaining > pcm_data_size) if (remaining > pcm_data_size)

View file

@ -28,11 +28,6 @@
void power_off(void); void power_off(void);
#include <android/log.h>
#define LOG_TAG "Rockbox"
#define LOG(args...) \
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, ##args);
#endif /* __SYSTEM_TARGET_H__ */ #endif /* __SYSTEM_TARGET_H__ */
#define NEED_GENERIC_BYTESWAPS #define NEED_GENERIC_BYTESWAPS