From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11708 invoked by alias); 21 Mar 2007 02:18:13 -0000 Received: (qmail 11694 invoked by uid 22791); 21 Mar 2007 02:18:13 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 21 Mar 2007 02:18:11 +0000 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id D3B184B267; Tue, 20 Mar 2007 21:18:09 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id BA6604B262; Tue, 20 Mar 2007 21:18:09 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HTqOv-0000hW-Ay; Tue, 20 Mar 2007 22:18:09 -0400 Date: Wed, 21 Mar 2007 02:18:00 -0000 From: Daniel Jacobowitz To: Michael FIG Cc: gdb@sourceware.org Subject: Re: debugging a program that uses SIGTRAP Message-ID: <20070321021809.GA2523@caradoc.them.org> Mail-Followup-To: Michael FIG , gdb@sourceware.org References: <7qy7lruz89.fsf@babe.fig.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7qy7lruz89.fsf@babe.fig.org> User-Agent: Mutt/1.5.14+cvs20070313 (2007-03-13) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00240.txt.bz2 On Tue, Mar 20, 2007 at 08:06:30PM -0600, Michael FIG wrote: > Hi, all... > > How do you folks debug GDB under GDB? It's quite easy. GDB never generates SIGTRAPs in itself, only in the program it is debugging. The outer GDB is only looking at the inner GDB, not at the program the inner GDB is controlling. > However, when I change the handling of SIGTRAP to do this > automatically, my program dies: > > (gdb) handle SIGTRAP pass > SIGTRAP is used by the debugger. > Are you sure you want to change it? (y or n) y > Signal Stop Print Pass to program Description > SIGTRAP Yes Yes Yes Trace/breakpoint trap > (gdb) r > Starting program: /fig/home/michael/sw/libstackless/t > > Program terminated with signal SIGTRAP, Trace/breakpoint trap. > The program no longer exists. > (gdb) > > The program is attached below. When you do this, it's not just resending SIGTRAPs that it would display, but also all the internal ones. In this particular case it's probably something from the shared library initialization breakpoint, before main and before you have a SIGTRAP handler. Even if you get past that point, your handler will now get called every time GDB hits a breakpoint or single steps - single stepping will probably be broken. I don't see any good way to solve this. You've got two sets of breakpoints and they're both going to stop GDB - it doesn't know which ones you want and which you don't. -- Daniel Jacobowitz CodeSourcery