libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
Runtime Configuration File (rcfile)

Using read_rcfile(). More...

Classes

class  libcwd::RcFile
 This object represents a runtime configuration file. More...

Detailed Description

In order to use attach_gdb() and/or to read debug channel states from an external file, you should call read_rcfile(), for example,

int main()
{
std::ios::sync_with_stdio(false);
Debug(main_reached());
Debug(libcw_do.on()); // In order to get RCFILE messages.
Debug(read_rcfile());
void on()
Cancel last call to off().
Definition DebugObject.inl.h:266
#define Debug(...)
Encapsulation macro for general debugging code.
Definition debug.h:69

Or better yet,

int main()
{
Debug(NAMESPACE_DEBUG::init());

which does all of the above and more. Use silent = off in your rcfile to get debug output about loading the rcfile.

At the start of every new thread you should call init_thread():

int thread_main()
{
Debug(NAMESPACE_DEBUG::init_thread());
}

read_rcfile() can be used to turn on or off debug channels, but you still have to turn on the debug object(s) (or use NAMESPACE_DEBUG::init()); in particular the debug object libcw_do that is used to print WARNING messages in case something is wrong with your rcfile.

The default rcfile is .libcwdrc (you can change that by setting the environment variable LIBCWD_RCFILE_NAME ). The application will first attempt to read this file from the current directory. If that fails then it will try to read the rcfile from the users home directory. If that fails too then it will fall back to reading ${CMAKE_INSTALL_DATADIR}/libcwd . You can use the latter as a template and/or example file for writing your own rcfile.

If the environment variable LIBCWD_RCFILE_OVERRIDE_NAME is set, it will be read after the above file where any setting overwrites a previous one. Using channels_on even once, in this file, will reset all previously turned on channels, although additional channels_on lines accumulate again.