blob: ec3094da26bc57489b5ec8b571392466158dadbe [file] [log] [blame]
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -08001/* Copyright (C) 2007-2008 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10** GNU General Public License for more details.
11*/
12#ifndef _ANDROID_UTILS_DEBUG_H
13#define _ANDROID_UTILS_DEBUG_H
14
15#include <stdarg.h>
16
17#define VERBOSE_TAG_LIST \
18 _VERBOSE_TAG(init, "emulator initialization") \
19 _VERBOSE_TAG(console, "control console") \
20 _VERBOSE_TAG(modem, "emulated GSM modem") \
21 _VERBOSE_TAG(radio, "emulated GSM AT Command channel") \
22 _VERBOSE_TAG(keys, "key bindings & presses") \
23 _VERBOSE_TAG(slirp, "internal router/firewall") \
24 _VERBOSE_TAG(timezone, "host timezone detection" ) \
25 _VERBOSE_TAG(socket, "network sockets") \
26 _VERBOSE_TAG(proxy, "network proxy support") \
27 _VERBOSE_TAG(audio, "audio sub-system") \
28 _VERBOSE_TAG(audioin, "audio input backend") \
29 _VERBOSE_TAG(audioout, "audio output backend") \
30 _VERBOSE_TAG(surface, "video surface support") \
31 _VERBOSE_TAG(qemud, "qemud multiplexer daemon") \
32 _VERBOSE_TAG(gps, "emulated GPS") \
33 _VERBOSE_TAG(nand_limits, "nand/flash read/write thresholding") \
34 _VERBOSE_TAG(hw_control, "emulated power/flashlight/led/vibrator") \
35 _VERBOSE_TAG(avd_config, "android virtual device configuration") \
The Android Open Source Project9877e2e2009-03-18 17:39:44 -070036 _VERBOSE_TAG(sensors, "emulated sensors") \
Vladimir Chtchetkine5389aa12010-02-16 10:38:35 -080037 _VERBOSE_TAG(memcheck, "memory checker") \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -070038 _VERBOSE_TAG(camera, "camera") \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -070039 _VERBOSE_TAG(adevice, "android device connected via port forwarding") \
40 _VERBOSE_TAG(sensors_port, "sensors emulator connected to android device") \
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020041 _VERBOSE_TAG(gles, "hardware OpenGLES emulation") \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -080042 _VERBOSE_TAG(adbserver, "ADB server") \
43 _VERBOSE_TAG(adbclient, "ADB QEMU client") \
Vladimir Chtchetkinebf45fc22012-02-27 10:46:10 -080044 _VERBOSE_TAG(adb, "ADB debugger") \
The Android Open Source Project8b23a6c2009-03-03 19:30:32 -080045
46#define _VERBOSE_TAG(x,y) VERBOSE_##x,
47typedef enum {
48 VERBOSE_TAG_LIST
49 VERBOSE_MAX /* do not remove */
50} VerboseTag;
51#undef _VERBOSE_TAG
52
53/* defined in android_main.c */
54extern unsigned long android_verbose;
55
56#define VERBOSE_ENABLE(tag) \
57 android_verbose |= (1 << VERBOSE_##tag)
58
59#define VERBOSE_DISABLE(tag) \
60 android_verbose &= (1 << VERBOSE_##tag)
61
62#define VERBOSE_CHECK(tag) \
63 ((android_verbose & (1 << VERBOSE_##tag)) != 0)
64
65#define VERBOSE_CHECK_ANY() \
66 (android_verbose != 0)
67
68#define VERBOSE_PRINT(tag,...) \
69 do { if (VERBOSE_CHECK(tag)) dprint(__VA_ARGS__); } while (0)
70
71/** DEBUG TRACE SUPPORT
72 **
73 ** debug messages can be sent by calling these function
74 **
75 ** 'dprint' prints the message, then appends a '\n\
76 ** 'dprintn' simply prints the message as is
77 ** 'dprintnv' allows you to use a va_list argument
78 ** 'dwarning' prints a warning message, then appends a '\n'
79 ** 'derror' prints a severe error message, then appends a '\n'
80 */
81
82extern void dprint( const char* format, ... );
83extern void dprintn( const char* format, ... );
84extern void dprintnv( const char* format, va_list args );
85extern void dwarning( const char* format, ... );
86extern void derror( const char* format, ... );
87
88/** STDOUT/STDERR REDIRECTION
89 **
90 ** allows you to shut temporarily shutdown stdout/stderr
91 ** this is useful to get rid of debug messages from ALSA and esd
92 ** on Linux.
93 **/
94
95extern void stdio_disable( void );
96extern void stdio_enable( void );
97
98/* */
99
100#endif /* _ANDROID_UTILS_DEBUG_H */