[neomutt-devel] Quick Vote: Debugging Aids

Richard Russon rich at flatcap.org
Tue Aug 29 13:05:45 CEST 2017


Hi guys,

I've a couple of things for quick discussion...
If they're liked, we can discuss them more fully in an issue.

---
* Turn mutt_debug() into a macro.

Change the proto (abbrev) from:
    void mutt_debug(level, fmt, ...);
to
    void _mutt_debug(file, line, func, level, fmt, ...);

add macro
    #define mutt_debug(l,f,...) _mutt_debug(__FILE__, __LINE__, __func__, l, f, ...)

then I'd suggest:
    debug level 1,2: brief log messages (as normal)
    debug level >2:  full details for every line

This could be an 'easy' task

VOTE: mutt_debug() macro
    * Yes
    * No
    * Don't know

---

* assert()/bug_on()

We have lots of checks:
    if (!ptr)
        return;

I propose replacing them with a macro:
    return_if_fail(ptr);
    return_val_if_fail(ptr, false);

With DEBUG enabled, they log the file,line,func,test.
Otherwise, they just return as normal.

Note: glibc has a backtrace() function which could be used here.

VOTE: assert-like macro
    * Yes
    * No
    * Don't know

---

Cheers,
    Rich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20170829/6b4b8112/attachment.sig>


More information about the neomutt-devel mailing list