[PATCH v3 1/3] Stop condition based on number of syscalls

Dmitry V. Levin ldv at strace.io
Thu Mar 2 10:41:53 UTC 2023


On Thu, Mar 02, 2023 at 03:08:42AM +0530, Sahil Siddiq wrote:
[...]
> --- a/src/strace.c
> +++ b/src/strace.c
> @@ -84,6 +84,7 @@ int Tflag_scale = 1000;
>  int Tflag_width = 6;
>  bool iflag;
>  bool count_wallclock;
> +int syscall_limit = -1;

By the way, let's use "unsigned long long" instead of "int" from the
beginning, with -1ULL as a special value.

[...]
> @@ -1108,7 +1113,7 @@ droptcb(struct tcb *tcp)
>  				fprintf(tcp->outf, " <detached ...>\n");
>  			fclose(tcp->outf);
>  		} else {
> -			if (printing_tcp == tcp && tcp->curcol != 0 && publish)
> +			if (syscall_limit == 0 || (printing_tcp == tcp && tcp->curcol != 0 && publish))
>  				fprintf(tcp->outf, " <detached ...>\n");
>  			flush_tcp_output(tcp);

As " <detached ...>\n" is printed only in case when a syscall hasn't
been completely decoded, I don't see why do you want to print this
unconditionally in case of syscall_limit == 0.
I suggest not to change this logic at all: detach() already issues
"Process %u detached" message, that should be enough.


-- 
ldv


More information about the Strace-devel mailing list