semop()/semtimedop() sembuf argument printing in strace
Dmitry V. Levin
ldv at altlinux.org
Mon Oct 5 15:39:40 UTC 2009
Hi,
On Wed, Sep 30, 2009 at 05:59:07PM +0200, Jakub Bogusz wrote:
>
> the attached patch adds pretty printing of sembuf argument and flags to
> semop() and semtimedop() syscalls.
Thank you for the patch. See my comments below.
> --- strace-4.5.18/ipc.c.orig 2007-01-15 21:25:52.000000000 +0100
> +++ strace-4.5.18/ipc.c 2009-09-30 17:48:38.080610937 +0200
[...]
> @@ -273,14 +279,34 @@
> int sys_semop(tcp)
> struct tcb *tcp;
> {
> + int i;
> +
> if (entering(tcp)) {
> tprintf("%lu", tcp->u_arg[0]);
> if (indirect_ipccall(tcp)) {
> - tprintf(", %#lx", tcp->u_arg[3]);
> - tprintf(", %lu", tcp->u_arg[1]);
> + tprintf(", %#lx {", tcp->u_arg[3]);
> + for(i = 0; i < tcp->u_arg[1]; i++) {
> + struct sembuf sb;
> + umove(tcp, tcp->u_arg[3]+i*sizeof(struct sembuf), &sb);
umove() return code usually have to be taken into account, especially
when umove() arguments come from user input.
> + if(i != 0)
> + tprintf(", ");
> + tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
> + printflags(semop_flags, sb.sem_flg, "SEM_???");
> + tprintf("}");
> + }
> + tprintf("}, %lu", tcp->u_arg[1]);
> } else {
> - tprintf(", %#lx", tcp->u_arg[1]);
> - tprintf(", %lu", tcp->u_arg[2]);
> + tprintf(", %#lx {", tcp->u_arg[1]);
> + for(i = 0; i < tcp->u_arg[2]; i++) {
> + struct sembuf sb;
> + umove(tcp, tcp->u_arg[1]+i*sizeof(struct sembuf), &sb);
Likewise.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20091005/68710193/attachment.bin>
More information about the Strace-devel
mailing list