Re: Fix lookup of separate debug file on MS-Windows

Eli Zaretskii
2019-04-27T16:39:35Z

> Cc: gdb-patches@sourceware.org
> From: Simon Marchi <simark@simark.ca>
> Date: Sat, 27 Apr 2019 12:16:23 -0400
>
> I think we should consider the case where we build GDB on GNU/Linux, to remotely
> debug a Windows program. When building on GNU/Linux, HAS_DRIVE_SPEC always return false,
> since it's defined as (see include/filenames.h):
>
> #define HAS_DRIVE_SPEC(f) (0)
>
> Let's suppose DEBUGDIR is "D:/my/debug", DIR is "target:E:/the/directory/" and DEBUGLINK
> is "program.debug". On GNU/Linux, we would build the path
>
> target:D:/my/debug/E:/the/directory/program.debug
>
> And I suppose that the "E:" would result in the debug file not being found.

When debugging remotely, is the debug info on a Windows or on a
GNU/Linux filesystem? If the latter, the above will work. I always
thought that in remote debugging, GDB itself runs on the local host,
i.e. on GNU/Linux in this case, and the part that runs on the remote
is gdbserver. Isn't that correct?

> So I think we should be using HAS_DRIVE_SPEC_1, which allows us to do the same check. We
> just need to pass to the macro whether the target filesystem id DOS-based. The only problem
> is, how do we know whether the target filesystem is DOS-based? We wouldn't want
> HAS_DRIVE_SPEC_1 to do this stripping erroneously when debugging natively on GNU/Linux...

But if we do that, how do we distinguish between the use case you
describe above and a use case where the we debug locally and the file
names just happen to include colons? Are we willing to restrict file
names on GNU/Linux to support the remote debugging on Windows?

Thanks for the other comments, I will implement them when we agree
about the above issue.