General-Purpose Mail Filter
These functions are designed for debugging the MFL programs.
Enable debugging. The value of spec sets the debugging level. See debugging level specification, for a description of its format.
For compatibility with previous versions, this function is also available under the name ‘mailutils_set_debug_level’.
This function returns the debugging level currently in effect for the source module srcname, or the global debugging level, if called without arguments.
For example, if the program was started with --debug='all.trace5;engine.trace8' option, then:
debug_level() ⇒ 127 debug_level("engine") ⇒ 1023 debug_level("db") ⇒ 0
Returns the current state of the callout SMTP transcript. The result is 1 if the transcript is enabled and 0 otherwise. The transcript is normally enabled either by the use of the --transcript command line option (see SMTP transcript) or via the ‘transcript’ configuration statement (see transcript).
The optional value, supplies the new state for SMTP transcript. Thus, calling ‘callout_transcript(0)’ disables the transcript.
This function can be used in bracket-like fashion to enable transcript for a certain part of MFL program, e.g.:
number xstate callout_transcript(1) on poll $f do … done set xstate callout_transcript(0)
Note, that the use of this function (as well as the use of the
--transcript option) makes sense only if callouts are
performed by the
mailfromd daemon itself. It will not
work if a dedicated callout server is used for that purpose
Returns the current debugging level specification, as given by
--debug command line option or by the
statement (see conf-debug).
If the argument srcnames is specified, it is treated as a semicolon-separated list of categories for which the debugging specification is to be returned.
For example, if
mailfromd was started with
debug_spec() ⇒ "all.trace5,engine.trace8" debug_spec("all;engine") ⇒ "all.trace5,engine.trace8" debug_spec("engine;db") ⇒ "db.trace0;engine.trace8" debug_spec("prog") ⇒ ""
When called without arguments,
debug_spec returns only
those categories which have been set, as shown in the first example
Optional showunset parameters controls whether to return unset module specifications. To print all debugging specifications, whether set or not, use
These three functions are intended to complement each other. The
debug can be placed around some piece of code you wish
to debug, to enable specific debugging information for this code
fragment only. For example:
/* Save debugging level for dns.c source */ set dlev debug_spec("dns", 1) /* Set new debugging level */ debug("dns.trace8") . . . /* Restore previous level */ debug(dlev)
Enable tracing for a set of modules given in module argument. See --trace-program, for a description of its format.
Disable tracing for given modules.
This pair of functions is also designed to be used together in
a bracket-like fashion. They are useful for debugging
mailfromd, but are not advised to use otherwise, since
tracing slows down the execution considerably.
Generate a stack trace in this point. See tracing runtime errors, for the detailed description of stack traces.
The functions below are intended mainly for debugging MFL run-time
engine and for use in
mailfromd testsuite. You will hardly
need to use them in your programs.
Expands the run-time data segment by at least n words.
Returns the value of the register r at the moment of the call. Symbolic names for run-time registers are provided in the module _register:
|REG_TOS||Top of stack|
|REG_TOH||Top of heap|
|REG_MATCHSTR||Last matched string pointer|
Enters a time-consuming loop and waits there for n seconds (by
default – indefinitely). The intention is to facilitate attaching
mailfromd with the debugger. Before entering the loop,
a diagnostic message is printed on the ‘crit’ facility, informing
about the PID of the process and suggesting the command to be used to
attach to it, e.g.:
mailfromd: process 21831 is waiting for debug mailfromd: to attach: gdb -ex 'set variable mu_wd::_count_down=0' /usr/sbib/mailfromd 21831
This document was generated on January 3, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.