aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/debug.h13
-rw-r--r--src/posix-io.c8
-rw-r--r--src/w32-glib-io.c4
3 files changed, 18 insertions, 7 deletions
diff --git a/src/debug.h b/src/debug.h
index ca65d9ed..ecd230f6 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -34,7 +34,11 @@
#define XSTRINGIFY(v) STRINGIFY(v)
-/* The debug levels. */
+/*
+ * The debug levels.
+ *
+ * Note that TRACE_LOGBUFX uses the current debug level + 1.
+ */
#define DEBUG_INIT 1
#define DEBUG_GLOBAL 2
@@ -211,6 +215,9 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
#define TRACE_SUC2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
+#define TRACE_SUC3(fmt, arg1, arg2, arg3) \
+ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
+ _gpgme_trace_func, arg1, arg2, arg3), _gpgme_debug_frame_end ()
#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3, arg4), \
@@ -256,6 +263,10 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
_gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \
_gpgme_trace_func, buf, len)
+#define TRACE_LOGBUFX(buf, len) \
+ _gpgme_debug_buffer (_gpgme_trace_level+1, "%s: check: %s", \
+ _gpgme_trace_func, buf, len)
+
#define TRACE_SEQ(hlp,fmt) \
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
"%s: check: %s=%p, " fmt, _gpgme_trace_func, \
diff --git a/src/posix-io.c b/src/posix-io.c
index 0448d296..322c41a8 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -117,7 +117,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
}
while (nread == -1 && errno == EINTR);
- TRACE_LOGBUF (buffer, nread);
+ TRACE_LOGBUFX (buffer, nread);
return TRACE_SYSRES (nread);
}
@@ -128,7 +128,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
int nwritten;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count);
- TRACE_LOGBUF (buffer, count);
+ TRACE_LOGBUFX (buffer, count);
do
{
@@ -785,7 +785,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)
while (nr > 0)
{
int len = nr > iov->iov_len ? iov->iov_len : nr;
- TRACE_LOGBUF (msg->msg_iov->iov_base, len);
+ TRACE_LOGBUFX (msg->msg_iov->iov_base, len);
iov++;
nr -= len;
}
@@ -816,7 +816,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags)
while (nwritten > 0)
{
int len = nwritten > iov->iov_len ? iov->iov_len : nwritten;
- TRACE_LOGBUF (msg->msg_iov->iov_base, len);
+ TRACE_LOGBUFX (msg->msg_iov->iov_base, len);
iov++;
nwritten -= len;
}
diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c
index 66dc9bf7..967c64e8 100644
--- a/src/w32-glib-io.c
+++ b/src/w32-glib-io.c
@@ -301,7 +301,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
}
if (nread != 0 && nread != -1)
- TRACE_LOGBUF (buffer, nread);
+ TRACE_LOGBUFX (buffer, nread);
errno = saved_errno;
return TRACE_SYSRES (nread);
@@ -319,7 +319,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count);
- TRACE_LOGBUF (buffer, count);
+ TRACE_LOGBUFX (buffer, count);
chan = find_channel (fd);
if (!chan)