Subject: Re: [POWERPC 2/9] spufs: always send sigtrap on breakpoint

From: Luke Browning <[email-masked]>
Date: Mon, 27 Nov 2006 22:12:15 -0200

On Mon, 2006-11-27 at 19:18 +0100, Arnd Bergmann wrote:
> plain text document attachment
> (spufs-always-sigtrap-on-breakpoint.diff)
> Currently, we only send a sigtrap if the current task is being ptraced.
> This is somewhat inconsistant, and it breaks utrace support in fedora.
> Removing the check should do the right thing in all cases.
> 
> Cc: Ulrich Weigand <[email-masked]>
> Signed-off-by: Arnd Bergmann <[email-masked]>
> 
> diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
> index 1be4e33..1acc2ff 100644
> --- a/arch/powerpc/platforms/cell/spufs/run.c
> +++ b/arch/powerpc/platforms/cell/spufs/run.c
> @@ -350,12 +350,10 @@ out2:
>  	       (status >> SPU_STOP_STATUS_SHIFT != 0x2104)))))
>  		ret = status;
> 
> -	if (unlikely(current->ptrace & PT_PTRACED)) {
> -		if ((status & SPU_STATUS_STOPPED_BY_STOP)
> -		    && (status >> SPU_STOP_STATUS_SHIFT) == 0x3fff) {
> -			force_sig(SIGTRAP, current);
> -			ret = -ERESTARTSYS;
> -		}
> +	if ((status & SPU_STATUS_STOPPED_BY_STOP)
> +	    && (status >> SPU_STOP_STATUS_SHIFT) == 0x3fff) {
> +		force_sig(SIGTRAP, current);
> +		ret = -ERESTARTSYS;
>  	}
> 
>  out:
> 

Arnd, could you explain this change a little bit more.  Don't you have
to consider whether the program is setup to receive SIGTRAP.  We know it
is code to handle SIGTRAP if it is ptraced.  Or, are you asserting that
at this point the spu has hit a trap instruction?  What does 0x3fff
mean?

Luke