From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27625 invoked by alias); 8 Aug 2013 17:43:11 -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 27611 invoked by uid 89); 8 Aug 2013 17:43:10 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 08 Aug 2013 17:43:08 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r78Hh0SE029476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Aug 2013 13:43:00 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r78HgxIE013063; Thu, 8 Aug 2013 13:42:59 -0400 Message-ID: <5203D8A2.50300@redhat.com> Date: Thu, 08 Aug 2013 17:43:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Azat Khuzhin CC: gdb-patches@sourceware.org Subject: Re: [PATCH] gcore: expand tilde in filename, like in "dump memory" command. References: <1375909475-16720-1-git-send-email-a3at.mail@gmail.com> In-Reply-To: <1375909475-16720-1-git-send-email-a3at.mail@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00250.txt.bz2 On 08/07/2013 10:04 PM, Azat Khuzhin wrote: > Before this patch next command will fail: > (gdb) generate-core-file ~/core > Failed to open '~/core' for output. > > After this patch: > (gdb) generate-core-file ~/core > Saved corefile ~/core Thanks! Our cvs server is unfortunately stuck at the moment, but I'll apply this as soon as it gets unstuck. > --- > ChangeLog | 4 ++++ > gdb/gcore.c | 6 +++++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/ChangeLog b/ChangeLog > index 8b16b09..7aa8e8e 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,7 @@ > +2013-07-22 Azat Khuzhin > + > + * gdb/gcore.c: Use tilde_expand() to handle tilde in filename File paths mentioned in ChangeLog entries are relative to the directory that holds the ChangeLog. So gdb/ should be dropped. No () when mentioning a function by name. Period at end of sentence. I notice you don't seem to have a copyright assignment on file. The change is small enough that we can put it in without one (that's what "tiny" means in the ChangeLog). If you intend to contribute further, contact me off list, and I'll get you started on the process. > bfd * > create_gcore_bfd (const char *filename) > { > - bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ()); > + char *fullname = tilde_expand (filename); > + > + bfd *obfd = gdb_bfd_openw (fullname, default_gcore_target ()); Empty line goes after last declaration. > + xfree (fullname); > > if (!obfd) > error (_("Failed to open '%s' for output."), filename); Here's the adjusted patch I plan to check in as soon as I'm able to. ------------ From: Azat Khuzhin Date: 2013-08-08 01:04:35 +0400 gcore: expand tilde in filename, like in "dump memory" command. Before this patch this fails: (gdb) generate-core-file ~/core Failed to open '~/core' for output. After this patch: (gdb) generate-core-file ~/core Saved corefile ~/core gdb/ 2013-08-08 Azat Khuzhin (tiny change) * gcore.c (create_gcore_bfd): Use tilde_expand. --- gdb/gcore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/gcore.c b/gdb/gcore.c index 620be54..9c83ec8 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -34,6 +34,7 @@ #include "regcache.h" #include "regset.h" #include "gdb_bfd.h" +#include "readline/tilde.h" /* The largest amount of memory to read from the target at once. We must throttle it to limit the amount of memory used by GDB during @@ -51,7 +52,12 @@ static int gcore_memory_sections (bfd *); bfd * create_gcore_bfd (const char *filename) { - bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ()); + char *fullname; + bfd *obfd; + + fullname = tilde_expand (filename); + obfd = gdb_bfd_openw (fullname, default_gcore_target ()); + xfree (fullname); if (!obfd) error (_("Failed to open '%s' for output."), filename);