From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2313 invoked by alias); 15 Aug 2006 14:28:45 -0000 Received: (qmail 2289 invoked by uid 22791); 15 Aug 2006 14:28:44 -0000 X-Spam-Check-By: sourceware.org Received: from ip-160-218-142-157.eurotel.cz (HELO host0.dyn.jankratochvil.net) (160.218.142.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 15 Aug 2006 14:28:37 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.7/8.13.7) with ESMTP id k7FESKD1028293; Tue, 15 Aug 2006 16:28:20 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.7/8.13.7/Submit) id k7FESJ2X028292; Tue, 15 Aug 2006 16:28:19 +0200 Date: Tue, 15 Aug 2006 14:28:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: gdb@sourceware.org Subject: Re: Debugging through exec() (Linux MAY_FOLLOW_EXEC) Message-ID: <20060815142819.GA26405@host0.dyn.jankratochvil.net> References: <20060722123102.GA1936@lace.redhat.com> <20060724190332.GA13612@nevyn.them.org> <20060729185317.GA16200@host0.dyn.jankratochvil.net> <200607312038.k6VKchKj018729@elgar.sibelius.xs4all.nl> <20060805164144.GA23819@host0.dyn.jankratochvil.net> <20060808160113.GC21032@nevyn.them.org> <20060814150628.GA24544@host0.dyn.jankratochvil.net> <20060814213849.GA1433@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00129.txt.bz2 On Tue, 15 Aug 2006 05:22:21 +0200, Eli Zaretskii wrote: > Daniel Jacobowitz wrote: > > Eli, have you got an opinion on the broader question, by chance? ... > The thing is, I couldn't figure out the broader context of this > suggested change, from what was posted. There's not enough info; Currently gdb does not notice `exec' at all - it does not apply the inferior changes to its debugging information about the inferior. By default in the point of `exec' it will lose any breakpoints and the execution will continue without any gdb influence and the program will just finish uncaught. If you turn on "catch exec" you will get back the control after `exec' changes the virtual memory context but gdb will still expect the original executable is still loaded. All the sources will be displayed for the original program and breakpoints put to the addresses according to the debuginfo of the original program, still everything will be messed up as a complately different executable is already running. In fact the original intention of this patch was different - gdb locked up on any `exec' from a threaded program. https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182116 Cannot find user-level thread for LWP 4256: generic error it was fixed by a more simple way by Daniel, though: 2006-07-24 Jan Kratochvil Daniel Jacobowitz * linux-thread-db.c (thread_db_wait): Remove libthread_db after exec events. So I no longer consider this patch as mission critical as before. Still it is useful for debugging programs like javac(1) or gcc(1) which are in fact only wrappers. Some years ago I had to always watch (usually using strace(1)) which next program gets executed and restart the debugging from the spawned process with the found arguments and environment variables. This patch will just simplify it, do not care whether this program is the final one or just the spawning stub, just run it through gdb and catch the problematic point. And from the principal point - currently (without this patch) "catch exec" command is just broken - after it catches `exec' the state of the debugger and the debugging program is inconsistent. Thanks for the interest, Jan