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

libraries_debug.h
Go to the documentation of this file.
1 // $Header$
2 //
3 // Copyright (C) 2000 - 2004, by
4 //
5 // Carlo Wood, Run on IRC <carlo@alinoe.com>
6 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
7 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
8 //
9 // This file may be distributed under the terms of the Q Public License
10 // version 1.0 as appearing in the file LICENSE.QPL included in the
11 // packaging of this file.
12 //
13 
22 #ifndef LIBCWD_LIBRARIES_DEBUG_H
23 #define LIBCWD_LIBRARIES_DEBUG_H
24 
25 #ifdef CWDEBUG
26 
27 #include "config.h"
28 
29 // See http://gcc.gnu.org/onlinedocs/libstdc++/debug.html for more information on -D_GLIBCXX_DEBUG
30 #if defined(_GLIBCXX_DEBUG) && !CWDEBUG_GLIBCXX_DEBUG
31 #error Libcwd was not compiled with -D_GLIBCXX_DEBUG while your application is. Please reconfigure libcwd with --enable-glibcxx-debug.
32 #endif
33 #if !defined(_GLIBCXX_DEBUG) && CWDEBUG_GLIBCXX_DEBUG
34 #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.
35 #endif
36 
37 //===================================================================================================
38 // The global debug channels used by libcwd.
39 //
40 
41 #include "class_channel.h"
42 #include "class_fatal_channel.h"
44 #include "class_always_channel.h"
45 
46 namespace libcwd {
47 
48 namespace channels {
49 
57  namespace dc {
58  extern channel_ct debug;
59  extern channel_ct notice;
60  extern channel_ct system;
61  extern channel_ct warning;
62 #if CWDEBUG_ALLOC
63 #ifdef LIBCWD_USE_EXTERNAL_C_LINKAGE_FOR_MALLOC
64  extern channel_ct malloc;
65 #else
66  extern channel_ct __libcwd_malloc;
67 #endif
68 #else // !CWDEBUG_ALLOC
69  extern channel_ct malloc;
70 #endif
71 #if CWDEBUG_LOCATION
72  extern channel_ct bfd;
73 #endif
74  extern fatal_channel_ct fatal;
75  extern fatal_channel_ct core;
76  extern continued_channel_ct continued;
77  extern continued_channel_ct finish;
78  extern always_channel_ct always;
79 
80  } // namespace dc
81 } // namespace channels
82 
83 } // namespace libcwd
84 
85 
86 //===================================================================================================
87 // The global debug object
88 //
89 
90 #include "class_debug.h"
91 
92 namespace libcwd {
93 
94 extern debug_ct libcw_do;
95 
96 } // namespace libcwd
97 
98 //===================================================================================================
99 // Macros
100 //
101 
102 #include "macro_Libcwd_macros.h"
103 
104 // For use in (libcwd) library header files: do not redefine these!
105 // Developers of libraries are recommended to define their own macro names,
106 // see "Libraries" on reference-manual/group__chapter__custom__debug__h.html
107 #define __Debug(STATEMENTS...) \
108  LibcwDebug(::libcwd::channels, STATEMENTS)
109 #define __Dout(cntrl, data) \
110  LibcwDout(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
111 #define __DoutFatal(cntrl, data) \
112  LibcwDoutFatal(::libcwd::channels, ::libcwd::libcw_do, cntrl, data)
113 
114 //===================================================================================================
115 // Miscellaneous
116 //
117 
118 namespace libcwd {
119 
120 extern channel_ct* find_channel(char const* label);
121 extern void list_channels_on(debug_ct& debug_object);
122 
123 // Make the inserter functions of std accessible in libcwd.
124 using std::operator<<;
125 
126 } // namespace libcwd
127 
128 // Make the inserter functions of libcwd accessible in global namespace.
129 namespace libcwd_inserters {
130  using libcwd::operator<<;
131 } // namespace libcwd_inserters
132 using namespace libcwd_inserters;
133 
136 #include "private_environ.h"
137 #include "class_rcfile.h"
138 #include "attach_gdb.h"
139 #include "demangle.h"
140 
141 // Include the inline functions.
142 #include "private_allocator.inl" // Implementation of allocator_adaptor template.
143 #include "class_channel.inl" // Debug channels.
144 #include "class_fatal_channel.inl"
145 #include "class_continued_channel.inl"
146 #include "class_always_channel.inl"
147 #include "class_debug.inl" // Debug objects (debug_ct).
148 #include "class_debug_string.inl" // Public member of debug_ct.
149 #include "class_channel_set.inl" // Used in macro Dout et al.
150 #include "class_location.inl"
151 
152 // Include optional features.
153 #if CWDEBUG_LOCATION // --enable-location
154 #include "bfd.h"
155 #endif
156 #include "debugmalloc.h" // --enable-alloc
157 
158 #endif // CWDEBUG
159 #endif // LIBCWD_LIBRARIES_DEBUG_H
160 
channel_ct system
Definition: debug.cc:467
channel_ct malloc
Definition: debug.cc:474
channel_ct bfd
Definition: bfd.cc:92
continued_channel_ct finish
Definition: debug.cc:517
fatal_channel_ct fatal
Definition: debug.cc:527
channel_ct notice
Definition: debug.cc:460
continued_channel_ct continued
Definition: debug.cc:506
channel_ct debug
Definition: debug.cc:453
always_channel_ct always
Definition: debug.cc:495
fatal_channel_ct core
Definition: debug.cc:537
channel_ct warning
Definition: debug.cc:485
channel_ct * find_channel(char const *label)
Find debug channel with label label.
Definition: debug.cc:1528
void list_channels_on(debug_ct &debug_object)
List all debug channels to a given debug object.
Definition: debug.cc:1575
namespace for libcwd.
Definition: debug.cc:87
debug_ct libcw_do
The default debug object.
Definition: debug.cc:429
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.