From: Pedro Alves <pedro@palves.net>
To: Lancelot SIX <lancelot.six@amd.com>, gdb-patches@sourceware.org
Cc: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>,
Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb/solib-rocm: add support for file URI on Windows
Date: Wed, 20 May 2026 22:35:06 +0100 [thread overview]
Message-ID: <b8b47678-390d-4e6a-8541-2514ade70fe5@palves.net> (raw)
In-Reply-To: <20260520172256.629890-1-lancelot.six@amd.com>
On 2026-05-20 18:22, Lancelot SIX wrote:
> Current GDB does not really AMDGPU debugging on Windows (there are still
Some word missing, I guess "support".
> a couple of missing necessary pieces), but this patch can still be
> applied upstream and will eventually be needed. I have tested this
> patch on top of the downstream ROCgdb windows branch[1]. I have also
> tested this patch on Linux + gfx1031 on top of master to ensure this
> causes no regression.
>
> [1] https://github.com/ROCm/ROCgdb/tree/amd-temp-windows
> ---
> gdb/solib-rocm.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
> index d9ae4294c98..d8d36d2f3c0 100644
> --- a/gdb/solib-rocm.c
> +++ b/gdb/solib-rocm.c
> @@ -30,6 +30,7 @@
> #include "solib.h"
> #include "solib-svr4.h"
> #include "symfile.h"
> +#include "filesystem.h"
>
> namespace {
>
> @@ -586,6 +587,21 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
>
> if (protocol == "file")
> {
> + /* Windows absolute file path can be encoded with a leading "/" in
> + the URI: "file:///C:/Users/foo/bar". This scheme is not strictly
> + standard but widely used (see RFC 8089 Appendix E.2).
I think this comment has it backwards. "file:///C:/Users/foo/bar" is actually the standard
form per RFC 8089. It's the regular "file://<auth>/<path>" syntax where the authority is
empty and the path-absolute happens to begin with a drive letter, so you get a
leading / before "C:".
The non-standard short form discussed by RFC 8089 Appendix E.2 is:
file:c:/path/to/file
... with no "//" and no leading slash before the drive.
That same appendix states:
'URIs of the form "file:///c:/path/to/file" are already supported by the "path-absolute" rule.'
These are standard.
The code is still correct, though. Once you decode the standard URI you do get "/C:/Users/foo/bar",
and you do need to strip the leading / on DOS-based filesystems to turn it back into a real
Windows path. That's just an artifact of the URI grammar requiring a path-absolute (must
start with /). See RFC 8089 Appendix D.2. It's not because the URI form is non-standard.
I'd suggest rewording the comment to something like:
/* A Windows absolute file path is encoded in a file: URI with a leading
"/" before the drive letter: "file:///C:/Users/foo/bar". See grammar in
RFC 8089 Section 2, the path-absolute production requires the leading "/".
'path-absolute' is defined by RFC 3986 Section 3.3.
After decoding, decoded_path would be "/C:/Users/foo/bar", which is not a
valid Windows path. Drop the leading "/" as a normalization step. */
Otherwise LGTM.
Approved-By: Pedro Alves <pedro@palves.net>
Thanks,
Pedro Alves
next prev parent reply other threads:[~2026-05-20 21:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 17:22 Lancelot SIX
2026-05-20 21:35 ` Pedro Alves [this message]
2026-05-27 10:33 ` Lancelot SIX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8b47678-390d-4e6a-8541-2514ade70fe5@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=lancelot.six@amd.com \
--cc=simon.marchi@efficios.com \
--cc=tankutbaris.aktemur@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox