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

Attachment: pgp82x8RwIduF.pgp
Description: PGP signature

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to