void _gpgme_debug_end (void **helper);
void _gpgme_debug_buffer (int lvl, const char *const fmt,
- const char *const func, const char *const tagname,
- const void *const tag, const char *const buffer,
+ const char *const func, const char *const buffer,
size_t len);
+void _gpgme_debug_frame_begin (void);
+void _gpgme_debug_frame_end (void);
+
+
\f
/* Trace support. */
int _gpgme_trace_level = lvl; \
const char *const _gpgme_trace_func = name; \
const char *const _gpgme_trace_tagname = STRINGIFY (tag); \
- void *_gpgme_trace_tag = (void *) (uintptr_t) tag
+ void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \
+ _gpgme_debug_frame_begin ()
#define TRACE_BEG(lvl, name, tag) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_BEG0(lvl, name, tag, fmt) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1), 0
#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2), 0
#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3), 0
#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4), 0
#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4, arg5, \
arg6, arg7), 0
#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7, arg8) \
_TRACE (lvl, name, tag); \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
+ _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, arg8), 0
#define TRACE(lvl, name, tag) \
- _gpgme_debug (lvl, "[%s=%p] %s: call\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
+ _gpgme_debug_frame_end (), 0
#define TRACE0(lvl, name, tag, fmt) \
- _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
+ _gpgme_debug_frame_end (), 0
#define TRACE1(lvl, name, tag, fmt, arg1) \
- _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), \
+ _gpgme_debug_frame_end (), 0
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
- _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
- arg2), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
+ arg2), _gpgme_debug_frame_end (), 0
#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \
- _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
- arg2, arg3), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
+ arg2, arg3), _gpgme_debug_frame_end (), 0
#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
- _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
- STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
- arg2, arg3, arg4, arg5, arg6), 0
+ _gpgme_debug_frame_begin (), \
+ _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
+ name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
+ arg2, arg3, arg4, arg5, arg6), \
+ _gpgme_debug_frame_end (), 0
#define TRACE_ERR(err) \
err == 0 ? (TRACE_SUC ()) : \
- (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s <%s>\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
+ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s <%s>\n", \
_gpgme_trace_func, gpgme_strerror (err), \
- gpgme_strsource (err)), (err))
+ gpgme_strsource (err)), _gpgme_debug_frame_end (), (err))
/* The cast to void suppresses GCC warnings. */
#define TRACE_SYSRES(res) \
res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
- (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, strerror (errno)), (res))
+ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
+ _gpgme_trace_func, strerror (errno)), _gpgme_debug_frame_end (), (res))
#define TRACE_SYSERR(res) \
res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
- (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, strerror (res)), (res))
+ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
+ _gpgme_trace_func, strerror (res)), \
+ _gpgme_debug_frame_end (), (res))
#define TRACE_SUC() \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: leave\n", \
+ _gpgme_trace_func), _gpgme_debug_frame_end (), 0
#define TRACE_SUC0(fmt) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
+ _gpgme_trace_func), _gpgme_debug_frame_end (), 0
#define TRACE_SUC1(fmt, arg1) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
+ _gpgme_trace_func, arg1), _gpgme_debug_frame_end (), 0
#define TRACE_SUC2(fmt, arg1, arg2) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
+ _gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end (), 0
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
+ _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
+ _gpgme_debug_frame_end (), 0
#define TRACE_LOG(fmt) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_LOG1(fmt, arg1) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1), 0
#define TRACE_LOG2(fmt, arg1, arg2) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2), 0
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3), 0
#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4), 0
#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
- _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
+ _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
+ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
+ arg1, arg2, arg3, arg4, arg5, \
arg6), 0
-#define TRACE_LOGBUF(buf, len) \
- _gpgme_debug_buffer (_gpgme_trace_level, "[%s=%p] %s: check: %s", \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
+#define TRACE_LOGBUF(buf, len) \
+ _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \
_gpgme_trace_func, buf, len)
#define TRACE_SEQ(hlp,fmt) \
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
- "[%s=%p] %s: check: " fmt, \
- _gpgme_trace_tagname, _gpgme_trace_tag, \
- _gpgme_trace_func)
+ "%s: check: %s=%p, " fmt, _gpgme_trace_func, \
+ _gpgme_trace_tagname, _gpgme_trace_tag)
#define TRACE_ADD0(hlp,fmt) \
_gpgme_debug_add (&(hlp), fmt)
#define TRACE_ADD1(hlp,fmt,a) \