Permalink
Browse files

Merge iov fixes from Richard Kettlewell

  • Loading branch information...
1 parent 688c7fc commit 1d08dcf46dd4b2cfe3e27723c05b0aec9955c591 John Hughes committed Jul 10, 2001
Showing with 66 additions and 36 deletions.
  1. +7 −0 ChangeLog
  2. +0 −1 TODO
  3. +2 −0 defs.h
  4. +6 −2 io.c
  5. +1 −33 net.c
  6. +2 −0 strace.c
  7. +13 −0 syscall.c
  8. +35 −0 util.c
View
@@ -1,3 +1,10 @@
+2001-07-10 John Hughes <john@Calva.COM>
+
+ * TODO, defs.h, io.h, net.c, strace.c, syscall.c, util.c: Merge fixes
+ from Richard Kettlewell <rkettlewell@zeus.com> which add I/O dumping
+ of args to readv/writev. Also gets rid of redundant printiovec
+ routine from net.c (duplicate of tprint_iov in util.c).
+
2001-07-02 Wichert Akkerman <wakkerma@debian.org>
* config.{guess,sub}: updated
View
1 TODO
@@ -18,7 +18,6 @@ I don't like run on last close, change it?
parse long options?
count signals too with -c
treat attach, detach messages like signals
-add readv, writev to I/O dumping
add pread, pwrite to I/O dumping
add system assist for qualifiers on svr4
change printcall to getcaller and fix for linux and svr4
View
2 defs.h
@@ -376,6 +376,7 @@ extern int printflags P((struct xlat *, int));
extern int umoven P((struct tcb *, long, int, char *));
extern int umovestr P((struct tcb *, long, int, char *));
extern int upeek P((int, long, long *));
+extern void dumpiov P((struct tcb *, int, long));
extern void dumpstr P((struct tcb *, long, int));
extern void string_quote P((char *str));
extern void printstr P((struct tcb *, long, int));
@@ -397,6 +398,7 @@ extern void tabto P((int));
extern void call_summary P((FILE *));
extern void fake_execve P((struct tcb *, char *, char *[], char *[]));
extern void printtv32 P((struct tcb*, long));
+extern void tprint_iov P((struct tcb *, int, long));
#ifdef LINUX
extern int internal_clone P((struct tcb *));
View
8 io.c
@@ -33,7 +33,9 @@
#include "defs.h"
#include <fcntl.h>
+#if HAVE_SYS_UIO_H
#include <sys/uio.h>
+#endif
#ifdef HAVE_LONG_LONG_OFF_T
/*
@@ -72,11 +74,12 @@ struct tcb *tcp;
return 0;
}
+#if HAVE_SYS_UIO_H
void
tprint_iov(tcp, len, addr)
struct tcb * tcp;
int len;
-char * addr;
+long addr;
{
struct iovec *iov;
int i;
@@ -91,7 +94,7 @@ char * addr;
fprintf(stderr, "No memory");
return;
}
- if (umoven(tcp, (int) addr,
+ if (umoven(tcp, addr,
len * sizeof *iov, (char *) iov) < 0) {
tprintf("%#lx", tcp->u_arg[1]);
} else {
@@ -138,6 +141,7 @@ struct tcb *tcp;
}
return 0;
}
+#endif
#if defined(SVR4)
View
34 net.c
@@ -714,38 +714,6 @@ int addrlen;
#if HAVE_SENDMSG
static void
-printiovec(tcp, iovec, len)
-struct tcb *tcp;
-struct iovec *iovec;
-long len;
-{
- struct iovec *iov;
- int i;
-
- iov = (struct iovec *) malloc(len * sizeof *iov);
- if (iov == NULL) {
- fprintf(stderr, "No memory");
- return;
- }
- if (umoven(tcp, (long)iovec,
- len * sizeof *iov, (char *) iov) < 0) {
- tprintf("%#lx", (unsigned long)iovec);
- } else {
- tprintf("[");
- for (i = 0; i < len; i++) {
- if (i)
- tprintf(", ");
- tprintf("{");
- printstr(tcp, (long) iov[i].iov_base,
- iov[i].iov_len);
- tprintf(", %lu}", (unsigned long)iov[i].iov_len);
- }
- tprintf("]");
- }
- free((char *) iov);
-}
-
-static void
printmsghdr(tcp, addr)
struct tcb *tcp;
long addr;
@@ -760,7 +728,7 @@ long addr;
printsock(tcp, (long)msg.msg_name, msg.msg_namelen);
tprintf(", msg_iov(%lu)=", (unsigned long)msg.msg_iovlen);
- printiovec(tcp, msg.msg_iov, msg.msg_iovlen);
+ tprint_iov(tcp, msg.msg_iovlen, (long) msg.msg_iov);
#ifdef HAVE_MSG_CONTROL
tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen);
View
@@ -51,9 +51,11 @@
#ifdef SVR4
#include <sys/stropts.h>
#ifdef HAVE_MP_PROCFS
+#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#endif
+#endif
int debug = 0, followfork = 0, followvfork = 0, interactive = 0;
int rflag = 0, tflag = 0, dtime = 0, cflag = 0;
View
@@ -417,6 +417,19 @@ struct tcb *tcp;
if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE)
dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
+#ifdef SYS_readv
+ case SYS_readv:
+ if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
+ dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+ break;
+#endif
+#ifdef SYS_writev
+ case SYS_writev:
+
+ if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE)
+ dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+ break;
+#endif
}
}
View
35 util.c
@@ -38,6 +38,9 @@
#include <sys/user.h>
#include <sys/param.h>
#include <fcntl.h>
+#if HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
#ifdef SUNOS4
#include <machine/reg.h>
#include <a.out.h>
@@ -464,6 +467,38 @@ int len;
tprintf("%s", outstr);
}
+#if HAVE_SYS_UIO_H
+void
+dumpiov(tcp, len, addr)
+struct tcb * tcp;
+int len;
+long addr;
+{
+ struct iovec *iov;
+ int i;
+
+
+ if ((iov = (struct iovec *) malloc(len * sizeof *iov)) == NULL) {
+ fprintf(stderr, "dump: No memory");
+ return;
+ }
+ if (umoven(tcp, addr,
+ len * sizeof *iov, (char *) iov) >= 0) {
+
+ for (i = 0; i < len; i++) {
+ /* include the buffer number to make it easy to
+ * match up the trace with the source */
+ tprintf(" * %lu bytes in buffer %d\n",
+ (unsigned long)iov[i].iov_len, i);
+ dumpstr(tcp, (long) iov[i].iov_base,
+ iov[i].iov_len);
+ }
+ }
+ free((char *) iov);
+
+}
+#endif
+
void
dumpstr(tcp, addr, len)
struct tcb *tcp;

0 comments on commit 1d08dcf

Please sign in to comment.