]> granicus.if.org Git - strace/commitdiff
Print unfetchable address in poll and ppoll decoders
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 16 Feb 2016 00:04:37 +0000 (00:04 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 16 Feb 2016 01:35:36 +0000 (01:35 +0000)
* poll.c (decode_poll_entering): Replace umove call with
umove_or_printaddr.
(decode_poll_exiting): Print unfetchable address when umove call fails.

poll.c

diff --git a/poll.c b/poll.c
index 4c3f19ead995d2ffbaf0b5ac71ddd45073be2f89..9dcaae22491b3cc14f81c84a926a75a395735d57 100644 (file)
--- a/poll.c
+++ b/poll.c
@@ -82,10 +82,8 @@ decode_poll_entering(struct tcb *tcp)
                        tprints("...");
                        break;
                }
-               if (umove(tcp, cur, &fds) < 0) {
-                       tprints("???");
+               if (umove_or_printaddr(tcp, cur, &fds))
                        break;
-               }
                print_pollfd(tcp, &fds);
 
        }
@@ -134,7 +132,7 @@ decode_poll_exiting(struct tcb *tcp, const long pts)
                                *outptr++ = '[';
                        else
                                outptr = stpcpy(outptr, ", ");
-                       outptr = stpcpy(outptr, "???");
+                       outptr += sprintf(outptr, "%#lx", cur);
                        break;
                }
                if (!fds.revents)
@@ -154,8 +152,8 @@ decode_poll_exiting(struct tcb *tcp, const long pts)
 
                const char *flagstr = sprintflags("", pollflags, fds.revents);
 
-               if (outptr + strlen(fdstr) + strlen(flagstr) + 1
-                   >= end_outstr - sizeof(", ...], ...")) {
+               if (outptr + strlen(fdstr) + strlen(flagstr) + 1 >=
+                   end_outstr - (2 + 2 * sizeof(long) + sizeof(", ], ..."))) {
                        outptr = stpcpy(outptr, "...");
                        break;
                }