]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Handle Windows drives in auto-load script paths
authorHannes Domani <ssbssa@yahoo.de>
Wed, 13 May 2020 10:35:51 +0000 (12:35 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Wed, 8 Jul 2020 18:50:43 +0000 (20:50 +0200)
Fixes this testsuite fail on Windows:
FAIL: gdb.base/auto-load.exp: print $script_loaded

Converts the debugfile path from c:/dir/file to /c/dir/file, so it can be
appended to the auto-load path.

gdb/ChangeLog:

2020-07-08  Hannes Domani  <ssbssa@yahoo.de>

* auto-load.c (auto_load_objfile_script_1): Convert drive part
of debugfile path on Windows.

gdb/doc/ChangeLog:

2020-07-08  Hannes Domani  <ssbssa@yahoo.de>

* gdb.texinfo: Document Windows drive conversion of
'set auto-load scripts-directory'.

gdb/ChangeLog
gdb/auto-load.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo

index 4014fe4405e7ba6991001fb03bff5d173bba2569..df9bc04c874ea3015b789035ec36a4c7a4467a98 100644 (file)
@@ -1,3 +1,8 @@
+2020-07-08  Hannes Domani  <ssbssa@yahoo.de>
+
+       * auto-load.c (auto_load_objfile_script_1): Convert drive part
+       of debugfile path on Windows.
+
 2020-07-08  John Baldwin  <jhb@FreeBSD.org>
 
        * fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
index 99bd96b971af98d67f19893fcf13ea059cc9ece0..c967261925a30dfd87664705e9f0a73650ef0fa8 100644 (file)
@@ -784,6 +784,13 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
                                          "scripts-directory' path \"%s\".\n"),
                            auto_load_dir);
 
+      /* Convert Windows file name from c:/dir/file to /c/dir/file.  */
+      if (HAS_DRIVE_SPEC (debugfile))
+       {
+         debugfile_holder = STRIP_DRIVE_SPEC (debugfile);
+         filename = std::string("\\") + debugfile[0] + debugfile_holder;
+       }
+
       for (const gdb::unique_xmalloc_ptr<char> &dir : vec)
        {
          /* FILENAME is absolute, so we don't need a "/" here.  */
index ee6a866258d55266ce75d586d8d6d89841cfd904..0538115b1bf5a9b81ddba4f0b3f987f9a0fbb3d7 100644 (file)
@@ -1,3 +1,8 @@
+2020-07-08  Hannes Domani  <ssbssa@yahoo.de>
+
+       * gdb.texinfo: Document Windows drive conversion of
+       'set auto-load scripts-directory'.
+
 2020-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.texi (Registers): Add @anchor for 'info registers
index fb6fd9eb8705a059a619cf864a80c3691390a98b..1514ff10e8d92f23548a6d9924086ca1f670ed6d 100644 (file)
@@ -27340,6 +27340,10 @@ script in the specified extension language.
 
 If this file does not exist, then @value{GDBN} will look for
 @var{script-name} file in all of the directories as specified below.
+(On MS-Windows/MS-DOS, the drive letter of the executable's leading
+directories is converted to a one-letter subdirectory, i.e.@:
+@file{d:/usr/bin/} is converted to @file{/d/usr/bin/}, because Windows
+filesystems disallow colons in file names.)
 
 Note that loading of these files requires an accordingly configured
 @code{auto-load safe-path} (@pxref{Auto-loading safe path}).