* Copyright (c) 2007 Roland McGrath <roland@redhat.com>
* Copyright (c) 2011-2012 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2010-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "defs.h"
static void
-printargv(struct tcb *tcp, long addr)
+printargv(struct tcb *const tcp, kernel_ulong_t addr)
{
if (!addr || !verbose(tcp)) {
printaddr(addr);
for (n = 0; addr; sep = ", ", addr += wordsize, ++n) {
union {
unsigned int p32;
- unsigned long p64;
- char data[sizeof(long)];
+ kernel_ulong_t p64;
+ char data[sizeof(kernel_ulong_t)];
} cp;
if (umoven(tcp, addr, wordsize, cp.data)) {
break;
}
tprints(sep);
- printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64, -1);
+ printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64);
}
tprints("]");
}
static void
-printargc(struct tcb *tcp, long addr)
+printargc(struct tcb *const tcp, kernel_ulong_t addr)
{
- if (!addr || !verbose(tcp)) {
- printaddr(addr);
+ printaddr(addr);
+
+ if (!addr || !verbose(tcp))
return;
- }
bool unterminated = false;
unsigned int count = 0;
for (; addr; addr += current_wordsize, ++count) {
if (umoven(tcp, addr, current_wordsize, &cp)) {
- if (count) {
- unterminated = true;
- break;
- }
- printaddr(addr);
- return;
+ if (!count)
+ return;
+
+ unterminated = true;
+ break;
}
if (!cp)
break;
}
- tprintf("[/* %u var%s%s */]",
+ tprintf_comment("%u var%s%s",
count, count == 1 ? "" : "s",
unterminated ? ", unterminated" : "");
}