Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Pedro Alves <pedro@palves.net>, Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Windows: Normalize backward slashes to forward slashes
Date: Mon, 06 Jul 2026 13:07:14 +0100	[thread overview]
Message-ID: <8733xwuxsd.fsf@redhat.com> (raw)
In-Reply-To: <c1e23730-20a1-4f34-a626-4cd5ec988583@palves.net>

Pedro Alves <pedro@palves.net> writes:

> diff --git a/gdb/filesystem.h b/gdb/filesystem.h
> index 49f8e791ec4..d48d2508c70 100644
> --- a/gdb/filesystem.h
> +++ b/gdb/filesystem.h
> @@ -19,6 +19,8 @@
>  #ifndef GDB_FILESYSTEM_H
>  #define GDB_FILESYSTEM_H
>  
> +#include "gdbsupport/pathstuff.h"
> +
>  extern const char file_system_kind_auto[];
>  extern const char file_system_kind_unix[];
>  extern const char file_system_kind_dos_based[];
> @@ -55,4 +57,45 @@ extern const char *target_lbasename (const char *kind, const char *name);
>     result from this function.  */
>  extern const char *effective_target_file_system_kind (void);
>  
> +/* Return true if GDB should normalize backslashes to forward slashes.
> +   This is true if GDB is running on a system with a DOS-based
> +   filesystem (e.g., Windows), or, if cross debugging and the target
> +   itself has a DOS-based filesystem (e.g., remote debugging Windows
> +   GDBserver from Linux).  */
> +extern bool should_normalize_slashes ();
> +
> +/* Normalizes backslashes to forward slashes in a path string if
> +   necessary, extending the lifetime of the normalized copy for the
> +   duration of the object's scope.
> +
> +   The constructor takes a pointer-to-pointer and updates *PATH to
> +   point at the normalized string when normalization is needed, so
> +   callers need only:
> +
> +     scoped_normalized_path path_storage (&path);
> +
> +   and then use PATH directly without a separate reassignment.  */
> +struct scoped_normalized_path
> +{
> +  explicit scoped_normalized_path (const char **path)
> +  {
> +    gdb_assert (path != nullptr);

It's not a problem in any of the existing code, but maybe also:

  gdb_assert (*path != nullptr);

otherwise we end up trying to create a std::string from NULL.

I looked through the rest of the changes, and it all looks reasonable to
me.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew


  parent reply	other threads:[~2026-07-06 12:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 21:24 [PATCH] " Pedro Alves
2026-06-30 11:26 ` Eli Zaretskii
2026-06-30 14:47   ` Pedro Alves
2026-06-30 15:11     ` Eli Zaretskii
2026-07-01 11:28       ` [PATCH v2] " Pedro Alves
2026-07-01 12:07         ` Eli Zaretskii
2026-07-01 19:28           ` Pedro Alves
2026-07-02  5:28             ` Eli Zaretskii
2026-07-06 12:07         ` Andrew Burgess [this message]
2026-07-06 22:35           ` Pedro Alves

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=8733xwuxsd.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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