From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4234 invoked by alias); 7 Aug 2013 21:04:47 -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 4219 invoked by uid 89); 7 Aug 2013 21:04:47 -0000 X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RDNS_NONE,SPF_PASS autolearn=no version=3.3.1 Received: from Unknown (HELO mail-lb0-f174.google.com) (209.85.217.174) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 07 Aug 2013 21:04:47 +0000 Received: by mail-lb0-f174.google.com with SMTP id w20so1047502lbh.33 for ; Wed, 07 Aug 2013 14:04:38 -0700 (PDT) X-Received: by 10.152.44.164 with SMTP id f4mr645027lam.38.1375909478663; Wed, 07 Aug 2013 14:04:38 -0700 (PDT) Received: from localhost ([188.134.22.24]) by mx.google.com with ESMTPSA id pw4sm2499961lbb.9.2013.08.07.14.04.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 07 Aug 2013 14:04:37 -0700 (PDT) From: Azat Khuzhin To: gdb-patches@sourceware.org Cc: Azat Khuzhin Subject: [PATCH] gcore: expand tilde in filename, like in "dump memory" command. Date: Wed, 07 Aug 2013 21:04:00 -0000 Message-Id: <1375909475-16720-1-git-send-email-a3at.mail@gmail.com> X-SW-Source: 2013-08/txt/msg00220.txt.bz2 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 --- 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 + 2013-07-22 Joel Brobecker * src-release (VER): Use $(TOOL)/common/create-version.sh diff --git a/gdb/gcore.c b/gdb/gcore.c index 620be54..af3fe18 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,10 @@ static int gcore_memory_sections (bfd *); 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 ()); + xfree (fullname); if (!obfd) error (_("Failed to open '%s' for output."), filename); -- 1.7.10.4