libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
libraries_debug.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2000, 2004-2005, 2007, 2017-2018, 2020, 2023, 2026 Carlo Wood
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
13
14#ifndef LIBCWD_LIBRARIES_DEBUG_H
15#define LIBCWD_LIBRARIES_DEBUG_H
16
17#ifdef CWDEBUG
18
19#include "libcwd/config.h"
20
21// See https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_using.html#debug_mode.using.mode for more information on -D_GLIBCXX_DEBUG
22#if defined(_GLIBCXX_DEBUG) && !CWDEBUG_GLIBCXX_DEBUG
23#error Libcwd was not compiled with -D_GLIBCXX_DEBUG while your application is. Please reconfigure libcwd with --enable-glibcxx-debug.
24#endif
25#if !defined(_GLIBCXX_DEBUG) && CWDEBUG_GLIBCXX_DEBUG
26#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.
27#endif
28
29//===================================================================================================
30// The global debug channels used by libcwd.
31//
32
33#include "AlwaysChannel.h"
34#include "Channel.h"
35#include "ContinuedChannel.h"
36#include "FatalChannel.h"
37
38namespace libcwd::channels::dc {
39
40extern Channel debug;
41extern Channel notice;
42extern Channel system;
43extern Channel warning;
44#if CWDEBUG_LOCATION
45extern Channel elfutils;
46#endif
47extern FatalChannel fatal;
48extern FatalChannel core;
49extern ContinuedChannel continued;
50extern ContinuedChannel finish;
51extern AlwaysChannel always;
52
53} // namespace libcwd::channels::dc
54
55//===================================================================================================
56// The global debug object
57//
58
59#include "DebugObject.h"
60
61namespace libcwd {
62
64
77void initialize();
78
79// Called from main_reached defined in include/libcwd/config.h.in. This does further initialization.
80extern void internal_main_reached();
81// Returns true once main_reached() was called.
82extern bool test_main_reached();
83
84} // namespace libcwd
85
86//===================================================================================================
87// Macros
88//
89
90#include "macro_Libcwd_macros.h"
91
92//===================================================================================================
93// Miscellaneous
94//
95
96namespace libcwd {
97
98extern Channel* find_channel(char const* label);
99extern void list_channels_on(DebugObject& debug_object);
100
101// Make the inserter functions of std accessible in libcwd.
102using std::operator<<;
103
104} // namespace libcwd
105
106// Make the inserter functions of libcwd accessible in global namespace.
107namespace libcwd_inserters {
108using libcwd::operator<<;
109} // namespace libcwd_inserters
110using namespace libcwd_inserters;
111
112#include "attach_gdb.h"
113#include "RcFile.h"
114#include "demangle.h"
117#include "private/environ.h"
118
119// Include the inline functions.
120#include "AlwaysChannel.inl.h"
121#include "Channel.inl.h" // Debug channels.
122#include "ChannelSet.inl.h" // Used in macro Dout et al.
123#include "ContinuedChannel.inl.h"
124#include "DebugObject.inl.h" // Debug objects (DebugObject).
125#include "DebugString.inl.h" // Public member of DebugObject.
126#include "FatalChannel.inl.h"
127#include "Location.inl.h"
128
129// Include optional features.
130#if CWDEBUG_LOCATION // ‑DEnableLibcwdLocation:BOOL=ON
131#include "elfutils.h"
132#endif
133
134#endif // CWDEBUG
135#endif // LIBCWD_LIBRARIES_DEBUG_H
This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a...
Definition Channel.h:74
The Debug Object class, this object represents one output device (ostream).
Definition DebugObject.h:110
Channel notice
Definition debug.cxx:253
Channel debug
Definition debug.cxx:246
ContinuedChannel finish
Definition debug.cxx:303
Channel warning
Definition debug.cxx:271
AlwaysChannel always
Definition debug.cxx:281
FatalChannel core
Definition debug.cxx:323
FatalChannel fatal
Definition debug.cxx:313
ContinuedChannel continued
Definition debug.cxx:292
Channel elfutils
Definition dwarf.cxx:52
Channel system
Definition debug.cxx:260
Channel * find_channel(char const *label)
Find debug channel with label label.
Definition debug.cxx:1320
void list_channels_on(DebugObject &debug_object)
List all debug channels to a given debug object.
Definition debug.cxx:1355
This namespace contains the standard debug channels of libcwd.
namespace for libcwd.
void initialize()
Initialize libcwd global state before normal dynamic initialization reaches libcw_do.
Definition debug.cxx:401
DebugObject libcw_do
The default debug object.
Definition debug.cxx:222