core: Print a dump of the I/O data only at level 8.
* src/debug.h (TRACE_SUC3): New. (TRACE_LOGBUFX): New. * src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF. * src/w32-glib-io.c: Ditto. -- This will also be changed for w32-io as part of another commit. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
acef4f775f
commit
337c108255
13
src/debug.h
13
src/debug.h
@ -34,7 +34,11 @@
|
|||||||
#define XSTRINGIFY(v) STRINGIFY(v)
|
#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_INIT 1
|
||||||
#define DEBUG_GLOBAL 2
|
#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) \
|
#define TRACE_SUC2(fmt, arg1, arg2) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
|
_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) \
|
#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, arg1, arg2, arg3, arg4), \
|
_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_debug_buffer (_gpgme_trace_level, "%s: check: %s", \
|
||||||
_gpgme_trace_func, buf, len)
|
_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) \
|
#define TRACE_SEQ(hlp,fmt) \
|
||||||
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
|
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
|
||||||
"%s: check: %s=%p, " fmt, _gpgme_trace_func, \
|
"%s: check: %s=%p, " fmt, _gpgme_trace_func, \
|
||||||
|
@ -117,7 +117,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
|
|||||||
}
|
}
|
||||||
while (nread == -1 && errno == EINTR);
|
while (nread == -1 && errno == EINTR);
|
||||||
|
|
||||||
TRACE_LOGBUF (buffer, nread);
|
TRACE_LOGBUFX (buffer, nread);
|
||||||
return TRACE_SYSRES (nread);
|
return TRACE_SYSRES (nread);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
|
|||||||
int nwritten;
|
int nwritten;
|
||||||
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd,
|
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd,
|
||||||
"buffer=%p, count=%u", buffer, count);
|
"buffer=%p, count=%u", buffer, count);
|
||||||
TRACE_LOGBUF (buffer, count);
|
TRACE_LOGBUFX (buffer, count);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -785,7 +785,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)
|
|||||||
while (nr > 0)
|
while (nr > 0)
|
||||||
{
|
{
|
||||||
int len = nr > iov->iov_len ? iov->iov_len : nr;
|
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++;
|
iov++;
|
||||||
nr -= len;
|
nr -= len;
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags)
|
|||||||
while (nwritten > 0)
|
while (nwritten > 0)
|
||||||
{
|
{
|
||||||
int len = nwritten > iov->iov_len ? iov->iov_len : nwritten;
|
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++;
|
iov++;
|
||||||
nwritten -= len;
|
nwritten -= len;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nread != 0 && nread != -1)
|
if (nread != 0 && nread != -1)
|
||||||
TRACE_LOGBUF (buffer, nread);
|
TRACE_LOGBUFX (buffer, nread);
|
||||||
|
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return TRACE_SYSRES (nread);
|
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,
|
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd,
|
||||||
"buffer=%p, count=%u", buffer, count);
|
"buffer=%p, count=%u", buffer, count);
|
||||||
TRACE_LOGBUF (buffer, count);
|
TRACE_LOGBUFX (buffer, count);
|
||||||
|
|
||||||
chan = find_channel (fd);
|
chan = find_channel (fd);
|
||||||
if (!chan)
|
if (!chan)
|
||||||
|
Loading…
Reference in New Issue
Block a user