[06/11] gdb: Use std::string_view instead of gdb::string_view

Message ID 20231013144418.3180617-7-lancelot.six@amd.com
State New
Headers
Series GDB: Require C++17 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Testing failed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Testing failed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Lancelot SIX Oct. 13, 2023, 2:44 p.m. UTC
  Given that GDB now requires a C++17, replace all uses of
gdb::string_view with std::string_view.

This change has mostly been done automatically:
- gdb::string_view -> std::string_view
- #include "gdbsupport/gdb_string_view.h" -> #include <string_view>

The implementation and tests of gdb::string_view are unchanged, they will
be removed in a following patch.

Change-Id: Ibb806a7e9c79eb16a55c87c6e41ad396fecf0207
---
 gdb/ada-lang.c               |  8 +++---
 gdb/amdgpu-tdep.c            | 50 ++++++++++++++++++------------------
 gdb/cli/cli-script.c         |  4 +--
 gdb/dbxread.c                | 18 ++++++-------
 gdb/debuginfod-support.c     |  6 ++---
 gdb/dwarf2/cooked-index.c    |  6 ++---
 gdb/dwarf2/cooked-index.h    |  2 +-
 gdb/dwarf2/index-common.c    |  2 +-
 gdb/dwarf2/index-common.h    |  2 +-
 gdb/dwarf2/read.c            |  2 +-
 gdb/elfread.c                |  8 +++---
 gdb/language.c               |  2 +-
 gdb/linux-tdep.c             |  8 +++---
 gdb/mdebugread.c             | 18 ++++++-------
 gdb/minsyms.c                |  4 +--
 gdb/minsyms.h                |  2 +-
 gdb/psymtab.c                |  2 +-
 gdb/psymtab.h                |  4 +--
 gdb/solib-rocm.c             | 20 +++++++--------
 gdb/split-name.c             |  4 +--
 gdb/split-name.h             |  4 +--
 gdb/stabsread.c              |  2 +-
 gdb/symtab.c                 | 14 +++++-----
 gdb/symtab.h                 | 14 +++++-----
 gdb/tui/tui-io.c             |  2 +-
 gdb/tui/tui-win.c            |  6 ++---
 gdb/xcoffread.c              | 18 ++++++-------
 gdbsupport/common-utils.h    |  8 +++---
 gdbsupport/format.h          |  4 +--
 gdbsupport/gdb_string_view.h |  2 +-
 30 files changed, 123 insertions(+), 123 deletions(-)
  

Comments

Tom Tromey Oct. 14, 2023, 9:50 p.m. UTC | #1
>>>>> "Lancelot" == Lancelot Six <lancelot.six@amd.com> writes:

Lancelot> Given that GDB now requires a C++17, replace all uses of
Lancelot> gdb::string_view with std::string_view.

Lancelot> This change has mostly been done automatically:
Lancelot> - gdb::string_view -> std::string_view
Lancelot> - #include "gdbsupport/gdb_string_view.h" -> #include <string_view>

Lancelot> The implementation and tests of gdb::string_view are unchanged, they will
Lancelot> be removed in a following patch.

IIRC there are some spots using gdb::string_view that construct one with
nullptr, which isn't allowed by std::string_view.  Maybe a test run
using the libstdc++ debug mode would detect this?

Tom
  
Lancelot SIX Oct. 14, 2023, 11:58 p.m. UTC | #2
[AMD Official Use Only - General]

> Lancelot> The implementation and tests of gdb::string_view are unchanged,
> they will
> Lancelot> be removed in a following patch.
>
> IIRC there are some spots using gdb::string_view that construct one with
> nullptr, which isn't allowed by std::string_view.  Maybe a test run
> using the libstdc++ debug mode would detect this?
>
> Tom

I was not aware of this. I'll do re-do regression testing using libstdc++'s debug mode.

Thanks,
Lancelot.
  
Lancelot SIX Oct. 16, 2023, 3:06 p.m. UTC | #3
On 14/10/2023 22:50, Tom Tromey wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
>>>>>> "Lancelot" == Lancelot Six <lancelot.six@amd.com> writes:
> 
> Lancelot> Given that GDB now requires a C++17, replace all uses of
> Lancelot> gdb::string_view with std::string_view.
> 
> Lancelot> This change has mostly been done automatically:
> Lancelot> - gdb::string_view -> std::string_view
> Lancelot> - #include "gdbsupport/gdb_string_view.h" -> #include <string_view>
> 
> Lancelot> The implementation and tests of gdb::string_view are unchanged, they will
> Lancelot> be removed in a following patch.
> 
> IIRC there are some spots using gdb::string_view that construct one with
> nullptr, which isn't allowed by std::string_view.  Maybe a test run
> using the libstdc++ debug mode would detect this?
> 
> Tom

Hi,

It looks like libstdc++'s debug mode won't catch this, but this leads to 
a segfault on my system, so I am fairly confident with the testing.

That being said, I went through the patch again. I think one use can be 
a problem (but is not exercised by the testsuite), and one might be 
worth adding an assertion, just in case.  I have added the following 
locally and am extending the commit message.  It will be in a V2, but 
I'll wait for other comment (if any) before sending it.

Best,
Lancelot.

