From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3075 invoked by alias); 5 Jun 2015 14:54:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3065 invoked by uid 89); 5 Jun 2015 14:54:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 Jun 2015 14:54:41 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1Z0t14-00009Z-1t from Don_Breazeal@mentor.com ; Fri, 05 Jun 2015 07:54:38 -0700 Received: from [172.30.6.77] (147.34.91.1) by SVR-ORW-FEM-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 5 Jun 2015 07:54:37 -0700 Message-ID: <5571B828.1080208@codesourcery.com> Date: Fri, 05 Jun 2015 14:54:00 -0000 From: Don Breazeal User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Gary Benson CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] Make only user-specified executable filenames sticky References: <20150505151448.GA1417@blade.nx> <1430907977-30605-1-git-send-email-gbenson@redhat.com> <5550E357.9040209@codesourcery.com> <20150605093724.GA26604@blade.nx> In-Reply-To: <20150605093724.GA26604@blade.nx> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00083.txt.bz2 On 6/5/2015 2:37 AM, Gary Benson wrote: > Don Breazeal wrote: >> On 5/6/2015 3:26 AM, Gary Benson wrote: >>> In GDB some executable files are supplied by the user (e.g. using >>> a "file" command) and some are determined by GDB (e.g. while >>> processing an "attach" command). GDB will not attempt to >>> determine a filename if one has been set. This causes problems if >>> you attach to one process and then attach to another: GDB will not >>> attempt to discover the main executable on the second attach. If >>> the two processes have different main executable files then the >>> symbols will now be wrong. >>> >>> This commit updates GDB to keep track of which executable >>> filenames were supplied by the user. When GDB might attempt to >>> determine an executable filename and one is already set, filenames >>> determined by GDB may be overridden but user-supplied filenames >>> will not. >> >> I realize that I am coming late to this discussion, sorry about >> that. > > Likewise, sorry for taking so long to reply :) > >> How does this interact with follow-exec-mode? If follow-exec-mode >> is 'new' and the program execs, then 'run' will use the original >> executable file. But if follow-exec-mode is 'same' and the program >> execs, then 'run' will use the executable file that was active after >> the exec call. >> >> In the follow-exec-mode == 'same' instance, is the assumption that >> the exec'd executable file takes on the same 'user-supplied' >> attribute as the initial executable, since it is using the original >> inferior? >> >> If so, is there a scenario where: >> * the user supplies the exec file name >> * the program execs, so the exec file name is now different >> * then the user tries to do an attach (without an exec file name) to a >> process running the original exec file, and gets the wrong exec file name? > > I'm not sure. Where would I need to look to check this out? > (Where is the bit that updates the filename after exec?) > Hi Gary I think it goes like this: infrun.c:follow_exec calls exec.c:exec_file_attach, which updates the name of the executable. Sorry I haven't taken the time to review your patch to see how it affects this. Hopefully it will be obvious to you. Thanks --Don