summaryrefslogtreecommitdiff
path: root/lib/debug.h
AgeCommit message (Collapse)Author
2024-08-27lib: common debug status outputIgor Ryzhov
Implement common code for debug status output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-08-27lib: common debug config outputIgor Ryzhov
Implement common code for debug config output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-08-27lib: rework debug initIgor Ryzhov
The debug library allows to register a `debug_set_all` callback which should enable all debugs in a daemon. This callback is implemented exactly the same in each daemon. Instead of duplicating the code, rework the lib to allow registration of each debug type, and implement the common code only once in the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-03-17*: require semicolon after DEFINE_<typesafe...>David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-05-28lib: Separate out the debug_init apiDonald Sharp
Separate out the debug_init api to have 2 functions: 1) Function to register a callback 2) Function to initiate the cli. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-28lib: Make the debug callbacks a list of callbacksDonald Sharp
Allow multiple callers to initialize themselves to receive callbacks for debug on/off operations. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-11lib: add extern "C" {} blocks to all libfrr headersRenato Westphal
These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11lib: make atomic ops C++ compatibleDavid Lamparter
C++ doesn't have ISO C11 stdatomic.h or "_Atomic inttype", so use std::atomic instead to get the headers compatible. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-03-12lib: add convenience debugging macrosQuentin Young
* Add DEBUG*() macros This set of macros allows you to write printf-like debugging lines that automatically check whether a debug is on before printing. This should eliminate the need for explicit checks in simple cases. For example: if (SUCH_AND_SUCH_DEBUG_IS_ON) { zlog_warn(...); } Becomes: DEBUG(warn, such_and_such, ...); Or, equivalently, DEBUGE(such_and_such, ...); The levels passed to DEBUG are expanded into the names of zlog_* functions, so the same zlog levels are available. There's also a set of macros that have the level built into them; DEBUGE for errors, DEBUGW for warnings, etc. Good for brevity. * Add singular setting macros Change the 'SET' macros to accept a boolean indicating whether the provided bits should be set or unset, and map on/off macros to them. Helps condense code where you already have a boolean condition that tells you what you want to do as you can avoid writing the branch. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-01lib: add mt-safe debugging facilitiesQuentin Young
The current strategy for fine-grained debugging across FRR is to use static long int bitfields, in combination with helper macros that are copy-pasted between daemons, to hold state on what debugging information should be collected at any given time. This has a couple of problems: * These bitfields are generally extern'd and accessed everywhere, so they are not MT-safe or easy to make MT-safe * Lots of code duplication from copy-pasting the DEBUG_* macros... * Code duplication because of the "term" vs "conf" debugging concept This patch aims to remedy that by providing some infrastructure to work with debugs. The core concept of using bitfields has been retained, but the number of these for each debug has been reduced to 1. This allows easy use of lock-free methods for synchronizing access to debugging info. The helper macros have also been retained but they are now collected in one place and perform exclusively atomic operations. Finally there is a bit of code that allows daemons to register callbacks, which I used to implement a command that will toggle all debugging for any daemons that use these facilities. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2004-11-262004-11-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* debug.[ch]: Remove unused files. * Makefile.am: Remove references to debug.c and debug.h * ospf_main.c: Remove #include "debug.h" (was not being used, and lib/debug.h has now been deleted).
2003-06-04Paul Jakma:paul
lib/debug.{c,h}: glibc backtrace printing function (from the glibc info page) configure.ac: check for glibc backtrace and set define lib/zebra.h: glibc backtrace support