diff options
author | David Lamparter <equinox@diac24.net> | 2021-03-02 19:33:45 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2021-11-10 12:36:50 +0100 |
commit | ef990bd94bc5e5b37214d1188915f585de1dc12a (patch) | |
tree | 2aaca9e41990c55695102405b349220d00ad9217 /lib/zlog.h | |
parent | lib: stuff xrefs into a tree for lookup (diff) | |
download | frr-ef990bd94bc5e5b37214d1188915f585de1dc12a.tar.xz frr-ef990bd94bc5e5b37214d1188915f585de1dc12a.zip |
lib: add `debug uid XXXXX-XXXXX backtrace`
Looks much prettier if `libunwind` is available, but works with glibc or
libexecinfo's `backtrace()` too.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/zlog.h')
-rw-r--r-- | lib/zlog.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/zlog.h b/lib/zlog.h index d9c8952ac..6e84fe892 100644 --- a/lib/zlog.h +++ b/lib/zlog.h @@ -54,10 +54,14 @@ struct xref_logmsg { const char *args; }; +/* whether flag was added in config mode or enable mode */ +#define LOGMSG_FLAG_EPHEMERAL (1 << 0) +#define LOGMSG_FLAG_PERSISTENT (1 << 1) + struct xrefdata_logmsg { struct xrefdata xrefdata; - /* nothing more here right now */ + uint8_t fl_print_bt; }; /* These functions are set up to write to stdout/stderr without explicit @@ -94,15 +98,19 @@ static inline void zlog_ref(const struct xref_logmsg *xref, #define _zlog_ecref(ec_, prio, msg, ...) \ do { \ - static struct xrefdata _xrefdata = { \ - .xref = NULL, \ - .uid = {}, \ - .hashstr = (msg), \ - .hashu32 = {(prio), (ec_)}, \ + static struct xrefdata_logmsg _xrefdata = { \ + .xrefdata = \ + { \ + .xref = NULL, \ + .uid = {}, \ + .hashstr = (msg), \ + .hashu32 = {(prio), (ec_)}, \ + }, \ }; \ static const struct xref_logmsg _xref __attribute__( \ (used)) = { \ - .xref = XREF_INIT(XREFT_LOGMSG, &_xrefdata, __func__), \ + .xref = XREF_INIT(XREFT_LOGMSG, &_xrefdata.xrefdata, \ + __func__), \ .fmtstring = (msg), \ .priority = (prio), \ .ec = (ec_), \ |