diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-27 11:08:30 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-08-21 03:20:58 +0300 |
commit | de2368d8839490c9b20a46ae5ef508df710cd9d0 (patch) | |
tree | 8fef19721595c08ad3c711aad45d8be877772c45 /mfd/prog.c | |
parent | 6a78ff620015e0fdc517e804fee85177976da7db (diff) | |
download | mailfromd-de2368d8839490c9b20a46ae5ef508df710cd9d0.tar.gz mailfromd-de2368d8839490c9b20a46ae5ef508df710cd9d0.tar.bz2 |
Redo debugging support in the library.
* mfd/debug.c: Moved to lib/debug.c.
* mfd/debug.hin: Renamed to lib/debug.h.
Removed calls to m4 macros.
(__debug, debug): New macros.
(debug_locus): New proto.
* mfd/debugdef.m4: Remove.
* mfd/modlist.cin: Remove.
* lib/Makefile.am: Update.
* lib/libmf.h (TYPE_SIGNED, INT_STRLEN_BOUND)
(INT_BUFSIZE_BOUND, NUMERIC_BUFSIZE_BOUND): New defines (from mailfromd.h)
(argp): Forward declaration of the struct.
* mfd/.gitignore: Update.
* mfd/Makefile.am (mailfromd_SOURCES): Remove debug.c and
modlist.c.
(noinst_HEADERS): Remove debug.h, add mfd-dbgmod.h.
(EXTRA_DIST): Remove debug.hin, debugdef.m4, modlist.cin and module.list.
Add dbgmod.awk.
(BUILT_SOURCES): Likewise.
(SUFFIXES): Remove .hin
(mfd-dbgmod.h): New goal.
(module.list, debug.h, modlist.c): Remove goals.
(.cin.c, .hin.h): Remove rules.
* mfd/dbgmod.awk: New file.
* mfd/builtin/snarf.m4: Change default divertion to #2.
(MF_INIT): Undivert everything here.
(MF_DEBUG): New macro.
* mfd/builtin/db.bi: Use MF_DEBUG instead of debug.
* mfd/builtin/io.bi: Likewise.
* mfd/builtin/mbox.bi: Likewise.
* mfd/builtin/other.bi: Likewise.
* mfd/builtin/sa.bi: Likewise.
* mfd/mailfromd.h (getmaxfd): Remove (already defined in libmf.h)
Include mfd-dbgmod.h
* mfd/main.c (vformat_logmsg, format_logmsg)
(format_log_si): New statics.
(debug_locus): New function.
(debug_log): Rewrite.
(modnames): New variable.
(main): Call debug_init.
* mfd/*.c: Remove definitions of MF_SOURCE_NAME.
Use debug() macro uniformly.
* po/POTFILES.in: Update.
Diffstat (limited to 'mfd/prog.c')
-rw-r--r-- | mfd/prog.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -14,8 +14,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define MF_SOURCE_NAME MF_SOURCE_PROG - #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -596,9 +594,10 @@ push(eval_environ_t env, STKVAL val) runtime_error(env, "INTERNAL ERROR at %s:%d, please report", __FILE__, __LINE__); if (env->tos == env->toh) { - debug2(100, "tos=%lu, toh=%lu", + debug(MF_SOURCE_PROG, 100, + ("tos=%lu, toh=%lu", (unsigned long) env->tos, - (unsigned long) env->toh); + (unsigned long) env->toh)); expand_dataseg(env, 1, _("out of stack space; increase #pragma stacksize")); } @@ -821,10 +820,11 @@ instr_stkalloc(eval_environ_t env) if (PROG_TRACE_ENGINE) prog_trace(env, "STKALLOC %p", n); if (env->tos - n < env->toh) { - debug3(100, "tos=%lu, toh=%lu, delta=%u", + debug(MF_SOURCE_PROG, 100, + ("tos=%lu, toh=%lu, delta=%u", (unsigned long) env->tos, (unsigned long) env->toh, - n); + n)); expand_dataseg(env, env->toh - (env->tos - n), _("Out of stack space; increase #pragma stacksize")); } @@ -1716,12 +1716,12 @@ instr_saveex(eval_environ_t env) advance_pc(env, 1); for (i = 0; i < count * NBMBITS; i++) if (((bitmask_bits_t)tab[BIT_WORD(i)]) & BIT_MASK(i)) { - debug5(101, - "Push Exception: %d %lu <- pc=%lu, tos=%lu, base=%lu", + debug(MF_SOURCE_PROG, 101, + ("Push Exception: %d %lu <- pc=%lu, tos=%lu, base=%lu", i, (unsigned long) TOS_INVARIANT(env,env->tos), (unsigned long) env->catch_ctx[i].pc, (unsigned long) env->catch_ctx[i].tos, - (unsigned long) env->catch_ctx[i].base); + (unsigned long) env->catch_ctx[i].base)); push(env, (STKVAL) env->catch_ctx[i].pc); push(env, (STKVAL) env->catch_ctx[i].tos); push(env, (STKVAL) env->catch_ctx[i].base); @@ -1761,12 +1761,12 @@ instr_restex(eval_environ_t env) env->catch_ctx[i].base = (prog_counter_t) pop(env); env->catch_ctx[i].tos = (prog_counter_t) pop(env); env->catch_ctx[i].pc = (prog_counter_t) pop(env); - debug5(102, - "Pop Exception: %d %lu -> pc=%lu, tos=%lu, base=%lu", + debug(MF_SOURCE_PROG, 102, + ("Pop Exception: %d %lu -> pc=%lu, tos=%lu, base=%lu", i, (unsigned long) TOS_INVARIANT(env,env->tos), (unsigned long) env->catch_ctx[i].pc, (unsigned long) env->catch_ctx[i].tos, - (unsigned long) env->catch_ctx[i].base); + (unsigned long) env->catch_ctx[i].base)); } } while (i > 0); } |