Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Auto-loading on MS-Windows
@ 2020-07-06 17:35 Eli Zaretskii
  2020-07-06 17:55 ` Hannes Domani
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-07-06 17:35 UTC (permalink / raw)
  To: gdb-patches

I turned on "debug auto-load" today and saw this:

  auto-load: Attempted file "D:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
  auto-load: Expanded $-variables to "d:\usr\lib\debug;d:\usr\share\gdb\9.1/../auto-load".
  auto-load: Searching 'set auto-load scripts-directory' path "$debugdir;$datadir/../auto-load".
  auto-load: Attempted file "d:\usr\lib\debugD:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
  auto-load: Attempted file "d:\usr\share\gdb\9.1/../auto-loadD:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
                                                    ^^^^^^^^^^^^^^^^^^^^^^

Note the underlined part: we are concatenating the auto-load directory
with an absolute Windows file name, and the result is an invalid file
name.  The code in auto_load_objfile_script_1 which does that:

      if (debug_auto_load)
	fprintf_unfiltered (gdb_stdlog, _("auto-load: Searching 'set auto-load "
					  "scripts-directory' path \"%s\".\n"),
			    auto_load_dir);

      for (const gdb::unique_xmalloc_ptr<char> &dir : vec)
	{
	  /* FILENAME is absolute, so we don't need a "/" here.  */
	  debugfile_holder = dir.get () + filename;
	  debugfile = debugfile_holder.c_str ();

	  input = gdb_fopen_cloexec (debugfile, "r");

evidently assumes the absolute file names start with a slash.

I guess on Windows we need to convert "D:\foo\bar" into "\D\foo\bar"
before appending it to the auto-load directory?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Auto-loading on MS-Windows
  2020-07-06 17:35 Auto-loading on MS-Windows Eli Zaretskii
@ 2020-07-06 17:55 ` Hannes Domani
  2020-07-06 18:10   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Hannes Domani @ 2020-07-06 17:55 UTC (permalink / raw)
  To: gdb-patches, Eli Zaretskii

 Am Montag, 6. Juli 2020, 19:35:12 MESZ hat Eli Zaretskii <eliz@gnu.org> Folgendes geschrieben:

> I turned on "debug auto-load" today and saw this:
>
>   auto-load: Attempted file "D:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
>   auto-load: Expanded $-variables to "d:\usr\lib\debug;d:\usr\share\gdb\9.1/../auto-load".
>   auto-load: Searching 'set auto-load scripts-directory' path "$debugdir;$datadir/../auto-load".
>   auto-load: Attempted file "d:\usr\lib\debugD:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
>   auto-load: Attempted file "d:\usr\share\gdb\9.1/../auto-loadD:\gnu\gdb-10.0.50.20200629\gdb\gdb.exe-gdb.py" does not exist.
>                                                     ^^^^^^^^^^^^^^^^^^^^^^
>
> Note the underlined part: we are concatenating the auto-load directory
> with an absolute Windows file name, and the result is an invalid file
> name.  The code in auto_load_objfile_script_1 which does that:
>
>       if (debug_auto_load)
>     fprintf_unfiltered (gdb_stdlog, _("auto-load: Searching 'set auto-load "
>                       "scripts-directory' path \"%s\".\n"),
>                 auto_load_dir);
>
>       for (const gdb::unique_xmalloc_ptr<char> &dir : vec)
>     {
>       /* FILENAME is absolute, so we don't need a "/" here.  */
>       debugfile_holder = dir.get () + filename;
>       debugfile = debugfile_holder.c_str ();
>
>       input = gdb_fopen_cloexec (debugfile, "r");
>
> evidently assumes the absolute file names start with a slash.
>
> I guess on Windows we need to convert "D:\foo\bar" into "\D\foo\bar"
> before appending it to the auto-load directory?

I've sent this patch not too long ago:
https://sourceware.org/pipermail/gdb-patches/2020-May/169125.html

And I've kinda missed to ping it.


Hannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Auto-loading on MS-Windows
  2020-07-06 17:55 ` Hannes Domani
@ 2020-07-06 18:10   ` Eli Zaretskii
  2020-07-06 18:18     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-07-06 18:10 UTC (permalink / raw)
  To: Hannes Domani; +Cc: gdb-patches

> Date: Mon, 6 Jul 2020 17:55:06 +0000 (UTC)
> From: Hannes Domani <ssbssa@yahoo.de>
> 
> > I guess on Windows we need to convert "D:\foo\bar" into "\D\foo\bar"
> > before appending it to the auto-load directory?
> 
> I've sent this patch not too long ago:
> https://sourceware.org/pipermail/gdb-patches/2020-May/169125.html
> 
> And I've kinda missed to ping it.

Thanks, I think you should install this soon, it seems to be a very
old bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Auto-loading on MS-Windows
  2020-07-06 18:10   ` Eli Zaretskii
@ 2020-07-06 18:18     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-07-06 18:18 UTC (permalink / raw)
  To: ssbssa; +Cc: gdb-patches

> Date: Mon, 06 Jul 2020 21:10:57 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb-patches@sourceware.org
> 
> > https://sourceware.org/pipermail/gdb-patches/2020-May/169125.html
> > 
> > And I've kinda missed to ping it.
> 
> Thanks, I think you should install this soon, it seems to be a very
> old bug.

One nit, though:

  +      /* Convert Windows debugfile path from c:/dir/file to /c/dir/file.  */

GNU coding standards frown on using "path" for anything that isn't a
PATH-style directory list.  Suggest to use "file name" instead.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-06 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 17:35 Auto-loading on MS-Windows Eli Zaretskii
2020-07-06 17:55 ` Hannes Domani
2020-07-06 18:10   ` Eli Zaretskii
2020-07-06 18:18     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox