]> granicus.if.org Git - strace/blobdiff - util.c
Use printnum_int64 instead of print_loff_t
[strace] / util.c
diff --git a/util.c b/util.c
index 98c624b0bf40e0935adfb93f78ca76feeaace2fa..04cf413a6d578a12b16e05fdae32c46525294d01 100644 (file)
--- a/util.c
+++ b/util.c
@@ -389,22 +389,35 @@ void                                                                      \
 printnum_ ## name(struct tcb *tcp, const long addr, const char *fmt)   \
 {                                                                      \
        type num;                                                       \
-       if (!addr)                                                      \
-               tprints("NULL");                                        \
-       else if (umove(tcp, addr, &num) < 0)                            \
-               tprintf("%#lx", addr);                                  \
-       else {                                                          \
+       if (!umove_or_printaddr(tcp, addr, &num)) {                     \
                tprints("[");                                           \
                tprintf(fmt, num);                                      \
                tprints("]");                                           \
        }                                                               \
 }
 
+#define DEF_PRINTPAIR(name, type) \
+void                                                                   \
+printpair_ ## name(struct tcb *tcp, const long addr, const char *fmt)  \
+{                                                                      \
+       type pair[2];                                                   \
+       if (!umove_or_printaddr(tcp, addr, &pair)) {                    \
+               tprints("[");                                           \
+               tprintf(fmt, pair[0]);                                  \
+               tprints(", ");                                          \
+               tprintf(fmt, pair[1]);                                  \
+               tprints("]");                                           \
+       }                                                               \
+}
+
 DEF_PRINTNUM(long, long)
+DEF_PRINTPAIR(long, long)
 DEF_PRINTNUM(int, int)
+DEF_PRINTPAIR(int, int)
 DEF_PRINTNUM(short, short)
 #if SIZEOF_LONG != 8
 DEF_PRINTNUM(int64, uint64_t)
+DEF_PRINTPAIR(int64, uint64_t)
 #endif
 
 const char *
@@ -1089,7 +1102,7 @@ umoven_or_printaddr(struct tcb *tcp, const long addr, const unsigned int len,
                tprints("NULL");
                return -1;
        }
-       if ((exiting(tcp) && syserror(tcp)) ||
+       if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
            umoven(tcp, addr, len, our_addr) < 0) {
                tprintf("%#lx", addr);
                return -1;