am 5a255238: Merge "Redirect debug output to logcat." into lmp-dev
* commit '5a2552388e698fec4efda270d2d88bb18ed3f299':
Redirect debug output to logcat.
diff --git a/adb/Android.mk b/adb/Android.mk
index 80c1f9c..bba5365 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -168,7 +168,7 @@
LOCAL_MODULE := adb
-LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils
+LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils liblog
LOCAL_SHARED_LIBRARIES := libcrypto
diff --git a/adb/adb.h b/adb/adb.h
index 707a6e0..d4c8c5f 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -17,6 +17,9 @@
#ifndef __ADB_H
#define __ADB_H
+#if !ADB_HOST
+#include <android/log.h>
+#endif
#include <limits.h>
#include "transport.h" /* readx(), writex() */
@@ -382,7 +385,27 @@
# define ADB_TRACING ((adb_trace_mask & (1 << TRACE_TAG)) != 0)
- /* you must define TRACE_TAG before using this macro */
+/* you must define TRACE_TAG before using this macro */
+#if !ADB_HOST
+# define D(...) \
+ do { \
+ if (ADB_TRACING) { \
+ __android_log_print( \
+ ANDROID_LOG_INFO, \
+ __FUNCTION__, \
+ __VA_ARGS__ ); \
+ } \
+ } while (0)
+# define DR(...) \
+ do { \
+ if (ADB_TRACING) { \
+ __android_log_print( \
+ ANDROID_LOG_INFO, \
+ __FUNCTION__, \
+ __VA_ARGS__ ); \
+ } \
+ } while (0)
+#else
# define D(...) \
do { \
if (ADB_TRACING) { \
@@ -409,6 +432,7 @@
errno = save_errno; \
} \
} while (0)
+#endif
#else
# define D(...) ((void)0)
# define DR(...) ((void)0)