* [PATCH v3] Handle Windows drives in auto-load script paths
[not found] <20200708171957.15720-1-ssbssa.ref@yahoo.de>
@ 2020-07-08 17:19 ` Hannes Domani
2020-07-08 18:04 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Domani @ 2020-07-08 17:19 UTC (permalink / raw)
To: gdb-patches
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'.
---
v2:
- Document Windows drive conversion of 'set auto-load scripts-directory'.
v3:
- Change path to file name.
---
gdb/auto-load.c | 7 +++++++
gdb/doc/gdb.texinfo | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 99bd96b971..75013c2283 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -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. */
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index db0ec421dd..1ce9ec78e9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27356,6 +27356,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}).
--
2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] Handle Windows drives in auto-load script paths
2020-07-08 17:19 ` [PATCH v3] Handle Windows drives in auto-load script paths Hannes Domani
@ 2020-07-08 18:04 ` Eli Zaretskii
2020-07-08 18:52 ` Hannes Domani
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2020-07-08 18:04 UTC (permalink / raw)
To: Hannes Domani; +Cc: gdb-patches
> From: Hannes Domani <ssbssa@yahoo.de>
> Date: Wed, 8 Jul 2020 19:19:57 +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'.
This LGTM, as I said earlier.
One minor aesthetic nit, though:
> + debugfile_holder = STRIP_DRIVE_SPEC (debugfile);
> + filename = std::string("/") + debugfile[0] + debugfile_holder;
Perhaps it is slightly better to use "\\" here instead of "/", since
on both sides of that "/D" thing all other separators are backslashes,
so this forward slash looks like the odd one out.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] Handle Windows drives in auto-load script paths
2020-07-08 18:04 ` Eli Zaretskii
@ 2020-07-08 18:52 ` Hannes Domani
0 siblings, 0 replies; 3+ messages in thread
From: Hannes Domani @ 2020-07-08 18:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Am Mittwoch, 8. Juli 2020, 20:04:28 MESZ hat Eli Zaretskii <eliz@gnu.org> Folgendes geschrieben:
> > From: Hannes Domani <ssbssa@yahoo.de>
> > Date: Wed, 8 Jul 2020 19:19:57 +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'.
>
> This LGTM, as I said earlier.
>
> One minor aesthetic nit, though:
>
>
> > + debugfile_holder = STRIP_DRIVE_SPEC (debugfile);
> > + filename = std::string("/") + debugfile[0] + debugfile_holder;
>
>
> Perhaps it is slightly better to use "\\" here instead of "/", since
> on both sides of that "/D" thing all other separators are backslashes,
> so this forward slash looks like the odd one out.
Pushed with this change, thanks.
Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-08 18:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200708171957.15720-1-ssbssa.ref@yahoo.de>
2020-07-08 17:19 ` [PATCH v3] Handle Windows drives in auto-load script paths Hannes Domani
2020-07-08 18:04 ` Eli Zaretskii
2020-07-08 18:52 ` Hannes Domani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).