libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
libcwd Namespace Reference

namespace for libcwd. More...

Namespaces

namespace  channels
 The default LIBCWD_DEBUG_CHANNELS namespace.

Classes

class  buf2str
 Print a (char) buffer with a given size to a debug ostream, escaping non-printable characters. More...
class  Channel
 This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a single bit: on or off. More...
class  char2str
 Print a char to a debug ostream, escaping non-printable characters as needed. More...
struct  Indent
 Interface for marking scopes with indented debug output. More...
struct  Mark
 Interface for marking scopes with a marker character. More...
class  DebugObject
 The Debug Object class, this object represents one output device (ostream). More...
class  DebugString
 A string class used for the debug output margin and marker. More...
class  Location
 A source file location. More...
class  ObjectFileName
 An object representing the main executable or a shared library. More...
class  RcFile
 This object represents a runtime configuration file. More...
class  TypeInfo
 Class that holds type information for debugging purposes. Returned by type_info_of(). More...

Typedefs

using control_flag_t = unsigned int
using location_format_t = unsigned short int
 The type of the argument of location_format.

Enumerations

enum  continued_cf_nt { continued_cf }
 continued_cf has its own type for overloading purposes. More...

Functions

void initialize ()
 Initialize libcwd global state before normal dynamic initialization reaches libcw_do.
void core_dump ()
 Dump core of current thread.
Channelfind_channel (char const *label)
 Find debug channel with label label.
void list_channels_on (DebugObject &debug_object)
 List all debug channels to a given debug object.
void demangle_symbol (char const *input, std::string &output)
 Demangle mangled symbol name input and write the result to string output.
void demangle_type (char const *input, std::string &output)
 Demangle mangled type name input and write the result to string output.
char const * pc_mangled_function_name (void const *pc)
 Find the mangled function name of the address addr.
char const * strerrno (unsigned int err)
 Returns a pointer to a string literal that contains the usual macro name of err.
control_flag_t cond_nonewline_cf (bool cond)
 Returns nonewline_cf if cond is true.
control_flag_t cond_noprefix_cf (bool cond)
 Returns noprefix_cf if cond is true.
control_flag_t cond_nolabel_cf (bool cond)
 Returns nolabel_cf if cond is true.
control_flag_t conf_blank_margin_cf (bool cond)
 Returns blank_margin_cf if cond is true.
control_flag_t conf_blank_label_cf (bool cond)
 Returns blank_label_cf if cond is true.
control_flag_t conf_blank_marker_cf (bool cond)
 Returns blank_marker_cf if cond is true.
control_flag_t conf_cerr_cf (bool cond)
 Returns cerr_cf if cond is true.
control_flag_t conf_flush_cf (bool cond)
 Returns flush_cf if cond is true.
control_flag_t conf_wait_cf (bool cond)
 Returns wait_cf if cond is true.
control_flag_t cond_error_cf (bool cond)
 Returns error_cf if cond is true.
location_format_t location_format (location_format_t format)
 Set the output format of Location.
std::ostream & operator<< (std::ostream &os, Location const &location)
 Write location to ostream os.
void read_rcfile ()
 Calls libcwd::rcfile.read().
template<typename T>
TypeInfo const & type_info_of ()
 Get type information of a given class or type.
template<typename T>
TypeInfo const & type_info_of (T const &)
 Get type information of a given class instance.

Variables

DebugObject libcw_do
 The default debug object.
char const *const unknown_function_c = "<unknown function>"
 This constant (pointer) is returned by Location::mangled_function_name() when no function is known.
TypeInfo const unknown_type_info_c (0)
 Returned by type_info_of() for unknown types.
control_flag_t const nonewline_cf = 0x0001
 Omit the default new line at the end.
control_flag_t const noprefix_cf = 0x0002
 Omit margin, label, marker and indentation.
control_flag_t const nolabel_cf = 0x0004
 Omit label, marker and indentation.
control_flag_t const blank_margin_cf = 0x0008
 Replace margin by white space.
control_flag_t const blank_label_cf = 0x0010
 Replace label by white space.
control_flag_t const blank_marker_cf = 0x0020
 Replace marker by white space.
control_flag_t const cerr_cf = 0x0040
 Force output to be written to cerr.
control_flag_t const flush_cf = 0x0080
 Flush ostream after writing this output.
control_flag_t const wait_cf = 0x0100
 If interactive, wait till return is pressed.
control_flag_t const error_cf = 0x0200
 Append error string according to errno.
constexpr unsigned short max_label_len = 16
 The maximum number of characters that are allowed in a debug channel label.
location_format_t const show_path = 1
 Show the full source path when printing a location.
location_format_t const show_objectfile = 2
 Show the shared library or executable that owns the location.
location_format_t const show_function = 4
 Show the mangled function name for the location.

Detailed Description

The d in libcwd stands for Debugging. The cw stand for the initials of the designer/developer of this life-span project.

This namespace contains all user accessible classes, functions and variables. Things defined in this namespace belong to the libcwd API and will be supported through-out version 2.x.

Function Documentation

◆ initialize()

void libcwd::initialize ( )

This entry point is intended for constructors of user global objects that need libcwd to be usable before libcwd::libcw_do's own constructor has run. The underlying initializer is idempotent: repeated calls are allowed and only the first call constructs the global mutexes, default channels, debug object state, and optional location-support caches.

The function has process-wide side effects but does not enable libcw_do or any debug channel besides dc::warning; callers that want output must still turn on the desired debug object and channels.

◆ read_rcfile()

void libcwd::read_rcfile ( )
inline
See also
group_rcfile

References libcwd::RcFile::read().

◆ strerrno()

char const * libcwd::strerrno ( unsigned int err)

For example, strerrno(EAGAIN) returns "EAGAIN". When err is unknown then the string "UNKNOWN ERROR" is returned.

Variable Documentation

◆ libcw_do

DebugObject libcwd::libcw_do

The debug object that is used by default by Dout and DoutFatal, the only debug object used by libcwd itself.

See also
Custom Debug Objects

Referenced by libcwd::Indent::Indent(), libcwd::Mark::Mark(), and libcwd::Indent::~Indent().