summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-08-09 15:33:09 +0000
committerPedro Alves <palves@redhat.com>2013-08-09 15:33:09 +0000
commit428c1f176512756f254a447e44f71d8a8bd6e267 (patch)
tree0713531ade59ee352cd3ef5b87639937e594bc6d
parent6669a858252514823c40915027816d24c5f5e180 (diff)
downloadgdb-428c1f176512756f254a447e44f71d8a8bd6e267.tar.gz
save breakpoints: Make tilde-expanded filename visible.
Most commands in GDB show the tilde-expanded filename in user visible output. This makes "save breakpoints" behave the same. Before: (gdb) save breakpoints ~/a/b Unable to open file '~/a/b' for saving (No such file or directory) After: (gdb) save breakpoints ~/a/b Unable to open file '/home/pedro/a/b' for saving (No such file or directory) Tested on x86_64 Fedora 17. gdb/ 2013-08-09 Pedro Alves <palves@redhat.com> * breakpoint.c (save_breakpoints): Show tilde-expanded filename in error message.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/breakpoint.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 65781db350b..d49a4db8d2d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-08-09 Pedro Alves <palves@redhat.com>
+ * breakpoint.c (save_breakpoints): Show tilde-expanded filename in
+ error message.
+
+2013-08-09 Pedro Alves <palves@redhat.com>
+
* gcore.c (create_gcore_bfd): Don't use tilde_expand here.
(gcore_command): Use tilde_expand here, and when showing the
filename to the user, show the expanded version.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index eec7b7c5499..3b75bc49846 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15460,7 +15460,6 @@ save_breakpoints (char *filename, int from_tty,
{
struct breakpoint *tp;
int any = 0;
- char *pathname;
struct cleanup *cleanup;
struct ui_file *fp;
int extra_trace_bits = 0;
@@ -15496,9 +15495,9 @@ save_breakpoints (char *filename, int from_tty,
return;
}
- pathname = tilde_expand (filename);
- cleanup = make_cleanup (xfree, pathname);
- fp = gdb_fopen (pathname, "w");
+ filename = tilde_expand (filename);
+ cleanup = make_cleanup (xfree, filename);
+ fp = gdb_fopen (filename, "w");
if (!fp)
error (_("Unable to open file '%s' for saving (%s)"),
filename, safe_strerror (errno));
@@ -15568,9 +15567,9 @@ save_breakpoints (char *filename, int from_tty,
if (extra_trace_bits && *default_collect)
fprintf_unfiltered (fp, "set default-collect %s\n", default_collect);
- do_cleanups (cleanup);
if (from_tty)
printf_filtered (_("Saved to file '%s'.\n"), filename);
+ do_cleanups (cleanup);
}
/* The `save breakpoints' command. */