[PATCH v5 3/4] Implement -e status=set option

Kohl, Burkhard burkhard.kohl at intel.com
Tue Jul 2 15:01:19 UTC 2019



> -----Original Message-----
> From: Paul Chaignon [mailto:paul.chaignon at gmail.com]
> Sent: Friday, June 28, 2019 11:34

> diff --git a/strace.c b/strace.c
> index cb1d1840..2f956253 100644
> --- a/strace.c
> +++ b/strace.c
> @@ -109,10 +109,6 @@ static bool daemonized_tracer;
>  static int post_attach_sigstop = TCB_IGNORE_ONE_SIGSTOP;
>  #define use_seize (post_attach_sigstop == 0)
> 
> -/* Sometimes we want to print succeeding/failing syscalls only. */
> -bool not_failing_only;
> -bool failing_only;
> -
>  /* Show path associated with fd arguments */
>  unsigned int show_fd_path;
> 
> @@ -273,7 +269,7 @@ Statistics:\n\
>  \n\
>  Filtering:\n\
>    -e expr        a qualifying expression: option=[!]all or option=[!]val1[,val2]...\n\
> -     options:    trace, abbrev, verbose, raw, signal, read, write, fault, inject, kvm\n\
> +     options:    trace, abbrev, verbose, raw, signal, read, write, fault, inject, status, kvm\n\
>    -P path        trace accesses to path\n\
>    -z             print only syscalls that returned without an error code\n\
>    -Z             print only syscalls that returned with an error code\n\
> @@ -812,12 +808,18 @@ droptcb(struct tcb *tcp)
>  	debug_msg("dropped tcb for pid %d, %d remain", tcp->pid, nprocs);
> 
>  	if (tcp->outf) {
> +		bool publish = true;
> +		if (!is_complete_set(status_set, NUMBER_OF_STATUSES)) {
> +			publish = is_number_in_set(STATUS_DETACHED, status_set);
> +			strace_close_memstream(tcp, publish);
> +		}
> +

For any combination of "strace -d -e status=<list>" I see in the debug output 
that strace_close_memstream() wants to publish a closed memstream when
a process has exited:

	./strace: next_event: queued pid 19858
	./strace: next_event: dequeued pid 19858
	16:42:53 exit_group(0)                  = ?
	./strace: [wait(0x000000) = 19858] WIFEXITED,exitcode=0
	./strace: next_event: queued pid 19858
	./strace: next_event: dequeued pid 19858
	16:42:53 +++ exited with 0 +++
	./strace: dropped tcb for pid 19858, 0 remain
	./strace: memstream already closed

Could this be an off-by-one-error (NUMBER_OF_STATUSES)?  

-- 
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