[PATCH v4 1/4] Option to print only failing syscalls

Kohl, Burkhard burkhard.kohl at intel.com
Tue Jun 18 08:53:31 UTC 2019


> -----Original Message-----
> From: Paul Chaignon [mailto:paul.chaignon at gmail.com]
> Sent: Saturday, June 15, 2019 19:29
> To: strace-devel at lists.strace.io
> Cc: Kohl, Burkhard <burkhard.kohl at intel.com>; Dmitry V. Levin <ldv at altlinux.org>
> Subject: [PATCH v4 1/4] Option to print only failing syscalls
> 
> Existing -z option prints only successful syscalls.  This patch adds a -Z
> option to print only failing syscalls.
> 
> Signed-off-by: Paul Chaignon <paul.chaignon at gmail.com>
> Co-Authored-by: Burkhard Kohl <burkhard.kohl at intel.com>
> ---
> @@ -1585,7 +1587,7 @@ init(int argc, char *argv[])
>  #ifdef ENABLE_STACKTRACE
>  	    "k"
>  #endif
> -	    "a:Ab:cCdDe:E:fFhiI:o:O:p:P:qrs:S:tTu:vVwxX:yz")) != EOF) {
> +	    "a:Ab:cCdDe:E:fFhiI:o:O:p:P:qrs:S:tTu:vVwxX:yzZ")) != EOF) {
>  		switch (c) {
>  		case 'a':
>  			acolumn = string_to_uint(optarg);
> @@ -1716,6 +1718,9 @@ init(int argc, char *argv[])
>  		case 'z':
>  			not_failing_only = 1;
>  			break;
> +		case 'Z':
> +			failing_only = 1;
> +			break;
>  		default:
>  			error_msg_and_help(NULL);
>  			break;

This allows specifying both option -zZ / -Zz, but then the results depend on the
sequence in which these options appear on the cmdline, e.g.:

    wc -l *.trc:
   775 nozorZ.trc
   753 z.trc
   753 Zz.trc
    23  Z.trc
    23  zZ.trc

These two options should be made mutually exclusive, e.g. by cross checking against local z-/Z-option flags:
    case 'z':
        if (Z_flg)
	errflg++;
        else
	z_flg++;
        not_failing_only = 1;
        break;
    case 'Z':
        if (z_flg) 
    	errflg++;
       ...

Burkhard
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928



More information about the Strace-devel mailing list