diff --git a/drivers/pipe_common.c b/drivers/pipe_common.c index 174778d6d0119ee61137c554c1728401edfabb28..a0fd00b7a46b03b1a8a2189ea91bbcb5a92f5232 100644 --- a/drivers/pipe_common.c +++ b/drivers/pipe_common.c @@ -60,9 +60,19 @@ #if CONFIG_DEV_PIPE_SIZE > 0 /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ +/* CONFIG_DEV_PIPEDUMP will dump the contents of each transfer into and out + * of the pipe. + */ + +#ifdef CONFIG_DEV_PIPEDUMP +# define pipe_dumpbuffer(m,a,n) lib_dumpbuffer(m,a,n) +#else +# define pipe_dumpbuffer(m,a,n) +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -319,6 +329,9 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len) { struct inode *inode = filep->f_inode; struct pipe_dev_s *dev = inode->i_private; +#ifdef CONFIG_DEV_PIPEDUMP + FAR ubyte *start = (ubyte*)buffer; +#endif ssize_t nread = 0; int sval; int ret; @@ -396,6 +409,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len) pipecommon_pollnotify(dev, POLLOUT); sem_post(&dev->d_bfsem); + pipe_dumpbuffer("From PIPE:", start, nread); return nread; } @@ -413,12 +427,14 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t int sval; /* Some sanity checking */ + #if CONFIG_DEBUG if (!dev) { return -ENODEV; } #endif + pipe_dumpbuffer("To PIPE:", (ubyte*)buffer, len); /* At present, this method cannot be called from interrupt handlers. That is * because it calls sem_wait (via pipecommon_semtake below) and sem_wait cannot diff --git a/netutils/thttpd/thttpd_cgi.c b/netutils/thttpd/thttpd_cgi.c index 27ec2a267bc49be08ce368d5e2c0f4d860b92c31..7624bd22eb9287962048956726eb09ad41db3551 100755 --- a/netutils/thttpd/thttpd_cgi.c +++ b/netutils/thttpd/thttpd_cgi.c @@ -70,9 +70,9 @@ /* CONFIG_THTTPD_CGIDUMP will dump the contents of each transfer to and from the CGI task. */ #ifdef CONFIG_THTTPD_CGIDUMP -# define cgi_dumppacket(m,a,n) lib_dumpbuffer(m,a,n) +# define cgi_dumpbuffer(m,a,n) lib_dumpbuffer(m,a,n) #else -# define cgi_dumppacket(m,a,n) +# define cgi_dumpbuffer(m,a,n) #endif /**************************************************************************** @@ -390,7 +390,7 @@ static inline int cgi_interpose_input(struct cgi_conn_s *cc) lldbg("httpd_write failed\n"); return 1; } - cgi_dumppacket("Sent to CGI:", cc->inbuf.buffer, nbytes_written); + cgi_dumpbuffer("Sent to CGI:", cc->inbuf.buffer, nbytes_written); } cc->inbuf.nbytes += nbytes_read; @@ -472,7 +472,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc) } else { - cgi_dumppacket("Received from CGI:", cc->inbuf.buffer, nbytes_read); + cgi_dumpbuffer("Received from CGI:", cc->inbuf.buffer, nbytes_read); } } while (nbytes_read < 0);