+2021-05-07 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * cli/cli-cmds.c: Add 'gdbsupport/gdb_tilde_expand.h'
+ include.
+ (source_script_with_search): Perform tilde expansion.
+
2021-05-07 Simon Marchi <simon.marchi@polymtl.ca>
* target-descriptions.c (struct target_desc_info) <filename>:
#include "extension.h"
#include "gdbsupport/pathstuff.h"
+#include "gdbsupport/gdb_tilde_expand.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */
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
+2021-05-07 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.guile/guile.exp: Add an extra test.
+
2021-05-07 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.base/ptype-offsets.exp: Replace use of send_gdb with
gdb_test "guile (print a)" "= .*aliases -- User-defined aliases of other commands.*" \
"verify help to uiout"
+
+# Verify that we can source a guile script using ~ for the HOME directory.
+save_vars { env(HOME) } {
+ set env(HOME) $srcdir/$subdir
+ clean_restart
+ gdb_test "source ~/source2.scm" "yes"
+}