Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932456AbVI3Ar5 (ORCPT ); Thu, 29 Sep 2005 20:47:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932457AbVI3Ar5 (ORCPT ); Thu, 29 Sep 2005 20:47:57 -0400 Received: from nevyn.them.org ([66.93.172.17]:56291 "EHLO nevyn.them.org") by vger.kernel.org with ESMTP id S932456AbVI3Ar4 (ORCPT ); Thu, 29 Sep 2005 20:47:56 -0400 Date: Thu, 29 Sep 2005 20:47:54 -0400 From: Daniel Jacobowitz To: John Reiser Cc: linux-kernel@vger.kernel.org Subject: Re: ptrace unexpected SIGTRAP (trace bit) on x86, x86_64 kernel 2.6.13.2 Message-ID: <20050930004754.GA26866@nevyn.them.org> Mail-Followup-To: John Reiser , linux-kernel@vger.kernel.org References: <433C0F21.8070104@BitWagon.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <433C0F21.8070104@BitWagon.com> User-Agent: Mutt/1.5.8i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1233 Lines: 28 On Thu, Sep 29, 2005 at 08:58:25AM -0700, John Reiser wrote: > Ptrace is giving unexpected SIGTRAP (trace bit) in kernel 2.6.13.2 > on both x86 and x86_64. > > The 8-instruction program below just execve()s itself over and over. > When run under gdb, the first user-visible SIGTRAP is expected due to > the 'int3'. But the second user-visible SIGTRAP is unexpected, as > there is no reason to trap. > > Changing the line "nop; int3" to "nop; nop" gives a program that > just spins merrily when run under /bin/bash. But gdb sees a SIGTRAP, > with the $pc pointing after the second 'nop'. When run under strace > (strace gdb ./execve; (gdb) run), the process spins merrily with > no unexpected SIGTRAP. Most likely GDB is receiving the SIGTRAP generated by execve(). I don't know why it would appear to be after the int3 rather than before. GDB has strictly limited support for programs which exec, mostly due to thorny user interface issues. -- Daniel Jacobowitz CodeSourcery, LLC - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/