diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-11-27 13:33:17 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-11-28 10:23:18 +0000 |
commit | 4793f551a5aa68522fd5fbbb7e8f621148f410cd (patch) | |
tree | 5ec711d4a93624bd17aec9f6ef30fb8492a43169 /gdb/dwarf2/index-write.c | |
parent | ec7917750c7b1c92d764a5678a6831a3de072380 (diff) | |
download | fsf-binutils-gdb-4793f551a5aa68522fd5fbbb7e8f621148f410cd.zip fsf-binutils-gdb-4793f551a5aa68522fd5fbbb7e8f621148f410cd.tar.gz fsf-binutils-gdb-4793f551a5aa68522fd5fbbb7e8f621148f410cd.tar.bz2 |
gdb: allow use of ~ in 'save gdb-index' command
Add a call to gdb_tilde_expand in the save_gdb_index_command function,
this means that we can now do:
(gdb) save gdb-index ~/blah/
Previous this wouldn't work.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2/index-write.c')
-rw-r--r-- | gdb/dwarf2/index-write.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index d1b10a2..8ee5e42 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -39,6 +39,7 @@ #include "objfiles.h" #include "ada-lang.h" #include "dwarf2/tag.h" +#include "gdbsupport/gdb_tilde_expand.h" #include <algorithm> #include <cmath> @@ -1548,6 +1549,8 @@ save_gdb_index_command (const char *arg, int from_tty) if (!*arg) error (_("usage: save gdb-index [-dwarf-5] DIRECTORY")); + std::string directory (gdb_tilde_expand (arg)); + for (objfile *objfile : current_program_space->objfiles ()) { /* If the objfile does not correspond to an actual file, skip it. */ @@ -1567,8 +1570,8 @@ save_gdb_index_command (const char *arg, int from_tty) if (dwz != NULL) dwz_basename = lbasename (dwz->filename ()); - write_dwarf_index (per_objfile->per_bfd, arg, basename, - dwz_basename, index_kind); + write_dwarf_index (per_objfile->per_bfd, directory.c_str (), + basename, dwz_basename, index_kind); } catch (const gdb_exception_error &except) { |