* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.
Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
SYS_FUNC(init_module)
{
- tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
+ printaddr(tcp->u_arg[0]);
+ tprintf(", %lu, ", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
return RVAL_DECODED;
if (exiting(tcp)) {
const char *sep = "|";
unsigned long flags = tcp->u_arg[ARG_FLAGS];
- tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
+ tprints("child_stack=");
+ printaddr(tcp->u_arg[ARG_STACK]);
+ tprints(", ");
#ifdef ARG_STACKSIZE
if (ARG_STACKSIZE != -1)
tprintf("stack_size=%#lx, ",
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
return 0;
- if (flags & CLONE_PARENT_SETTID)
- tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]);
+ if (flags & CLONE_PARENT_SETTID) {
+ tprints(", parent_tidptr=");
+ printaddr(tcp->u_arg[ARG_PTID]);
+ }
if (flags & CLONE_SETTLS) {
#if defined I386 || defined X86_64 || defined X32
# ifndef I386
else
# endif
#endif /* I386 || X86_64 || X32 */
- tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]);
+ {
+ tprints(", tls=");
+ printaddr(tcp->u_arg[ARG_TLS]);
+ }
+ }
+ if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) {
+ tprints(", child_tidptr=");
+ printaddr(tcp->u_arg[ARG_CTID]);
}
- if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))
- tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]);
}
/* TODO on syscall entry:
* We can clear CLONE_PTRACE here since it is an ancient hack
ffe.u.periodic.offset,
ffe.u.periodic.phase);
decode_envelope(&ffe.u.periodic.envelope);
- tprintf(", custom_len=%u"
- ", custom_data=%#lx}",
- ffe.u.periodic.custom_len,
- (unsigned long) ffe.u.periodic.custom_data);
+ tprintf(", custom_len=%u, custom_data=",
+ ffe.u.periodic.custom_len);
+ printaddr((unsigned long) ffe.u.periodic.custom_data);
+ tprints("}");
break;
case FF_RUMBLE:
tprintf(", rumble={strong_magnitude=%" PRIu16
if (umove_or_printaddr(tcp, addr, &mbuf))
return;
- tprintf("{start=%#x, length=%#x, ptr=%#lx}",
- mbuf.start, mbuf.length, (unsigned long) mbuf.ptr);
+ tprintf("{start=%#x, length=%#x, ptr=", mbuf.start, mbuf.length);
+ printaddr((unsigned long) mbuf.ptr);
+ tprints("}");
}
static void
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
if (!verbose(tcp)) {
- tprintf("%#lx, %u, ",
- tcp->u_arg[1], (unsigned int) tcp->u_arg[2]);
+ printaddr(tcp->u_arg[1]);
+ tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
}
} else {
*/
tcp->auxstr = sprint_timespec(tcp, tcp->u_arg[4]);
} else {
- tprintf("%#lx, %ld, ", tcp->u_arg[1], tcp->u_arg[2]);
+ printaddr(tcp->u_arg[1]);
+ tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
tprints(", ");
print_timespec(tcp, tcp->u_arg[4]);
int len;
if (syserror(tcp) || umove(tcp, tcp->u_arg[4], &len) < 0) {
- tprintf("%#lx, %#lx",
- tcp->u_arg[3], tcp->u_arg[4]);
+ printaddr(tcp->u_arg[3]);
+ tprints(", ");
+ printaddr(tcp->u_arg[4]);
} else {
print_getsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], len);
return;
tprints("{");
- if (sev.sigev_value.sival_ptr)
- tprintf("sigev_value={int=%d, ptr=%#lx}, ",
- sev.sigev_value.sival_int,
- (unsigned long) sev.sigev_value.sival_ptr);
+ if (sev.sigev_value.sival_ptr) {
+ tprintf("sigev_value={int=%d, ptr=",
+ sev.sigev_value.sival_int);
+ printaddr((unsigned long) sev.sigev_value.sival_ptr);
+ tprints("}, ");
+ }
tprints("sigev_signo=");
switch (sev.sigev_notify) {
static void
printsigval(const siginfo_t *sip)
{
- tprintf(", si_value={int=%d, ptr=%#lx}",
- sip->si_int, (unsigned long) sip->si_ptr);
+ tprintf(", si_value={int=%d, ptr=", sip->si_int);
+ printaddr((unsigned long) sip->si_ptr);
+ tprints("}");
}
static void
break;
case SIGILL: case SIGFPE:
case SIGSEGV: case SIGBUS:
- tprintf(", si_addr=%#lx",
- (unsigned long) sip->si_addr);
+ tprints(", si_addr=");
+ printaddr((unsigned long) sip->si_addr);
break;
case SIGPOLL:
switch (sip->si_code) {
break;
#ifdef HAVE_SIGINFO_T_SI_SYSCALL
case SIGSYS:
- tprintf(", si_call_addr=%#lx, si_syscall=__NR_%s, si_arch=",
- (unsigned long) sip->si_call_addr,
+ tprints(", si_call_addr=");
+ printaddr((unsigned long) sip->si_call_addr);
+ tprintf(", si_syscall=__NR_%s, si_arch=",
syscall_name((unsigned) sip->si_syscall));
printxval(audit_arch, sip->si_arch, "AUDIT_ARCH_???");
break;
* be manipulated by strace. In order to prevent the
* compiler from generating code to manipulate
* __sa_handler we cast the function pointers to long. */
+ tprints("{");
if ((long)sa.__sa_handler == (long)SIG_ERR)
- tprints("{SIG_ERR, ");
+ tprints("SIG_ERR");
else if ((long)sa.__sa_handler == (long)SIG_DFL)
- tprints("{SIG_DFL, ");
+ tprints("SIG_DFL");
else if ((long)sa.__sa_handler == (long)SIG_IGN)
- tprints("{SIG_IGN, ");
+ tprints("SIG_IGN");
else
- tprintf("{%#lx, ", (long) sa.__sa_handler);
+ printaddr((unsigned long) sa.__sa_handler);
+ tprints(", ");
/*
* Sigset size is in tcp->u_arg[4] (SPARC)
* or in tcp->u_arg[3] (all other),
return RVAL_DECODED;
}
case MIPS_ATOMIC_SET:
- tprintf("%#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
+ printaddr(tcp->u_arg[1]);
+ tprintf(", %#lx", tcp->u_arg[2]);
return RVAL_DECODED;
case MIPS_FIXADE:
- tprintf("0x%lx", tcp->u_arg[1]);
+ tprintf("%#lx", tcp->u_arg[1]);
return RVAL_DECODED;
}
main(void)
{
getsockopt(-1, SOL_RAW, ICMP_FILTER, 0, 0);
- printf("getsockopt(-1, SOL_RAW, ICMP_FILTER, 0, 0) = -1 %s (%m)\n",
+ printf("getsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, NULL) = -1 %s (%m)\n",
errno2name());
setsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, 0);
/* Fetch one byte more to find out whether path length > n. */
nul_seen = umovestr(tcp, addr, n + 1, path);
if (nul_seen < 0)
- tprintf("%#lx", addr);
+ printaddr(addr);
else {
path[n++] = '\0';
print_quoted_string(path, n, QUOTE_0_TERMINATED);
* because string_quote may look one byte ahead.
*/
if (umovestr(tcp, addr, size + 1, str) < 0) {
- tprintf("%#lx", addr);
+ printaddr(addr);
return;
}
style = QUOTE_0_TERMINATED;
if (size > (unsigned long)len)
size = (unsigned long)len;
if (umoven(tcp, addr, size, str) < 0) {
- tprintf("%#lx", addr);
+ printaddr(addr);
return;
}
style = 0;
umoven_or_printaddr(struct tcb *tcp, const long addr, const unsigned int len,
void *our_addr)
{
- if (!addr) {
- tprints("NULL");
- return -1;
- }
- if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
+ if (!addr || !verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
umoven(tcp, addr, len, our_addr) < 0) {
- tprintf("%#lx", addr);
+ printaddr(addr);
return -1;
}
return 0;
if (b.memory == V4L2_MEMORY_MMAP) {
tprintf(", m.offset=%#x", b.m.offset);
} else if (b.memory == V4L2_MEMORY_USERPTR) {
- tprintf(", m.userptr=%#lx",
- (unsigned long) b.m.userptr);
+ tprints(", m.userptr=");
+ printaddr((unsigned long) b.m.userptr);
}
tprintf(", length=%u, bytesused=%u, flags=",
tprints(", ");
if (!umove_or_printaddr(tcp, arg, &b)) {
- tprintf("{capability=%#x, flags=%#x, base=%#lx}",
- b.capability, b.flags, (unsigned long) b.base);
+ tprintf("{capability=%#x, flags=%#x, base=",
+ b.capability, b.flags);
+ printaddr((unsigned long) b.base);
+ tprints("}");
}
return RVAL_DECODED | 1;
umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr,
const unsigned int len, void *our_addr)
{
- if (!addr) {
- tprints("NULL");
- return -1;
- }
- if (umoven(tcp, addr, len, our_addr) < 0) {
- tprintf("%#lx", addr);
+ if (!addr || umoven(tcp, addr, len, our_addr) < 0) {
+ printaddr(addr);
return -1;
}
return 0;