From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 326 invoked by alias); 30 May 2013 09:25:14 -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 316 invoked by uid 89); 30 May 2013 09:25:13 -0000 X-Spam-SWARE-Status: No, score=-8.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 30 May 2013 09:25:13 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4U9PA9T004777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 30 May 2013 05:25:10 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4U9P9J8030059; Thu, 30 May 2013 05:25:10 -0400 Message-ID: <51A71AF4.5020701@redhat.com> Date: Thu, 30 May 2013 09:25:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: "Agovic, Sanimir" CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] add-inferior: expand tilde in -exec FILENAME argument References: <1362062885-6620-1-git-send-email-sanimir.agovic@intel.com> <512F7897.5000705@redhat.com> <0377C58828D86C4588AEEC42FC3B85A7162A0A3C@IRSMSX102.ger.corp.intel.com> In-Reply-To: <0377C58828D86C4588AEEC42FC3B85A7162A0A3C@IRSMSX102.ger.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg01050.txt.bz2 Hi, sorry for the delay in getting back to this. On 02/28/2013 05:15 PM, Agovic, Sanimir wrote: >> -----Original Message----- >> From: Pedro Alves [mailto:palves@redhat.com] >> Sent: Thursday, February 28, 2013 04:33 PM > > Thanks for your feedback. > >> I assume this fixes: >> >> (gdb) add-inferior -exec ~/gdb/tests/main >> Added inferior 2 >> ~/gdb/tests/main: No such file or directory. >> >> even though the file does exist. > Yes. Sorry for not being clear about the cause. > >> I wondered if other similar places expand the tilde early >> or just before file open [...] > I found at least one another case: > > % gdb -batch \~/gdb/tests/main # or --exec=~/gdb/tests/main > ~/gdb/tests/main: No such file or directory. > > Whereas: > % gdb -batch --symbols=\~/gdb/tests/main > Succeeds. > > Seems like gdb relies on the shell to expand its executable name. > > As an alternative approach I can expand tilde in exec_file_attach > which is what symbol_file_add and core_file_command do. Yes, I think that makes sense. We could then remove it from exec.c: filename = tilde_expand (*argv); make_cleanup (xfree, filename); exec_file_attach (filename, from_tty); -- Pedro Alves