---
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 83218dc4797..78bafec38ca 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -1197,7 +1197,10 @@ tui_getc_1 (FILE *fp)
          Compare keyname instead.  */
        if (ch >= KEY_MAX)
         {
-         auto name = std::string_view (keyname (ch));
+         std::string_view name;
+         if (const char *name_str = keyname (ch);
+             name_str != nullptr)
+           name = std::string_view (name_str);

           /* The following sequences are hardcoded in readline as
              well.  */
diff --git a/gdbsupport/format.h b/gdbsupport/format.h
index 5330bbe361e..26e327a60e8 100644
--- a/gdbsupport/format.h
+++ b/gdbsupport/format.h
@@ -56,6 +56,7 @@ struct format_piece
        argclass (argc),
        n_int_args (n)
    {
+    gdb_assert (str != nullptr);
    }

    bool operator== (const format_piece &other) const
  
Tom Tromey Oct. 16, 2023, 7:35 p.m. UTC | #4
>>>>> "Lancelot" == Lancelot SIX <Lancelot.Six@amd.com> writes:

Lancelot> +         std::string_view name;
Lancelot> +         if (const char *name_str = keyname (ch);
Lancelot> +             name_str != nullptr)

We should probably discuss whether to allow this construct before
letting it in.

Personally I'm ok with it.

Tom
  
Pedro Alves Oct. 16, 2023, 9:51 p.m. UTC | #5
On 2023-10-16 20:35, Tom Tromey wrote:
>>>>>> "Lancelot" == Lancelot SIX <Lancelot.Six@amd.com> writes:
> 
> Lancelot> +         std::string_view name;
> Lancelot> +         if (const char *name_str = keyname (ch);
> Lancelot> +             name_str != nullptr)
> 
> We should probably discuss whether to allow this construct before
> letting it in.
> 
> Personally I'm ok with it.

I think it may look a little weird if you're not used to it (like I am not), but
OTOH it isn't really different from introducing a variable to scope with "for", like:

 for (const char *name_str = keyname (ch);
      name_str != nullptr; ....)
   ....

so I suspect we'll all just get used to it and think nothing of it in a few years.

So am I fine with it too.
  
Lancelot SIX Oct. 17, 2023, 2:13 p.m. UTC | #6
Hi,

On 16/10/2023 22:51, Pedro Alves wrote:

>> Lancelot> +         std::string_view name;
>> Lancelot> +         if (const char *name_str = keyname (ch);
>> Lancelot> +             name_str != nullptr)
>>
>> We should probably discuss whether to allow this construct before
>> letting it in.
>>
>> Personally I'm ok with it.
> 
> I think it may look a little weird if you're not used to it (like I am not), but
> OTOH it isn't really different from introducing a variable to scope with "for", like:
> 
>   for (const char *name_str = keyname (ch);
>        name_str != nullptr; ....)
>     ....
> 
> so I suspect we'll all just get used to it and think nothing of it in a few years.
> 
> So am I fine with it too.
> 

I don't mind not using this for now.  The "name_str" will be declared 
outside of the if scope for now.

If this construct is comes in, there will also be the question of coding 
style (i.e. single line if line length permits or multiple lines as 
I did here).  I guess we could go the same way we do for "for" and 
prefer single line.

Best,
Lancelot.
  
Simon Marchi Oct. 17, 2023, 2:20 p.m. UTC | #7
On 10/17/23 10:13, Lancelot SIX wrote:
> Hi,
> 
> On 16/10/2023 22:51, Pedro Alves wrote:
> 
>>> Lancelot> +         std::string_view name;
>>> Lancelot> +         if (const char *name_str = keyname (ch);
>>> Lancelot> +             name_str != nullptr)
>>>
>>> We should probably discuss whether to allow this construct before
>>> letting it in.
>>>
>>> Personally I'm ok with it.
>>
>> I think it may look a little weird if you're not used to it (like I am not), but
>> OTOH it isn't really different from introducing a variable to scope with "for", like:
>>
>>   for (const char *name_str = keyname (ch);
>>        name_str != nullptr; ....)
>>     ....
>>
>> so I suspect we'll all just get used to it and think nothing of it in a few years.
>>
>> So am I fine with it too.
>>
> 
> I don't mind not using this for now.  The "name_str" will be declared outside of the if scope for now.
> 
> If this construct is comes in, there will also be the question of coding style (i.e. single line if line length permits or multiple lines as I did here).  I guess we could go the same way we do for "for" and prefer single line.

I didn't even know this construct existed, I was a bit shocked at first
:P.  But once you said "it's just like for", it looked just fine to me.

Declaring variables in the narrowest scope possible has its technical
merits, so I think we should allow that construct.  I think it's fine to
put it on one line if it fits.

Simon
  

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 58c70160d31..3e394619399 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1035,7 +1035,7 @@  find_case_fold_entry (uint32_t c)
    rather than emitting a warning.  Result good to next call.  */
 
 static const char *
-ada_fold_name (gdb::string_view name, bool throw_on_error = false)
+ada_fold_name (std::string_view name, bool throw_on_error = false)
 {
   static std::string fold_storage;
 
@@ -13250,7 +13250,7 @@  do_exact_match (const char *symbol_search_name,
 
 ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
 {
-  gdb::string_view user_name = lookup_name.name ();
+  std::string_view user_name = lookup_name.name ();
 
   if (!user_name.empty () && user_name[0] == '<')
     {
@@ -13269,7 +13269,7 @@  ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
     {
       m_verbatim_p = false;
 
-      m_encoded_p = user_name.find ("__") != gdb::string_view::npos;
+      m_encoded_p = user_name.find ("__") != std::string_view::npos;
 
       if (!m_encoded_p)
 	{
@@ -13326,7 +13326,7 @@  literal_symbol_name_matcher (const char *symbol_search_name,
 			     const lookup_name_info &lookup_name,
 			     completion_match_result *comp_match_res)
 {
-  gdb::string_view name_view = lookup_name.name ();
+  std::string_view name_view = lookup_name.name ();
 
   if (lookup_name.completion_mode ()
       ? (strncmp (symbol_search_name, name_view.data (),
diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
index 3a521a43977..48dc8db6bcc 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -237,7 +237,7 @@  struct amd_dbgapi_register_type_flags : public amd_dbgapi_register_type
   using container_type = std::vector<field>;
   using const_iterator_type = container_type::const_iterator;
 
-  amd_dbgapi_register_type_flags (unsigned int bit_size, gdb::string_view name)
+  amd_dbgapi_register_type_flags (unsigned int bit_size, std::string_view name)
     : amd_dbgapi_register_type (kind::FLAGS,
 				make_lookup_name (bit_size, name)),
       m_bit_size (bit_size),
@@ -270,7 +270,7 @@  struct amd_dbgapi_register_type_flags : public amd_dbgapi_register_type
   const std::string &name () const
   { return m_name; }
 
-  static std::string make_lookup_name (int bits, gdb::string_view name)
+  static std::string make_lookup_name (int bits, std::string_view name)
   {
     std::string res = string_printf ("flags%d_t ", bits);
     res.append (name.data (), name.size ());
@@ -297,7 +297,7 @@  struct amd_dbgapi_register_type_enum : public amd_dbgapi_register_type
   using container_type = std::vector<enumerator>;
   using const_iterator_type = container_type::const_iterator;
 
-  amd_dbgapi_register_type_enum (gdb::string_view name)
+  amd_dbgapi_register_type_enum (std::string_view name)
     : amd_dbgapi_register_type (kind::ENUM, make_lookup_name (name)),
       m_name (name.data (), name.length ())
   {}
@@ -326,7 +326,7 @@  struct amd_dbgapi_register_type_enum : public amd_dbgapi_register_type
   const std::string &name () const
   { return m_name; }
 
-  static std::string make_lookup_name (gdb::string_view name)
+  static std::string make_lookup_name (std::string_view name)
   {
     std::string res = "enum ";
     res.append (name.data (), name.length ());
@@ -349,7 +349,7 @@  using amd_dbgapi_register_type_map
 /* Parse S as a ULONGEST, raise an error on overflow.  */
 
 static ULONGEST
-try_strtoulst (gdb::string_view s)
+try_strtoulst (std::string_view s)
 {
   errno = 0;
   ULONGEST value = strtoulst (s.data (), nullptr, 0);
@@ -365,7 +365,7 @@  try_strtoulst (gdb::string_view s)
 #define WSOPT "[ \t]*"
 
 static const amd_dbgapi_register_type &
-parse_amd_dbgapi_register_type (gdb::string_view type_name,
+parse_amd_dbgapi_register_type (std::string_view type_name,
 				amd_dbgapi_register_type_map &type_map);
 
 
@@ -373,7 +373,7 @@  parse_amd_dbgapi_register_type (gdb::string_view type_name,
 
 static void
 parse_amd_dbgapi_register_type_enum_fields
-  (amd_dbgapi_register_type_enum &enum_type, gdb::string_view fields)
+  (amd_dbgapi_register_type_enum &enum_type, std::string_view fields)
 {
   compiled_regex regex (/* name */
 			"^(" IDENTIFIER ")"
@@ -394,8 +394,8 @@  parse_amd_dbgapi_register_type_enum_fields
       auto sv_from_match = [fields] (const regmatch_t &m)
 	{ return fields.substr (m.rm_so, m.rm_eo - m.rm_so); };
 
-      gdb::string_view name = sv_from_match (matches[1]);
-      gdb::string_view value_str = sv_from_match (matches[2]);
+      std::string_view name = sv_from_match (matches[1]);
+      std::string_view value_str = sv_from_match (matches[2]);
       ULONGEST value = try_strtoulst (value_str);
 
       if (value > std::numeric_limits<uint32_t>::max ())
@@ -412,7 +412,7 @@  parse_amd_dbgapi_register_type_enum_fields
 static void
 parse_amd_dbgapi_register_type_flags_fields
   (amd_dbgapi_register_type_flags &flags_type,
-   int bits, gdb::string_view name, gdb::string_view fields,
+   int bits, std::string_view name, std::string_view fields,
    amd_dbgapi_register_type_map &type_map)
 {
   gdb_assert (bits == 32 || bits == 64);
@@ -439,9 +439,9 @@  parse_amd_dbgapi_register_type_flags_fields
       auto sv_from_match = [fields] (const regmatch_t &m)
 	{ return fields.substr (m.rm_so, m.rm_eo - m.rm_so); };
 
-      gdb::string_view field_type_str = sv_from_match (matches[1]);
-      gdb::string_view field_name = sv_from_match (matches[3]);
-      gdb::string_view pos_begin_str = sv_from_match (matches[4]);
+      std::string_view field_type_str = sv_from_match (matches[1]);
+      std::string_view field_name = sv_from_match (matches[3]);
+      std::string_view pos_begin_str = sv_from_match (matches[4]);
       ULONGEST pos_begin = try_strtoulst (pos_begin_str);
 
       if (field_type_str == "bool")
@@ -452,7 +452,7 @@  parse_amd_dbgapi_register_type_flags_fields
 	  if (matches[5].rm_so == -1)
 	    error (_("Missing end bit position"));
 
-	  gdb::string_view pos_end_str = sv_from_match (matches[5]);
+	  std::string_view pos_end_str = sv_from_match (matches[5]);
 	  ULONGEST pos_end = try_strtoulst (pos_end_str.substr (1));
 	  const amd_dbgapi_register_type &field_type
 	    = parse_amd_dbgapi_register_type (field_type_str, type_map);
@@ -467,7 +467,7 @@  parse_amd_dbgapi_register_type_flags_fields
 /* parse_amd_dbgapi_register_type helper for scalars.  */
 
 static const amd_dbgapi_register_type &
-parse_amd_dbgapi_register_type_scalar (gdb::string_view name,
+parse_amd_dbgapi_register_type_scalar (std::string_view name,
 				       amd_dbgapi_register_type_map &type_map)
 {
   std::string name_str = gdb::to_string (name);
@@ -513,24 +513,24 @@  parse_amd_dbgapi_register_type_scalar (gdb::string_view name,
    details about the format.  */
 
 static const amd_dbgapi_register_type &
-parse_amd_dbgapi_register_type (gdb::string_view type_str,
+parse_amd_dbgapi_register_type (std::string_view type_str,
 				amd_dbgapi_register_type_map &type_map)
 {
   size_t pos_open_bracket = type_str.find_last_of ('[');
   auto sv_from_match = [type_str] (const regmatch_t &m)
     { return type_str.substr (m.rm_so, m.rm_eo - m.rm_so); };
 
-  if (pos_open_bracket != gdb::string_view::npos)
+  if (pos_open_bracket != std::string_view::npos)
     {
       /* Vector types.  */
-      gdb::string_view element_type_str
+      std::string_view element_type_str
 	= type_str.substr (0, pos_open_bracket);
       const amd_dbgapi_register_type &element_type
 	= parse_amd_dbgapi_register_type (element_type_str, type_map);
 
       size_t pos_close_bracket = type_str.find_last_of (']');
-      gdb_assert (pos_close_bracket != gdb::string_view::npos);
-      gdb::string_view count_str_view
+      gdb_assert (pos_close_bracket != std::string_view::npos);
+      std::string_view count_str_view
 	= type_str.substr (pos_open_bracket + 1,
 			    pos_close_bracket - pos_open_bracket);
       std::string count_str = gdb::to_string (count_str_view);
@@ -567,9 +567,9 @@  parse_amd_dbgapi_register_type (gdb::string_view type_str,
       if (res == REG_NOMATCH)
 	error (_("Failed to parse flags type string"));
 
-      gdb::string_view flags_keyword = sv_from_match (matches[1]);
+      std::string_view flags_keyword = sv_from_match (matches[1]);
       unsigned int bit_size = flags_keyword == "flags32_t" ? 32 : 64;
-      gdb::string_view name = sv_from_match (matches[2]);
+      std::string_view name = sv_from_match (matches[2]);
       std::string lookup_name
 	= amd_dbgapi_register_type_flags::make_lookup_name (bit_size, name);
       auto existing_type_it = type_map.find (lookup_name);
@@ -596,7 +596,7 @@  parse_amd_dbgapi_register_type (gdb::string_view type_str,
 
 	  amd_dbgapi_register_type_flags_up flags_type
 	    (new amd_dbgapi_register_type_flags (bit_size, name));
-	  gdb::string_view fields_without_braces = sv_from_match (matches[4]);
+	  std::string_view fields_without_braces = sv_from_match (matches[4]);
 
 	  parse_amd_dbgapi_register_type_flags_fields
 	    (*flags_type, bit_size, name, fields_without_braces, type_map);
@@ -620,7 +620,7 @@  parse_amd_dbgapi_register_type (gdb::string_view type_str,
       if (res == REG_NOMATCH)
 	error (_("Failed to parse flags type string"));
 
-      gdb::string_view name = sv_from_match (matches[1]);
+      std::string_view name = sv_from_match (matches[1]);
 
       std::string lookup_name
 	= amd_dbgapi_register_type_enum::make_lookup_name (name);
@@ -648,7 +648,7 @@  parse_amd_dbgapi_register_type (gdb::string_view type_str,
 
 	  amd_dbgapi_register_type_enum_up enum_type
 	    (new amd_dbgapi_register_type_enum (name));
-	  gdb::string_view fields_without_braces = sv_from_match (matches[3]);
+	  std::string_view fields_without_braces = sv_from_match (matches[3]);
 
 	  parse_amd_dbgapi_register_type_enum_fields
 	    (*enum_type, fields_without_braces);
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 8ec5689ebcf..b355a6dc81e 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -35,7 +35,7 @@ 
 #include "extension.h"
 #include "interps.h"
 #include "compile/compile.h"
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "python/python.h"
 #include "guile/guile.h"
 
@@ -103,7 +103,7 @@  class user_args
   std::string m_command_line;
 
   /* The arguments.  Each element points inside M_COMMAND_LINE.  */
-  std::vector<gdb::string_view> m_args;
+  std::vector<std::string_view> m_args;
 };
 
 /* The stack of arguments passed to user defined functions.  We need a
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 3afafa77fb4..b92193bdadd 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1483,7 +1483,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 	    {
 	    case 'S':
 	      if (pst != nullptr)
-		pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+		pst->add_psymbol (std::string_view (sym_name, sym_len), true,
 				  VAR_DOMAIN, LOC_STATIC,
 				  data_sect_index,
 				  psymbol_placement::STATIC,
@@ -1500,7 +1500,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 	      /* The addresses in these entries are reported to be
 		 wrong.  See the code that reads 'G's for symtabs.  */
 	      if (pst != nullptr)
-		pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+		pst->add_psymbol (std::string_view (sym_name, sym_len), true,
 				  VAR_DOMAIN, LOC_STATIC,
 				  data_sect_index,
 				  psymbol_placement::GLOBAL,
@@ -1525,7 +1525,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 		      && namestring[0] != ' '))
 		{
 		  if (pst != nullptr)
-		    pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+		    pst->add_psymbol (std::string_view (sym_name, sym_len),
 				      true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 				      psymbol_placement::STATIC,
 				      unrelocated_addr (0),
@@ -1540,7 +1540,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 		    {
 		      /* Also a typedef with the same name.  */
 		      if (pst != nullptr)
-			pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+			pst->add_psymbol (std::string_view (sym_name, sym_len),
 					  true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 					  psymbol_placement::STATIC,
 					  unrelocated_addr (0),
@@ -1559,7 +1559,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 	      if (p != namestring)	/* a name is there, not just :T...  */
 		{
 		  if (pst != nullptr)
-		    pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+		    pst->add_psymbol (std::string_view (sym_name, sym_len),
 				      true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 				      psymbol_placement::STATIC,
 				      unrelocated_addr (0),
@@ -1627,7 +1627,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 		      /* Note that the value doesn't matter for
 			 enum constants in psymtabs, just in symtabs.  */
 		      if (pst != nullptr)
-			pst->add_psymbol (gdb::string_view (p, q - p), true,
+			pst->add_psymbol (std::string_view (p, q - p), true,
 					  VAR_DOMAIN, LOC_CONST, -1,
 					  psymbol_placement::STATIC,
 					  unrelocated_addr (0),
@@ -1652,7 +1652,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 	    case 'c':
 	      /* Constant, e.g. from "const" in Pascal.  */
 	      if (pst != nullptr)
-		pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+		pst->add_psymbol (std::string_view (sym_name, sym_len), true,
 				  VAR_DOMAIN, LOC_CONST, -1,
 				  psymbol_placement::STATIC,
 				  unrelocated_addr (0),
@@ -1712,7 +1712,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 		  textlow_not_set = 0;
 		}
 	      if (pst != nullptr)
-		pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+		pst->add_psymbol (std::string_view (sym_name, sym_len), true,
 				  VAR_DOMAIN, LOC_BLOCK,
 				  SECT_OFF_TEXT (objfile),
 				  psymbol_placement::STATIC,
@@ -1771,7 +1771,7 @@  read_dbx_symtab (minimal_symbol_reader &reader,
 		  textlow_not_set = 0;
 		}
 	      if (pst != nullptr)
-		pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+		pst->add_psymbol (std::string_view (sym_name, sym_len), true,
 				  VAR_DOMAIN, LOC_BLOCK,
 				  SECT_OFF_TEXT (objfile),
 				  psymbol_placement::GLOBAL,
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 1ebd98ca705..0e202ff5d96 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -246,11 +246,11 @@  debuginfod_is_enabled ()
       gdb_printf (_("\nThis GDB supports auto-downloading debuginfo " \
 		    "from the following URLs:\n"));
 
-      gdb::string_view url_view (urls);
+      std::string_view url_view (urls);
       while (true)
 	{
 	  size_t off = url_view.find_first_not_of (' ');
-	  if (off == gdb::string_view::npos)
+	  if (off == std::string_view::npos)
 	    break;
 	  url_view = url_view.substr (off);
 	  /* g++ 11.2.1 on s390x, g++ 11.3.1 on ppc64le and g++ 11 on
@@ -266,7 +266,7 @@  debuginfod_is_enabled ()
 	     styled_string (file_name_style.style (),
 			    gdb::to_string (url_view.substr (0,
 							     off)).c_str ()));
-	  if (off == gdb::string_view::npos)
+	  if (off == std::string_view::npos)
 	    break;
 	  url_view = url_view.substr (off);
 	}
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 58ea541a5c9..7c4af3a1681 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -266,9 +266,9 @@  cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
   std::string canonical = ada_decode (entry->name, false, false);
   if (canonical.empty ())
     return {};
-  std::vector<gdb::string_view> names = split_name (canonical.c_str (),
+  std::vector<std::string_view> names = split_name (canonical.c_str (),
 						    split_style::DOT_STYLE);
-  gdb::string_view tail = names.back ();
+  std::string_view tail = names.back ();
   names.pop_back ();
 
   const cooked_index_entry *parent = nullptr;
@@ -333,7 +333,7 @@  cooked_index_shard::do_finalize ()
   auto eq_entry = [] (const void *a, const void *b) -> int
     {
       const cooked_index_entry *ae = (const cooked_index_entry *) a;
-      const gdb::string_view *sv = (const gdb::string_view *) b;
+      const std::string_view *sv = (const std::string_view *) b;
       return (strlen (ae->canonical) == sv->length ()
 	      && strncasecmp (ae->canonical, sv->data (), sv->length ()) == 0);
     };
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 5aacb321c91..5675ea68bb8 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -25,7 +25,7 @@ 
 #include "symtab.h"
 #include "hashtab.h"
 #include "dwarf2/index-common.h"
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "quick-symbol.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "addrmap.h"
diff --git a/gdb/dwarf2/index-common.c b/gdb/dwarf2/index-common.c
index 07330a86da1..04b04f93a61 100644
--- a/gdb/dwarf2/index-common.c
+++ b/gdb/dwarf2/index-common.c
@@ -58,7 +58,7 @@  dwarf5_djb_hash (const char *str_)
 /* See dwarf-index-common.h.  */
 
 uint32_t
-dwarf5_djb_hash (gdb::string_view str)
+dwarf5_djb_hash (std::string_view str)
 {
   /* Note: tolower here ignores UTF-8, which isn't fully compliant.
      See http://dwarfstd.org/ShowIssue.php?issue=161027.1.  */
diff --git a/gdb/dwarf2/index-common.h b/gdb/dwarf2/index-common.h
index 23e814a240b..79d3a59220e 100644
--- a/gdb/dwarf2/index-common.h
+++ b/gdb/dwarf2/index-common.h
@@ -54,6 +54,6 @@  uint32_t dwarf5_djb_hash (const char *str_);
 
 /* Symbol name hashing function as specified by DWARF-5.  */
 
-uint32_t dwarf5_djb_hash (gdb::string_view str_);
+uint32_t dwarf5_djb_hash (std::string_view str_);
 
 #endif /* DWARF_INDEX_COMMON_H */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e40353975c1..1846f7160cc 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16884,7 +16884,7 @@  cooked_index_functions::expand_symtabs_matching
 
   for (enum language lang : unique_styles)
     {
-      std::vector<gdb::string_view> name_vec
+      std::vector<std::string_view> name_vec
 	= lookup_name_without_params.split_name (lang);
       std::string last_name = gdb::to_string (name_vec.back ());
 
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 7900dfbc388..e153dfcedd3 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -46,7 +46,7 @@ 
 #include "auxv.h"
 #include "mdebugread.h"
 #include "ctfread.h"
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "gdbsupport/scoped_fd.h"
 #include "debuginfod-support.h"
 #include "dwarf2/public.h"
@@ -197,7 +197,7 @@  elf_locate_sections (asection *sectp, struct elfinfo *ei)
 
 static struct minimal_symbol *
 record_minimal_symbol (minimal_symbol_reader &reader,
-		       gdb::string_view name, bool copy_name,
+		       std::string_view name, bool copy_name,
 		       unrelocated_addr address,
 		       enum minimal_symbol_type ms_type,
 		       asection *bfd_section, struct objfile *objfile)
@@ -505,7 +505,7 @@  elf_symtab_read (minimal_symbol_reader &reader,
 		  && !is_plt
 		  && (elf_sym->version & VERSYM_HIDDEN) == 0)
 		record_minimal_symbol (reader,
-				       gdb::string_view (sym->name, len),
+				       std::string_view (sym->name, len),
 				       true, unrelocated_addr (symaddr),
 				       ms_type, sym->section, objfile);
 	      else if (is_plt)
@@ -519,7 +519,7 @@  elf_symtab_read (minimal_symbol_reader &reader,
 		      struct minimal_symbol *mtramp;
 
 		      mtramp = record_minimal_symbol
-			(reader, gdb::string_view (sym->name, len), true,
+			(reader, std::string_view (sym->name, len), true,
 			 unrelocated_addr (symaddr),
 			 mst_solib_trampoline, sym->section, objfile);
 		      if (mtramp)
diff --git a/gdb/language.c b/gdb/language.c
index c768971be42..cfd4a621e6b 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -641,7 +641,7 @@  default_symbol_name_matcher (const char *symbol_search_name,
 			     const lookup_name_info &lookup_name,
 			     completion_match_result *comp_match_res)
 {
-  gdb::string_view name = lookup_name.name ();
+  std::string_view name = lookup_name.name ();
   completion_match_for_lcd *match_for_lcd
     = (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
   strncmp_iw_mode mode = (lookup_name.completion_mode ()
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 6dcc56cd562..c71f5a6dcd3 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -457,13 +457,13 @@  struct mapping
 {
   ULONGEST addr;
   ULONGEST endaddr;
-  gdb::string_view permissions;
+  std::string_view permissions;
   ULONGEST offset;
-  gdb::string_view device;
+  std::string_view device;
   ULONGEST inode;
 
   /* This field is guaranteed to be NULL-terminated, hence it is not a
-     gdb::string_view.  */
+     std::string_view.  */
   const char *filename;
 };
 
@@ -1384,7 +1384,7 @@  parse_smaps_data (const char *data,
 
       /* Decode permissions.  */
       auto has_perm = [&m] (char c)
-	{ return m.permissions.find (c) != gdb::string_view::npos; };
+	{ return m.permissions.find (c) != std::string_view::npos; };
       read = has_perm ('r');
       write = has_perm ('w');
       exec = has_perm ('x');
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index cd6638224e7..fc731605991 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -3050,7 +3050,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 		    switch (p[1])
 		      {
 		      case 'S':
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_STATIC,
 					  SECT_OFF_DATA (objfile),
@@ -3063,7 +3063,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 			/* The addresses in these entries are reported
 			   to be wrong.  See the code that reads 'G's
 			   for symtabs.  */
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_STATIC,
 					  SECT_OFF_DATA (objfile),
@@ -3085,7 +3085,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 				&& namestring[0] != ' '))
 			  {
 			    pst->add_psymbol
-			      (gdb::string_view (namestring, p - namestring),
+			      (std::string_view (namestring, p - namestring),
 			       true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 			       psymbol_placement::STATIC,
 			       unrelocated_addr (0),
@@ -3095,7 +3095,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 			      {
 				/* Also a typedef with the same name.  */
 				pst->add_psymbol
-				  (gdb::string_view (namestring,
+				  (std::string_view (namestring,
 						     p - namestring),
 				   true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 				   psymbol_placement::STATIC,
@@ -3111,7 +3111,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 						   just :T...  */
 			  {
 			    pst->add_psymbol
-			      (gdb::string_view (namestring,
+			      (std::string_view (namestring,
 						 p - namestring),
 			       true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 			       psymbol_placement::STATIC,
@@ -3178,7 +3178,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 				/* Note that the value doesn't matter for
 				   enum constants in psymtabs, just in
 				   symtabs.  */
-				pst->add_psymbol (gdb::string_view (p,
+				pst->add_psymbol (std::string_view (p,
 								    q - p),
 						  true, VAR_DOMAIN,
 						  LOC_CONST, -1,
@@ -3199,7 +3199,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 			continue;
 		      case 'c':
 			/* Constant, e.g. from "const" in Pascal.  */
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_CONST, -1,
 					  psymbol_placement::STATIC,
@@ -3215,7 +3215,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 			    function_outside_compilation_unit_complaint
 			      (copy.c_str ());
 			  }
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_BLOCK,
 					  SECT_OFF_TEXT (objfile),
@@ -3236,7 +3236,7 @@  parse_partial_symbols (minimal_symbol_reader &reader,
 			    function_outside_compilation_unit_complaint
 			      (copy.c_str ());
 			  }
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_BLOCK,
 					  SECT_OFF_TEXT (objfile),
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 1d778822858..72e500be959 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1170,7 +1170,7 @@  mst_str (minimal_symbol_type t)
 /* See minsyms.h.  */
 
 struct minimal_symbol *
-minimal_symbol_reader::record_full (gdb::string_view name,
+minimal_symbol_reader::record_full (std::string_view name,
 				    bool copy_name, unrelocated_addr address,
 				    enum minimal_symbol_type ms_type,
 				    int section)
@@ -1510,7 +1510,7 @@  minimal_symbol_reader::install ()
 	       {
 		 size_t idx = msym - msymbols;
 		 msym->compute_and_set_names
-		   (gdb::string_view (msym->linkage_name (),
+		   (std::string_view (msym->linkage_name (),
 				      hash_values[idx].name_length),
 		    false,
 		    m_objfile->per_bfd,
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index f3a2474c796..ee415c4db41 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -118,7 +118,7 @@  class minimal_symbol_reader
      SECTION - the symbol's section
   */
 
-  struct minimal_symbol *record_full (gdb::string_view name,
+  struct minimal_symbol *record_full (std::string_view name,
 				      bool copy_name,
 				      unrelocated_addr address,
 				      enum minimal_symbol_type ms_type,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 484d4eaa651..d4cd5810c20 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1208,7 +1208,7 @@  partial_symtab::add_psymbol (const partial_symbol &psymbol,
 /* See psymtab.h.  */
 
 void
-partial_symtab::add_psymbol (gdb::string_view name, bool copy_name,
+partial_symtab::add_psymbol (std::string_view name, bool copy_name,
 			     domain_enum domain,
 			     enum address_class theclass,
 			     short section,
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 4bafc6e998e..005a63cbba8 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -21,7 +21,7 @@ 
 #define PSYMTAB_H
 
 #include "objfiles.h"
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "gdbsupport/gdb_obstack.h"
 #include "symfile.h"
 #include "gdbsupport/next-iterator.h"
@@ -346,7 +346,7 @@  struct partial_symtab
      LANGUAGE is the language from which the symbol originates.  This will
      influence, amongst other things, how the symbol name is demangled. */
 
-  void add_psymbol (gdb::string_view name,
+  void add_psymbol (std::string_view name,
 		    bool copy_name, domain_enum domain,
 		    enum address_class theclass,
 		    short section,
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index b24d0e8fb23..27cefb9604b 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -451,8 +451,8 @@  rocm_code_object_stream_memory::read (bfd *, void *buf, file_ptr size,
 static gdb_bfd_iovec_base *
 rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
 {
-  gdb::string_view uri (bfd_get_filename (abfd));
-  gdb::string_view protocol_delim = "://";
+  std::string_view uri (bfd_get_filename (abfd));
+  std::string_view protocol_delim = "://";
   size_t protocol_end = uri.find (protocol_delim);
   std::string protocol = gdb::to_string (uri.substr (0, protocol_end));
   protocol_end += protocol_delim.length ();
@@ -460,7 +460,7 @@  rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
   std::transform (protocol.begin (), protocol.end (), protocol.begin (),
 		  [] (unsigned char c) { return std::tolower (c); });
 
-  gdb::string_view path;
+  std::string_view path;
   size_t path_end = uri.find_first_of ("#?", protocol_end);
   if (path_end != std::string::npos)
     path = uri.substr (protocol_end, path_end++ - protocol_end);
@@ -476,7 +476,7 @@  rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
 	&& std::isxdigit (path[i + 1])
 	&& std::isxdigit (path[i + 2]))
       {
-	gdb::string_view hex_digits = path.substr (i + 1, 2);
+	std::string_view hex_digits = path.substr (i + 1, 2);
 	decoded_path += std::stoi (gdb::to_string (hex_digits), 0, 16);
 	i += 2;
       }
@@ -484,7 +484,7 @@  rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
       decoded_path += path[i];
 
   /* Tokenize the query/fragment.  */
-  std::vector<gdb::string_view> tokens;
+  std::vector<std::string_view> tokens;
   size_t pos, last = path_end;
   while ((pos = uri.find ('&', last)) != std::string::npos)
     {
@@ -496,15 +496,15 @@  rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
     tokens.emplace_back (uri.substr (last));
 
   /* Create a tag-value map from the tokenized query/fragment.  */
-  std::unordered_map<gdb::string_view, gdb::string_view,
+  std::unordered_map<std::string_view, std::string_view,
 		     gdb::string_view_hash> params;
-  for (gdb::string_view token : tokens)
+  for (std::string_view token : tokens)
     {
       size_t delim = token.find ('=');
       if (delim != std::string::npos)
 	{
-	  gdb::string_view tag = token.substr (0, delim);
-	  gdb::string_view val = token.substr (delim + 1);
+	  std::string_view tag = token.substr (0, delim);
+	  std::string_view val = token.substr (delim + 1);
 	  params.emplace (tag, val);
 	}
     }
@@ -514,7 +514,7 @@  rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
       ULONGEST offset = 0;
       ULONGEST size = 0;
 
-      auto try_strtoulst = [] (gdb::string_view v)
+      auto try_strtoulst = [] (std::string_view v)
 	{
 	  errno = 0;
 	  ULONGEST value = strtoulst (v.data (), nullptr, 0);
diff --git a/gdb/split-name.c b/gdb/split-name.c
index 0253b3cf675..0805cb82700 100644
--- a/gdb/split-name.c
+++ b/gdb/split-name.c
@@ -23,10 +23,10 @@ 
 
 /* See split-name.h.  */
 
-std::vector<gdb::string_view>
+std::vector<std::string_view>
 split_name (const char *name, split_style style)
 {
-  std::vector<gdb::string_view> result;
+  std::vector<std::string_view> result;
   unsigned int previous_len = 0;
 
   switch (style)
diff --git a/gdb/split-name.h b/gdb/split-name.h
index 7648cf9b900..ad2862e222d 100644
--- a/gdb/split-name.h
+++ b/gdb/split-name.h
@@ -20,7 +20,7 @@ 
 #ifndef GDB_SPLIT_NAME_H
 #define GDB_SPLIT_NAME_H
 
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 
 /* The available styles of name splitting.  */
 
@@ -40,7 +40,7 @@  enum class split_style
 /* Split NAME into components at module boundaries.  STYLE indicates
    which style of splitting to use.  */
 
-extern std::vector<gdb::string_view> split_name (const char *name,
+extern std::vector<std::string_view> split_name (const char *name,
 						 split_style style);
 
 #endif /* GDB_SPLIT_NAME_H */
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 7402a26a401..4011475f7ac 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -748,7 +748,7 @@  define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
       if (new_name != nullptr)
 	sym->compute_and_set_names (new_name.get (), true, objfile->per_bfd);
       else
-	sym->compute_and_set_names (gdb::string_view (string, p - string), true,
+	sym->compute_and_set_names (std::string_view (string, p - string), true,
 				    objfile->per_bfd);
 
       if (sym->language () == language_cplus)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7f67159b516..408f8041bf0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -70,7 +70,7 @@ 
 #include "filename-seen-cache.h"
 #include "arch-utils.h"
 #include <algorithm>
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "gdbsupport/pathstuff.h"
 #include "gdbsupport/common-utils.h"
 
@@ -828,10 +828,10 @@  general_symbol_info::set_language (enum language language,
 /* Objects of this type are stored in the demangled name hash table.  */
 struct demangled_name_entry
 {
-  demangled_name_entry (gdb::string_view mangled_name)
+  demangled_name_entry (std::string_view mangled_name)
     : mangled (mangled_name) {}
 
-  gdb::string_view mangled;
+  std::string_view mangled;
   enum language language;
   gdb::unique_xmalloc_ptr<char> demangled;
 };
@@ -940,7 +940,7 @@  symbol_find_demangled_name (struct general_symbol_info *gsymbol,
    so the pointer can be discarded after calling this function.  */
 
 void
-general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
+general_symbol_info::compute_and_set_names (std::string_view linkage_name,
 					    bool copy_name,
 					    objfile_per_bfd_storage *per_bfd,
 					    std::optional<hashval_t> hash)
@@ -991,14 +991,14 @@  general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
       /* A 0-terminated copy of the linkage name.  Callers must set COPY_NAME
 	 to true if the string might not be nullterminated.  We have to make
 	 this copy because demangling needs a nullterminated string.  */
-      gdb::string_view linkage_name_copy;
+      std::string_view linkage_name_copy;
       if (copy_name)
 	{
 	  char *alloc_name = (char *) alloca (linkage_name.length () + 1);
 	  memcpy (alloc_name, linkage_name.data (), linkage_name.length ());
 	  alloc_name[linkage_name.length ()] = '\0';
 
-	  linkage_name_copy = gdb::string_view (alloc_name,
+	  linkage_name_copy = std::string_view (alloc_name,
 						linkage_name.length ());
 	}
       else
@@ -1038,7 +1038,7 @@  general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
 	  memcpy (mangled_ptr, linkage_name.data (), linkage_name.length ());
 	  mangled_ptr [linkage_name.length ()] = '\0';
 	  new (*slot) demangled_name_entry
-	    (gdb::string_view (mangled_ptr, linkage_name.length ()));
+	    (std::string_view (mangled_ptr, linkage_name.length ()));
 	}
       (*slot)->demangled = std::move (demangled_name);
       (*slot)->language = language ();
diff --git a/gdb/symtab.h b/gdb/symtab.h
index d61d5bb7815..52fd9e23e6c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -31,7 +31,7 @@ 
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/function-view.h"
 #include <optional>
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 #include "gdbsupport/next-iterator.h"
 #include "gdbsupport/iterator-range.h"
 #include "completer.h"
@@ -126,11 +126,11 @@  class ada_lookup_name_info final
 
   /* A wrapper for ::split_name that handles some Ada-specific
      peculiarities.  */
-  std::vector<gdb::string_view> split_name () const
+  std::vector<std::string_view> split_name () const
   {
     if (m_verbatim_p || m_standard_p)
       {
-	std::vector<gdb::string_view> result;
+	std::vector<std::string_view> result;
 	if (m_standard_p)
 	  result.emplace_back ("standard");
 	result.emplace_back (m_encoded_name);
@@ -238,7 +238,7 @@  class lookup_name_info final
   /* Getters.  See description of each corresponding field.  */
   symbol_name_match_type match_type () const { return m_match_type; }
   bool completion_mode () const { return m_completion_mode; }
-  gdb::string_view name () const { return m_name; }
+  std::string_view name () const { return m_name; }
   const bool ignore_parameters () const { return m_ignore_parameters; }
 
   /* Like the "name" method but guarantees that the returned string is
@@ -292,7 +292,7 @@  class lookup_name_info final
 
   /* A wrapper for ::split_name (see split-name.h) that splits this
      name, and that handles any language-specific peculiarities.  */  
-  std::vector<gdb::string_view> split_name (language lang) const
+  std::vector<std::string_view> split_name (language lang) const
   {
     if (lang == language_ada)
       return ada ().split_name ();
@@ -356,7 +356,7 @@  class lookup_name_info final
   symbol_name_match_type m_match_type;
   bool m_completion_mode;
   bool m_ignore_parameters;
-  gdb::string_view m_name;
+  std::string_view m_name;
 
   /* Language-specific info.  These fields are filled lazily the first
      time a lookup is done in the corresponding language.  They're
@@ -509,7 +509,7 @@  struct general_symbol_info
   /* Set the linkage and natural names of a symbol, by demangling
      the linkage name.  If linkage_name may not be nullterminated,
      copy_name must be set to true.  */
-  void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
+  void compute_and_set_names (std::string_view linkage_name, bool copy_name,
 			      struct objfile_per_bfd_storage *per_bfd,
 			      std::optional<hashval_t> hash
 				= std::optional<hashval_t> ());
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index b8954af36e2..83218dc4797 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -1197,7 +1197,7 @@  tui_getc_1 (FILE *fp)
 	 Compare keyname instead.  */
       if (ch >= KEY_MAX)
 	{
-	  auto name = gdb::string_view (keyname (ch));
+	  auto name = std::string_view (keyname (ch));
 
 	  /* The following sequences are hardcoded in readline as
 	     well.  */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index a0a123340e3..9219c1f0184 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -54,7 +54,7 @@ 
 #include "gdb_curses.h"
 #include <ctype.h>
 #include "readline/readline.h"
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 
 #include <signal.h>
 
@@ -663,7 +663,7 @@  tui_scroll_right_command (const char *arg, int from_tty)
 
 /* Answer the window represented by name.  */
 static struct tui_win_info *
-tui_partial_win_by_name (gdb::string_view name)
+tui_partial_win_by_name (std::string_view name)
 {
   struct tui_win_info *best = nullptr;
 
@@ -935,7 +935,7 @@  tui_set_win_size (const char *arg, bool set_width_p)
   buf_ptr = skip_to_space (buf_ptr);
 
   /* Validate the window name.  */
-  gdb::string_view wname (buf, buf_ptr - buf);
+  std::string_view wname (buf, buf_ptr - buf);
   win_info = tui_partial_win_by_name (wname);
 
   if (win_info == NULL)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index e6ecf2a6de5..829fc1f09c7 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2500,7 +2500,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 	    switch (p[1])
 	      {
 	      case 'S':
-		pst->add_psymbol (gdb::string_view (namestring,
+		pst->add_psymbol (std::string_view (namestring,
 						    p - namestring),
 				  true, VAR_DOMAIN, LOC_STATIC,
 				  SECT_OFF_DATA (objfile),
@@ -2513,7 +2513,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 	      case 'G':
 		/* The addresses in these entries are reported to be
 		   wrong.  See the code that reads 'G's for symtabs.  */
-		pst->add_psymbol (gdb::string_view (namestring,
+		pst->add_psymbol (std::string_view (namestring,
 						    p - namestring),
 				  true, VAR_DOMAIN, LOC_STATIC,
 				  SECT_OFF_DATA (objfile),
@@ -2534,7 +2534,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 		    || (p == namestring + 1
 			&& namestring[0] != ' '))
 		  {
-		    pst->add_psymbol (gdb::string_view (namestring,
+		    pst->add_psymbol (std::string_view (namestring,
 							p - namestring),
 				      true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 				      psymbol_placement::STATIC,
@@ -2544,7 +2544,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 		    if (p[2] == 't')
 		      {
 			/* Also a typedef with the same name.  */
-			pst->add_psymbol (gdb::string_view (namestring,
+			pst->add_psymbol (std::string_view (namestring,
 							    p - namestring),
 					  true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 					  psymbol_placement::STATIC,
@@ -2559,7 +2559,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 	      case 't':
 		if (p != namestring)	/* a name is there, not just :T...  */
 		  {
-		    pst->add_psymbol (gdb::string_view (namestring,
+		    pst->add_psymbol (std::string_view (namestring,
 							p - namestring),
 				      true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 				      psymbol_placement::STATIC,
@@ -2624,7 +2624,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 			  ;
 			/* Note that the value doesn't matter for
 			   enum constants in psymtabs, just in symtabs.  */
-			pst->add_psymbol (gdb::string_view (p, q - p), true,
+			pst->add_psymbol (std::string_view (p, q - p), true,
 					  VAR_DOMAIN, LOC_CONST, -1,
 					  psymbol_placement::STATIC,
 					  unrelocated_addr (0),
@@ -2644,7 +2644,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 
 	      case 'c':
 		/* Constant, e.g. from "const" in Pascal.  */
-		pst->add_psymbol (gdb::string_view (namestring,
+		pst->add_psymbol (std::string_view (namestring,
 						    p - namestring),
 				  true, VAR_DOMAIN, LOC_CONST, -1,
 				  psymbol_placement::STATIC,
@@ -2659,7 +2659,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 		    std::string name (namestring, (p - namestring));
 		    function_outside_compilation_unit_complaint (name.c_str ());
 		  }
-		pst->add_psymbol (gdb::string_view (namestring,
+		pst->add_psymbol (std::string_view (namestring,
 						    p - namestring),
 				  true, VAR_DOMAIN, LOC_BLOCK,
 				  SECT_OFF_TEXT (objfile),
@@ -2686,7 +2686,7 @@  scan_xcoff_symtab (minimal_symbol_reader &reader,
 		if (startswith (namestring, "@FIX"))
 		  continue;
 
-		pst->add_psymbol (gdb::string_view (namestring,
+		pst->add_psymbol (std::string_view (namestring,
 						    p - namestring),
 				  true, VAR_DOMAIN, LOC_BLOCK,
 				  SECT_OFF_TEXT (objfile),
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 4ceb44d88b8..1efc5bbf459 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -26,7 +26,7 @@ 
 #include "gdbsupport/gdb_unique_ptr.h"
 #include "gdbsupport/array-view.h"
 #include "poison.h"
-#include "gdb_string_view.h"
+#include <string_view>
 
 #if defined HAVE_LIBXXHASH
 #  include <xxhash.h>
@@ -94,7 +94,7 @@  extern const char *safe_strerror (int);
    true if the start of STRING matches PATTERN, false otherwise.  */
 
 static inline bool
-startswith (gdb::string_view string, gdb::string_view pattern)
+startswith (std::string_view string, std::string_view pattern)
 {
   return (string.length () >= pattern.length ()
 	  && strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
@@ -228,7 +228,7 @@  fast_hash (const void *ptr, size_t len, unsigned int start_value = 0)
 namespace gdb
 {
 
-/* Hash type for gdb::string_view.
+/* Hash type for std::string_view.
 
    Even after we switch to C++17 and dump our string_view implementation, we
    might want to keep this hash implementation if it's faster than std::hash
@@ -236,7 +236,7 @@  namespace gdb
 
 struct string_view_hash
 {
-  std::size_t operator() (gdb::string_view view) const
+  std::size_t operator() (std::string_view view) const
   {  return fast_hash (view.data (), view.length ()); }
 };
 
diff --git a/gdbsupport/format.h b/gdbsupport/format.h
index 2af34ab9450..5330bbe361e 100644
--- a/gdbsupport/format.h
+++ b/gdbsupport/format.h
@@ -20,7 +20,7 @@ 
 #ifndef COMMON_FORMAT_H
 #define COMMON_FORMAT_H
 
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
 
 #if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
 # define USE_PRINTF_I64 1
@@ -61,7 +61,7 @@  struct format_piece
   bool operator== (const format_piece &other) const
   {
     return (this->argclass == other.argclass
-	    && gdb::string_view (this->string) == other.string);
+	    && std::string_view (this->string) == other.string);
   }
 
   const char *string;
diff --git a/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
index 26a3a9f0910..cf7af623327 100644
--- a/gdbsupport/gdb_string_view.h
+++ b/gdbsupport/gdb_string_view.h
@@ -556,7 +556,7 @@  namespace gdb {
 namespace gdb {
 
 static inline std::string
-to_string(const gdb::string_view &view)
+to_string(const std::string_view &view)
 {
   return { view.data (), view.size () };
 }