[neomutt-devel] debugging

Richard Russon rich at flatcap.org
Tue Sep 20 14:03:07 CEST 2016


> I finally took the time to add the feature.

Nice work.

Please can everyone give this feature a test, then let the list know how
it went.  Even if it's just: "It works for me".

> I haven't written the documentation yet. Should I add it as a completely
> new patch?

Yes, please.  The template docs are in the management repo:
    https://github.com/neomutt/management/tree/master/template-docs

Note, they'll probably get moved into the wiki, soon.

> 1. How can I compile neomutt with debug symbols? I tried setting CFLAGS,
>    but that didn't do anything...

As Elimar said:
    ./configure --enable-debug

though, this *ought* to be the same:
    make CFLAGS=-DDEBUG

I don't think DEBUG actually enables much, except the `dprint` function.

> 2. How can I send debug messages and errors? I didn't really look
>    around, but it could have helped me understanding what was going on.

The `dprint` has the strangest prototype I've ever seen:

	dprint (DEBUG_LEVEL, (DEBUG_FILE, PRINTF_STRING, ARGS...));
e.g.
    dprint (2, (debugfile, "error in the %s", name));

This will be save to the debug file (~/.muttdebug0 by default) if you
run:
    mutt -d LEVEL

Where LEVEL is 2 or above.  Each time you run `mutt -d` the debug files
are rotated:
    .muttdebug0 -> .muttdebug0
    .muttdebug1 -> .muttdebug1
    .muttdebug2 -> .muttdebug2
    .muttdebug3 -> .muttdebug3
    .muttdebug4 (deleted)

As for warning the user, there's: mutt_message() and mutt_error().
e.g.
    mutt_message (_("Authenticating (%s)..."), method);

    mutt_error (_("%s authentication failed."), method);
    mutt_sleep (0);

Note the use of the _() function to provide message translations.

After printing an error, it's usual to call mutt_sleep(NUM_SECS) to make
sure that the user notices.  If the time is set to 0, then the wait is
determined by the $sleep_time config variable.

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/mailman/private/neomutt-devel-neomutt.org/attachments/20160920/f91010f7/attachment.sig>


More information about the neomutt-devel mailing list