Send debugging output to stderr.

This commit is contained in:
Alexandre Julliard 1999-01-01 17:04:42 +00:00
parent 6ebbe3c949
commit 502055ffc1
1 changed files with 15 additions and 15 deletions

View File

@ -85,37 +85,37 @@ void trace_request( enum request req, void *data, int len, int fd )
{ {
int size; int size;
current->last_req = req; current->last_req = req;
printf( "%08x: %s(", (unsigned int)current, req_names[req] ); fprintf( stderr, "%08x: %s(", (unsigned int)current, req_names[req] );
size = dumpers[req].dump_req( data, len ); size = dumpers[req].dump_req( data, len );
if ((len -= size) > 0) if ((len -= size) > 0)
{ {
unsigned char *ptr = (unsigned char *)data + size; unsigned char *ptr = (unsigned char *)data + size;
while (len--) printf( ", %02x", *ptr++ ); while (len--) fprintf( stderr, ", %02x", *ptr++ );
} }
if (fd != -1) printf( " ) fd=%d\\n", fd ); if (fd != -1) fprintf( stderr, " ) fd=%d\\n", fd );
else printf( " )\\n" ); else fprintf( stderr, " )\\n" );
} }
void trace_timeout(void) void trace_timeout(void)
{ {
printf( "%08x: *timeout*\\n", (unsigned int)current ); fprintf( stderr, "%08x: *timeout*\\n", (unsigned int)current );
} }
void trace_kill( int exit_code ) void trace_kill( int exit_code )
{ {
printf( "%08x: *killed* exit_code=%d\\n", fprintf( stderr,"%08x: *killed* exit_code=%d\\n",
(unsigned int)current, exit_code ); (unsigned int)current, exit_code );
} }
void trace_reply( struct thread *thread, int type, int pass_fd, void trace_reply( struct thread *thread, int type, int pass_fd,
struct iovec *vec, int veclen ) struct iovec *vec, int veclen )
{ {
if (!thread) return; if (!thread) return;
printf( "%08x: %s() = %d", fprintf( stderr, "%08x: %s() = %d",
(unsigned int)thread, req_names[thread->last_req], type ); (unsigned int)thread, req_names[thread->last_req], type );
if (veclen) if (veclen)
{ {
printf( " {" ); fprintf( stderr, " {" );
if (dumpers[thread->last_req].dump_reply) if (dumpers[thread->last_req].dump_reply)
{ {
dumpers[thread->last_req].dump_reply( vec->iov_base ); dumpers[thread->last_req].dump_reply( vec->iov_base );
@ -126,12 +126,12 @@ void trace_reply( struct thread *thread, int type, int pass_fd,
{ {
unsigned char *ptr = vec->iov_base; unsigned char *ptr = vec->iov_base;
int len = vec->iov_len; int len = vec->iov_len;
while (len--) printf( ", %02x", *ptr++ ); while (len--) fprintf( stderr, ", %02x", *ptr++ );
} }
printf( " }" ); fprintf( stderr, " }" );
} }
if (pass_fd != -1) printf( " fd=%d\\n", pass_fd ); if (pass_fd != -1) fprintf( stderr, " fd=%d\\n", pass_fd );
else printf( "\\n" ); else fprintf( stderr, "\\n" );
} }
EOF EOF
@ -240,7 +240,7 @@ sub DO_DUMP_FUNC
{ {
my $type = shift; my $type = shift;
my $var = shift; my $var = shift;
print TRACE " printf( \" $var=$formats{$type}"; print TRACE " fprintf( stderr, \" $var=$formats{$type}";
print TRACE "," if ($#_ > 0); print TRACE "," if ($#_ > 0);
print TRACE "\", "; print TRACE "\", ";
if ($type =~ s/\[0\]$//g) # vararg type? if ($type =~ s/\[0\]$//g) # vararg type?