00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00023 #ifndef LIBCWD_DEBUG_H
00024 #define LIBCWD_DEBUG_H
00025
00026 #ifndef LIBCWD_SYS_H
00027 #error "You need to #include "sys.h" at the top of every source file (which in turn should #include <libcwd/sys.h>)."
00028 #endif
00029
00030 #ifndef CWDEBUG
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #error "You are including <libcwd/debug.h> while CWDEBUG is not defined. See the comments in this header file for more information."
00041
00042 #else // CWDEBUG (normal usage of this file):
00043
00044 #include <libcwd/config.h>
00045
00046
00047
00048
00049
00050 #include <libcwd/class_channel.h>
00051 #include <libcwd/class_fatal_channel.h>
00052 #include <libcwd/class_continued_channel.h>
00053 #include <libcwd/class_always_channel.h>
00054
00055 #ifndef DEBUGCHANNELS
00056
00062 #define DEBUGCHANNELS ::libcwd::channels
00063 #endif
00064
00065 namespace libcwd {
00066
00067 namespace channels {
00068
00076 namespace dc {
00077 extern channel_ct debug;
00078 extern channel_ct notice;
00079 extern channel_ct system;
00080 extern channel_ct warning;
00081 #if CWDEBUG_ALLOC
00082 #ifdef LIBCWD_USE_EXTERNAL_C_LINKAGE_FOR_MALLOC
00083 extern channel_ct malloc;
00084 #else
00085 extern channel_ct __libcwd_malloc;
00086 #endif
00087 #else // !CWDEBUG_ALLOC
00088 extern channel_ct malloc;
00089 #endif
00090 #if CWDEBUG_LOCATION
00091 extern channel_ct bfd;
00092 #endif
00093 extern fatal_channel_ct fatal;
00094 extern fatal_channel_ct core;
00095 extern continued_channel_ct continued;
00096 extern continued_channel_ct finish;
00097 extern always_channel_ct always;
00098
00099 }
00100 }
00101
00102 }
00103
00104
00105
00106
00107
00108
00109 #include <libcwd/class_debug.h>
00110
00111 namespace libcwd {
00112
00113 extern debug_ct libcw_do;
00114
00115 }
00116
00117
00118
00119
00120
00121 #include <libcwd/macro_Libcwd_macros.h>
00122
00123
00124
00125 #define __Debug(x) \
00126 LibcwDebug(::libcwd::channels, x)
00127 #define __Dout(cntrl, data) \
00128 LibcwDout(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
00129 #define __DoutFatal(cntrl, data) \
00130 LibcwDoutFatal(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
00131
00132
00159 #define Debug(x) \
00160 LibcwDebug(DEBUGCHANNELS, x)
00161
00189 #define Dout(cntrl, data) \
00190 LibcwDout(DEBUGCHANNELS, ::libcwd::libcw_do, cntrl, data)
00191
00199 #define DoutFatal(cntrl, data) \
00200 LibcwDoutFatal(DEBUGCHANNELS, ::libcwd::libcw_do, cntrl, data)
00201
00202
00203
00204
00205
00206 namespace libcwd {
00207
00208 extern channel_ct* find_channel(char const* label);
00209 extern void list_channels_on(debug_ct& debug_object);
00210
00211
00212 using std::operator<<;
00213
00214 }
00215
00216
00217 #ifndef HIDE_FROM_DOXYGEN
00218 namespace libcwd_inserters {
00219 using libcwd::operator<<;
00220 }
00221 using namespace libcwd_inserters;
00222 #endif
00223
00224 #include <libcwd/macro_ForAllDebugChannels.h>
00225 #include <libcwd/macro_ForAllDebugObjects.h>
00226 #include <libcwd/private_environ.h>
00227 #include <libcwd/class_rcfile.h>
00228 #include <libcwd/attach_gdb.h>
00229 #include <libcwd/demangle.h>
00230
00231
00232 #include <libcwd/private_allocator.inl>
00233 #include <libcwd/class_channel.inl>
00234 #include <libcwd/class_fatal_channel.inl>
00235 #include <libcwd/class_continued_channel.inl>
00236 #include <libcwd/class_always_channel.inl>
00237 #include <libcwd/class_debug.inl>
00238 #include <libcwd/class_debug_string.inl>
00239 #include <libcwd/class_channel_set.inl>
00240
00241
00242 #if CWDEBUG_LOCATION // --enable-location
00243 #include <libcwd/bfd.h>
00244 #endif
00245 #include <libcwd/debugmalloc.h>
00246
00247
00248 #ifndef LIBCW_IOSTREAM
00249 #define LIBCW_IOSTREAM
00250 #include <iostream>
00251 #endif
00252
00253 #endif // CWDEBUG
00254 #endif // LIBCWD_DEBUG_H