diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-05-05 16:50:17 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-05-07 22:20:47 +0100 |
commit | 1845e254645efbc02248345ccdb557d265dd8ae1 (patch) | |
tree | f0edd8445b6289107098a9807c1a51dcf4650271 /gdb/testsuite/gdb.guile | |
parent | a3237c7cc7de4b3ea44d8874a0c90dff1f4d31dc (diff) | |
download | gdb-1845e254645efbc02248345ccdb557d265dd8ae1.zip gdb-1845e254645efbc02248345ccdb557d265dd8ae1.tar.gz gdb-1845e254645efbc02248345ccdb557d265dd8ae1.tar.bz2 |
gdb/guile: perform tilde expansion when sourcing guile scripts
Before this patch:
(gdb) source ~/script.scm
ERROR: In procedure apply-smob/1:
ERROR: In procedure primitive-load-path: Unable to find file "~/script.scm" in load path
Error while executing Scheme code.
(gdb)
This is because the path is not tilde expanded. In contrast, when
sourcing a .py or .gdb script the path is tilde expanded.
This commit fixes this oversight, and allows the above source command
to work as expected.
The tilde expansion is done in the generic GDB code before we call the
sourcer function for any particular extension language.
gdb/ChangeLog:
* cli/cli-cmds.c: Add 'gdbsupport/gdb_tilde_expand.h'
include.
(source_script_with_search): Perform tilde expansion.
gdb/testsuite/ChangeLog:
* gdb.guile/guile.exp: Add an extra test.
Diffstat (limited to 'gdb/testsuite/gdb.guile')
-rw-r--r-- | gdb/testsuite/gdb.guile/guile.exp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.guile/guile.exp b/gdb/testsuite/gdb.guile/guile.exp index 6e464cc..0fb8228 100644 --- a/gdb/testsuite/gdb.guile/guile.exp +++ b/gdb/testsuite/gdb.guile/guile.exp @@ -82,3 +82,10 @@ gdb_test_no_output "guile (define a (execute \"help\" #:to-string #t))" \ 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" +} |