libcwd: The C++ Debugging Support Library - Reference Manual
Author: Carlo Wood
Description: C++ debugging support library with ostream debug output
Keywords: libcwd, debug output, debug facility, debug channel, object orientation, OO, C++, nested debug output, ostream, memory allocation, debugging, source file and line number

Main Page Reference Manual Namespace List Compound List Namespace Members Compound Members File Members

# libcwd/libraries_debug.h

Go to the documentation of this file.

    00001 // $Header$
    00002 //
    00003 // Copyright (C) 2000 - 2004, by
    00004 //
    00005 // Carlo Wood, Run on IRC <carlo@alinoe.com>
    00006 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
    00007 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
    00008 //
    00009 // This file may be distributed under the terms of the Q Public License
    00010 // version 1.0 as appearing in the file LICENSE.QPL included in the
    00011 // packaging of this file.
    00012 //
    00013
    00022 #ifndef LIBCWD_LIBRARIES_DEBUG_H
    00023 #define LIBCWD_LIBRARIES_DEBUG_H
    00024
    00025 #ifdef CWDEBUG
    00026
    00027 #include <libcwd/config.h>
    00028
    00029 // See http://gcc.gnu.org/onlinedocs/libstdc++/debug.html for more information on -D_GLIBCXX_DEBUG
    00030 #if defined(_GLIBCXX_DEBUG) && !CWDEBUG_GLIBCXX_DEBUG
    00031 #error Libcwd was not compiled with -D_GLIBCXX_DEBUG while your application is. Please reconfigure libcwd with --enable-glibcxx-debug.
    00032 #endif
    00033 #if !defined(_GLIBCXX_DEBUG) && CWDEBUG_GLIBCXX_DEBUG
    00034 #error Libcwd was compiled with -D_GLIBCXX_DEBUG but your application is not. Please reconfigure libcwd without --enable-glibcxx-debug or use -D_GLIBCXX_DEBUG.
    00035 #endif
    00036
    00037 //===================================================================================================
    00038 // The global debug channels used by libcwd.
    00039 //
    00040
    00041 #include <libcwd/class_channel.h>
    00042 #include <libcwd/class_fatal_channel.h>
    00043 #include <libcwd/class_continued_channel.h>
    00044 #include <libcwd/class_always_channel.h>
    00045
    00046 namespace libcwd {
    00047
    00048 namespace channels {
    00049
    00057   namespace dc {
    00058     extern channel_ct debug;
    00059     extern channel_ct notice;
    00060     extern channel_ct system;
    00061     extern channel_ct warning;
    00062 #if CWDEBUG_ALLOC
    00063 #ifdef LIBCWD_USE_EXTERNAL_C_LINKAGE_FOR_MALLOC
    00064     extern channel_ct malloc;
    00065 #else
    00066     extern channel_ct __libcwd_malloc;
    00067 #endif
    00068 #else // !CWDEBUG_ALLOC
    00069     extern channel_ct malloc;
    00070 #endif
    00071 #if CWDEBUG_LOCATION
    00072     extern channel_ct bfd;
    00073 #endif
    00074     extern fatal_channel_ct fatal;
    00075     extern fatal_channel_ct core;
    00076     extern continued_channel_ct continued;
    00077     extern continued_channel_ct finish;
    00078     extern always_channel_ct always;
    00079
    00080   } // namespace dc
    00081 } // namespace channels
    00082
    00083 } // namespace libcwd
    00084
    00085
    00086 //===================================================================================================
    00087 // The global debug object
    00088 //
    00089
    00090 #include <libcwd/class_debug.h>
    00091
    00092 namespace libcwd {
    00093
    00094 extern debug_ct libcw_do;
    00095
    00096 } // namespace libcwd
    00097
    00098 //===================================================================================================
    00099 // Macros
    00100 //
    00101
    00102 #include <libcwd/macro_Libcwd_macros.h>
    00103
    00104 // For use in (libcwd) library header files: do not redefine these!
    00105 // Developers of libraries are recommended to define their own macro names,
    00106 // see "Libraries" on reference-manual/group__chapter__custom__debug__h.html
    00107 #define __Debug(x) \
    00108     LibcwDebug(::libcwd::channels, x)
    00109 #define __Dout(cntrl, data) \
    00110     LibcwDout(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
    00111 #define __DoutFatal(cntrl, data) \
    00112     LibcwDoutFatal(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
    00113
    00114 //===================================================================================================
    00115 // Miscellaneous
    00116 //
    00117
    00118 namespace libcwd {
    00119
    00120 extern channel_ct* find_channel(char const* label);
    00121 extern void list_channels_on(debug_ct& debug_object);
    00122
    00123 // Make the inserter functions of std accessible in libcwd.
    00124 using std::operator<<;
    00125
    00126 } // namespace libcwd
    00127
    00128 // Make the inserter functions of libcwd accessible in global namespace.
    00129 namespace libcwd_inserters {
    00130   using libcwd::operator<<;
    00131 } // namespace libcwd_inserters
    00132 using namespace libcwd_inserters;
    00133
    00134 #include <libcwd/macro_ForAllDebugChannels.h>
    00135 #include <libcwd/macro_ForAllDebugObjects.h>
    00136 #include <libcwd/private_environ.h>
    00137 #include <libcwd/class_rcfile.h>
    00138 #include <libcwd/attach_gdb.h>
    00139 #include <libcwd/demangle.h>
    00140
    00141 // Include the inline functions.
    00142 #include <libcwd/private_allocator.inl>         // Implementation of allocator_adaptor template.
    00143 #include <libcwd/class_channel.inl>             // Debug channels.
    00144 #include <libcwd/class_fatal_channel.inl>
    00145 #include <libcwd/class_continued_channel.inl>
    00146 #include <libcwd/class_always_channel.inl>
    00147 #include <libcwd/class_debug.inl>               // Debug objects (debug_ct).
    00148 #include <libcwd/class_debug_string.inl>        // Public member of debug_ct.
    00149 #include <libcwd/class_channel_set.inl>         // Used in macro Dout et al.
    00150 #include <libcwd/class_location.inl>
    00151
    00152 // Include optional features.
    00153 #if CWDEBUG_LOCATION                            // --enable-location
    00154 #include <libcwd/bfd.h>
    00155 #endif
    00156 #include <libcwd/debugmalloc.h>                 // --enable-alloc
    00157
    00158 #endif // CWDEBUG
    00159 #endif // LIBCWD_LIBRARIES_DEBUG_H
    00160