aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r--gdb/cli/cli-cmds.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 68ef92e..62948f5 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -54,6 +54,7 @@
#include "extension.h"
#include "gdbsupport/pathstuff.h"
+#include "gdbsupport/gdb_tilde_expand.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */
@@ -737,8 +738,16 @@ source_script_with_search (const char *file, int from_tty, int search_path)
anyway so that error messages show the actual file used. But only do
this if we (may have) used search_path, as printing the full path in
errors for the non-search case can be more noise than signal. */
- source_script_from_stream (opened->stream.get (), file,
- search_path ? opened->full_path.get () : file);
+ const char *file_to_open;
+ gdb::unique_xmalloc_ptr<char> tilde_expanded_file;
+ if (search_path)
+ file_to_open = opened->full_path.get ();
+ else
+ {
+ tilde_expanded_file = gdb_tilde_expand_up (file);
+ file_to_open = tilde_expanded_file.get ();
+ }
+ source_script_from_stream (opened->stream.get (), file, file_to_open);
}
/* Wrapper around source_script_with_search to export it to main.c