[SCM] strace branch, master, updated. v4.5.20-103-g7b6847b

Dmitry V. Levin ldv at altlinux.org
Thu Mar 10 23:02:15 UTC 2011


On Thu, Mar 10, 2011 at 12:26:08PM +0100, Denys Vlasenko wrote:
[...]
> Show job control stop differently from signal notification
> 
> * strace.c (trace): Query PTRACE_GETSIGINFO on stop signals,
> if it fails, show "--- stopped by SIGFOO ---"
> to indicate that tracee is in job control stop now.
> 
> --- strace.0/strace.c	2011-02-14 20:11:45.690110153 +0100
> +++ strace.1/strace.c	2011-03-10 12:15:14.259222703 +0100
> @@ -2626,6 +2626,7 @@ Process %d attached (waiting for parent)
>  			}
>  			if (cflag != CFLAG_ONLY_STATS
>  			    && (qual_flags[WSTOPSIG(status)] & QUAL_SIGNAL)) {
> +				int in_job_control_stop;
>  				unsigned long addr = 0;
>  				long pc = 0;
>  #if defined(PT_CR_IPSR) && defined(PT_CR_IIP) && defined(PT_GETSIGINFO)
> @@ -2649,8 +2650,25 @@ Process %d attached (waiting for parent)
>  							si.si_addr;
>  				}
>  #endif
> +				in_job_control_stop = 0;
> +				if (WSTOPSIG(status) == SIGSTOP ||
> +				    WSTOPSIG(status) == SIGTSTP ||
> +				    WSTOPSIG(status) == SIGTTIN ||
> +				    WSTOPSIG(status) == SIGTTOU) {
> +					/*
> +					 * PTRACE_GETSIGINFO fails if this is
> +					 * genuine *stop* notification,
> +					 * not *signal* notification
> +					 */
> +					siginfo_t si;
> +					if (ptrace(PTRACE_GETSIGINFO, pid,
> +						    0, &si) != 0)
> +						in_job_control_stop = 1;
> +				}

The more I look at this special handling for job control stop signals, the
more I think something is going wrong.
Why not to differentiate output format just depending on PTRACE_GETSIGINFO
success or failure, without special handling for stop signals?
For example,
http://strace.git.sourceforge.net/git/gitweb.cgi?p=strace/strace;a=shortlog;h=ldv/trace-siginfo

It's a bit intrusive, so I'm not sure it should go before the release,
though.

P.S.  While testing these changes, I've spotted a bug.
Try to run "cat > /dev/null & strace -p $!", it looks like some
stop signals are not actually delivered to traced processes.


-- 
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/20110311/3975ed60/attachment.bin>


More information about the Strace-devel mailing list