aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-08-08 17:00:42 +0000
committerPedro Alves <palves@redhat.com>2013-08-08 17:00:42 +0000
commit47ecca85db40d34820d94fbc5fb79babaa95b725 (patch)
tree57904cdb8f5ec1d1ecfdf86340b40726788d10d2
parent82a0a75ff005db5ff174768120dddb13a6392c5c (diff)
downloadgdb-47ecca85db40d34820d94fbc5fb79babaa95b725.zip
gdb-47ecca85db40d34820d94fbc5fb79babaa95b725.tar.gz
gdb-47ecca85db40d34820d94fbc5fb79babaa95b725.tar.bz2
gcore: expand tilde in filename.
Before this patch, this fails: (gdb) generate-core-file ~/core Failed to open '~/core' for output. After the patch: (gdb) generate-core-file ~/core Saved corefile ~/core gdb/ 2013-08-08 Azat Khuzhin <a3at.mail@gmail.com> (tiny change) * gcore.c (create_gcore_bfd): Use tilde_expand.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/gcore.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3de17da..13a9ccd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2013-08-08 Azat Khuzhin <a3at.mail@gmail.com> (tiny change)
+
+ * gcore.c (create_gcore_bfd): Use tilde_expand.
+
2013-08-08 Yao Qi <yao@codesourcery.com>
* frame.h (read_frame_local): Declare.
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);