public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gcore: expand tilde in filename, like in "dump memory" command.
@ 2013-08-07 21:04 Azat Khuzhin
  2013-08-08 17:42 ` [RFC] Show (tilde-)expanded filenames to the user? (was: Re: [PATCH] gcore: expand tilde in filename, like in "dump memory" command.) Pedro Alves
  2013-08-08 17:43 ` [PATCH] gcore: expand tilde in filename, like in "dump memory" command Pedro Alves
  0 siblings, 2 replies; 7+ messages in thread
From: Azat Khuzhin @ 2013-08-07 21:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: Azat Khuzhin

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  <a3at.mail@gmail.com>
+
+	* gdb/gcore.c: Use tilde_expand() to handle tilde in filename
+
 2013-07-22  Joel Brobecker  <brobecker@adacore.com>
 
 	* 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-09 15:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 21:04 [PATCH] gcore: expand tilde in filename, like in "dump memory" command Azat Khuzhin
2013-08-08 17:42 ` [RFC] Show (tilde-)expanded filenames to the user? (was: Re: [PATCH] gcore: expand tilde in filename, like in "dump memory" command.) Pedro Alves
2013-08-08 18:16   ` Azat Khuzhin
2013-08-08 19:50   ` [RFC] Show (tilde-)expanded filenames to the user? Tom Tromey
2013-08-09 15:22     ` Pedro Alves
2013-08-08 17:43 ` [PATCH] gcore: expand tilde in filename, like in "dump memory" command Pedro Alves
2013-08-08 17:51   ` Azat Khuzhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).