1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
11 #ifndef __MOONLIGHT_DEBUG_H__
12 #define __MOONLIGHT_DEBUG_H__
23 #endif /* DEBUG || LOGGING */
26 * Stacktrace (debug) stuff
32 #define MAX_STACK_FRAMES 10
34 char* get_stack_trace_prefix (const char* prefix
, int maxframes
= MAX_STACK_FRAMES
);
35 void print_stack_trace_prefix (const char* prefix
, int maxframes
= MAX_STACK_FRAMES
);
37 void print_reftrace (const char * type
, const char * typname
, int refcount
, bool keep
);
38 void dump_frames (void);
42 char* get_stack_trace (void);
43 void print_stack_trace (void);
44 void enable_vm_stack_trace (void);
45 void hexdump_addr (void *addr
, size_t n
);
51 #define print_stack_trace()
52 #define enable_vm_stack_trace()
53 #define print_reftrace (const char * type, const char * typname, int refcount, bool keep)
54 #define dump_frames (void)
64 #define LOG_ALSA(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_ALSA)) printf (__VA_ARGS__);
65 #define LOG_ALSA_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_ALSA_EX)) printf (__VA_ARGS__);
66 #define LOG_AUDIO(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_AUDIO)) printf (__VA_ARGS__);
67 #define LOG_AUDIO_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_AUDIO_EX)) printf (__VA_ARGS__);
68 #define LOG_PULSE(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_PULSE)) printf (__VA_ARGS__);
69 #define LOG_PULSE_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_PULSE_EX)) printf (__VA_ARGS__);
70 #define LOG_HTTPSTREAMING(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_HTTPSTREAMING)) printf (__VA_ARGS__);
71 #define LOG_MARKERS(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MARKERS)) printf (__VA_ARGS__);
72 #define LOG_MARKERS_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_MARKERS_EX)) printf (__VA_ARGS__);
73 #define LOG_MMS(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MMS)) printf (__VA_ARGS__);
74 #define LOG_MEDIAPLAYER(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MEDIAPLAYER)) printf (__VA_ARGS__);
75 #define LOG_MEDIAPLAYER_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_MEDIAPLAYER_EX)) printf (__VA_ARGS__);
76 #define LOG_PIPELINE(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_PIPELINE)) printf (__VA_ARGS__);
77 #define LOG_PIPELINE_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_PIPELINE_EX)) printf (__VA_ARGS__);
78 #define LOG_PIPELINE_ERROR(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_PIPELINE_ERROR)) printf (__VA_ARGS__);
79 #define LOG_PIPELINE_ERROR_CONDITIONAL(x, ...) if (G_UNLIKELY (x && debug_flags & PIPELINE_ERROR)) printf (__VA_ARGS__);
80 #define LOG_FRAMEREADERLOOP(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_FRAMEREADERLOOP)) printf (__VA_ARGS__);
81 #define LOG_FFMPEG(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_FFMPEG)) printf(__VA_ARGS__);
82 #define LOG_UI(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_UI)) printf (__VA_ARGS__);
83 #define LOG_CODECS(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_CODECS)) printf (__VA_ARGS__);
84 #define LOG_DP(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_DP)) printf (__VA_ARGS__);
85 #define LOG_DOWNLOADER(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_DOWNLOADER)) printf (__VA_ARGS__);
86 #define LOG_FONT(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_FONT)) fprintf (__VA_ARGS__);
87 #define LOG_LAYOUT(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_LAYOUT)) printf (__VA_ARGS__);
88 #define LOG_MEDIA(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MEDIA)) printf (__VA_ARGS__);
89 #define LOG_MEDIAELEMENT(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MEDIAELEMENT)) printf (__VA_ARGS__);
90 #define LOG_MEDIAELEMENT_EX(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_MEDIAELEMENT_EX)) printf (__VA_ARGS__);
91 #define LOG_MSI(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MSI)) printf (__VA_ARGS__);
92 #define LOG_BUFFERING(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_BUFFERING)) printf (__VA_ARGS__);
93 #define LOG_PIPELINE_ASF(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_ASF)) printf (__VA_ARGS__);
94 #define LOG_PLAYLIST(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_PLAYLIST)) printf (__VA_ARGS__);
95 #define LOG_PLAYLIST_WARN(...) if (G_UNLIKELY (debug_flags_ex & RUNTIME_DEBUG_PLAYLIST_EX)) printf (__VA_ARGS__);
96 #define LOG_TEXT(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_TEXT)) fprintf (__VA_ARGS__);
97 #define LOG_XAML(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_XAML)) printf (__VA_ARGS__);
98 #define LOG_DEPLOYMENT(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_DEPLOYMENT)) printf (__VA_ARGS__);
99 #define LOG_MP3(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_MP3)) printf (__VA_ARGS__);
100 #define LOG_ASF(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_ASF)) printf (__VA_ARGS__);
101 #define LOG_VALUE(...) if (G_UNLIKELY (debug_flags & RUNTIME_DEBUG_VALUE)) printf (__VA_ARGS__);
105 #define LOG_ALSA(...)
106 #define LOG_ALSA_EX(...)
107 #define LOG_AUDIO(...)
108 #define LOG_AUDIO_EX(...)
109 #define LOG_PULSE(...)
110 #define LOG_PULSE_EX(...)
111 #define LOG_HTTPSTREAMING(...)
112 #define LOG_MARKERS(...)
113 #define LOG_MARKERS_EX(...)
115 #define LOG_MEDIAPLAYER(...)
116 #define LOG_MEDIAPLAYER_EX(...)
117 #define LOG_PIPELINE(...)
118 #define LOG_PIPELINE_EX(...)
119 #define LOG_PIPELINE_ERROR(...)
120 #define LOG_PIPELINE_ERROR_CONDITIONAL(x, ...)
121 #define LOG_FRAMEREADERLOOP(...)
122 #define LOG_FFMPEG(...)
124 #define LOG_CODECS(...)
126 #define LOG_DOWNLOADER(...)
127 #define LOG_FONT(...)
128 #define LOG_LAYOUT(...)
129 #define LOG_MEDIA(...)
130 #define LOG_MEDIAELEMENT(...)
131 #define LOG_MEDIAELEMENT_EX(...)
133 #define LOG_BUFFERING(...)
134 #define LOG_PIPELINE_ASF(...)
135 #define LOG_PLAYLIST(...)
136 #define LOG_PLAYLIST_WARN(...)
137 #define LOG_TEXT(...)
138 #define LOG_XAML(...)
139 #define LOG_DEPLOYMENT(...)
142 #define LOG_VALUE(...)
148 void moonlight_install_signal_handlers ();
151 #define moonlight_install_signal_handlers()
154 #endif /* __MOONLIGHT_DEBUG_H */