diff options
author | leozwang <leozwang@google.com> | 2014-07-23 22:45:02 -0700 |
---|---|---|
committer | leozwang <leozwang@google.com> | 2014-07-23 22:45:02 -0700 |
commit | 48a904240bf32fcba701ad8634651569a586d0aa (patch) | |
tree | b80355571b5df5d0e88a9901c4c744f6ffd2fca3 /adb | |
parent | b14f65cb50d020982866cb2ca0f932171abc7aa1 (diff) | |
download | system_core-48a904240bf32fcba701ad8634651569a586d0aa.zip system_core-48a904240bf32fcba701ad8634651569a586d0aa.tar.gz system_core-48a904240bf32fcba701ad8634651569a586d0aa.tar.bz2 |
Redirect debug output to logcat.
If ADB_TRACE is enabled, debug output will be redirected to logcat.
Change-Id: I9c36ada7690a2b946ecd6a926d04e36a8313c36a
Diffstat (limited to 'adb')
-rw-r--r-- | adb/Android.mk | 2 | ||||
-rw-r--r-- | adb/adb.h | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/adb/Android.mk b/adb/Android.mk index 80427b8..44c3215 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -167,7 +167,7 @@ LOCAL_C_INCLUDES += external/openssl/include LOCAL_MODULE := adb -LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils +LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils liblog LOCAL_SHARED_LIBRARIES := libcrypto @@ -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 @@ void adb_qemu_trace(const char* fmt, ...); # 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 @@ void adb_qemu_trace(const char* fmt, ...); errno = save_errno; \ } \ } while (0) +#endif #else # define D(...) ((void)0) # define DR(...) ((void)0) |