diff --git a/gdb/coffread.c b/gdb/coffread.c
index e582d8f..c649788 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -462,8 +462,7 @@
       return NULL;
     }
 
-  return reader.record_full (cs->c_name, strlen (cs->c_name), true, address,
-			     type, section);
+  return reader.record_full (cs->c_name, true, address, type, section);
 }
 
 /* coff_symfile_init ()
@@ -1569,7 +1568,7 @@
   name = EXTERNAL_NAME (name, objfile->obfd);
   SYMBOL_SET_LANGUAGE (sym, get_current_subfile ()->language,
 		       &objfile->objfile_obstack);
-  SYMBOL_SET_NAMES (sym, name, strlen (name), 1, objfile);
+  SYMBOL_SET_NAMES (sym, name, true, objfile);
 
   /* default assumptions */
   SYMBOL_VALUE (sym) = cs->c_value;
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 44ccff6..0e80150 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -380,7 +380,7 @@
       OBJSTAT (ccp->of, n_syms++);
 
       SYMBOL_SET_LANGUAGE (sym, language_c, &ccp->of->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, name, strlen (name), 0, ccp->of);
+      SYMBOL_SET_NAMES (sym, name, false, ccp->of);
       SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_TYPE (sym) = fip->ptype;
@@ -409,7 +409,7 @@
       OBJSTAT (objfile, n_syms++);
 
       SYMBOL_SET_LANGUAGE (sym, language_c, &objfile->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, name.get (), strlen (name.get ()), 1, objfile);
+      SYMBOL_SET_NAMES (sym, name.get (), true, objfile);
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
 
@@ -1029,7 +1029,7 @@
 	if (type)
 	  {
 	    sym = new_symbol (ccp, type, id);
-	    SYMBOL_SET_NAMES (sym, name, strlen (name), 0, ccp->of);
+	    SYMBOL_SET_NAMES (sym, name, false, ccp->of);
 	  }
 	break;
       case CTF_K_STRUCT:
@@ -1045,7 +1045,7 @@
 	SYMBOL_TYPE (sym) = type;
 	SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
 	SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
-	SYMBOL_SET_NAMES (sym, name, strlen (name), 0, ccp->of);
+	SYMBOL_SET_NAMES (sym, name, false, ccp->of);
 	add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
 	break;
       default:
@@ -1365,7 +1365,7 @@
 	return 0;
     }
 
-    add_psymbol_to_list (name.get (), strlen (name.get ()), true,
+    add_psymbol_to_list (name.get (), true,
 			 domain, aclass, section,
 			 psymbol_placement::GLOBAL,
 			 0, language_c, ccp->of);
@@ -1380,7 +1380,7 @@
 {
   ctf_context_t *ccp = (ctf_context_t *) arg;
 
-  add_psymbol_to_list (name, strlen (name), true,
+  add_psymbol_to_list (name, true,
 		       VAR_DOMAIN, LOC_STATIC, -1,
 		       psymbol_placement::GLOBAL,
 		       0, language_c, ccp->of);
@@ -1445,7 +1445,7 @@
       else
 	aclass = LOC_TYPEDEF;
 
-      add_psymbol_to_list (tname.get (), strlen (tname.get ()), true,
+      add_psymbol_to_list (tname.get (), true,
 			   tdomain, aclass, -1,
 			   psymbol_placement::STATIC,
 			   0, language_c, of);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index bbef372..462f7f0 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1464,7 +1464,7 @@
 	      if (gdbarch_static_transform_name_p (gdbarch))
 		gdbarch_static_transform_name (gdbarch, namestring);
 
-	      add_psymbol_to_list (sym_name, sym_len, true,
+	      add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true,
 				   VAR_DOMAIN, LOC_STATIC,
 				   data_sect_index,
 				   psymbol_placement::STATIC,
@@ -1474,7 +1474,7 @@
 	    case 'G':
 	      /* The addresses in these entries are reported to be
 		 wrong.  See the code that reads 'G's for symtabs.  */
-	      add_psymbol_to_list (sym_name, sym_len, true,
+	      add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true,
 				   VAR_DOMAIN, LOC_STATIC,
 				   data_sect_index,
 				   psymbol_placement::GLOBAL,
@@ -1492,15 +1492,15 @@
 		  || (p == namestring + 1
 		      && namestring[0] != ' '))
 		{
-		  add_psymbol_to_list (sym_name, sym_len, true,
-				       STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+		  add_psymbol_to_list (gdb::string_view (sym_name, sym_len),
+				       true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 				       psymbol_placement::STATIC,
 				       0, psymtab_language, objfile);
 		  if (p[2] == 't')
 		    {
 		      /* Also a typedef with the same name.  */
-		      add_psymbol_to_list (sym_name, sym_len, true,
-					   VAR_DOMAIN, LOC_TYPEDEF, -1,
+		      add_psymbol_to_list (gdb::string_view (sym_name, sym_len),
+					   true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 					   psymbol_placement::STATIC,
 					   0, psymtab_language, objfile);
 		      p += 1;
@@ -1511,8 +1511,8 @@
 	    case 't':
 	      if (p != namestring)	/* a name is there, not just :T...  */
 		{
-		  add_psymbol_to_list (sym_name, sym_len, true,
-				       VAR_DOMAIN, LOC_TYPEDEF, -1,
+		  add_psymbol_to_list (gdb::string_view (sym_name, sym_len),
+				       true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 				       psymbol_placement::STATIC,
 				       0, psymtab_language, objfile);
 		}
@@ -1572,7 +1572,7 @@
 			;
 		      /* Note that the value doesn't matter for
 			 enum constants in psymtabs, just in symtabs.  */
-		      add_psymbol_to_list (p, q - p, true,
+		      add_psymbol_to_list (gdb::string_view (p, q - p), true,
 					   VAR_DOMAIN, LOC_CONST, -1,
 					   psymbol_placement::STATIC, 0,
 					   psymtab_language, objfile);
@@ -1590,7 +1590,7 @@
 
 	    case 'c':
 	      /* Constant, e.g. from "const" in Pascal.  */
-	      add_psymbol_to_list (sym_name, sym_len, true,
+	      add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true,
 				   VAR_DOMAIN, LOC_CONST, -1,
 				   psymbol_placement::STATIC, 0,
 				   psymtab_language, objfile);
@@ -1645,7 +1645,7 @@
 		  pst->set_text_low (nlist.n_value);
 		  textlow_not_set = 0;
 		}
-	      add_psymbol_to_list (sym_name, sym_len, true,
+	      add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true,
 				   VAR_DOMAIN, LOC_BLOCK,
 				   SECT_OFF_TEXT (objfile),
 				   psymbol_placement::STATIC,
@@ -1704,7 +1704,7 @@
 		  pst->set_text_low (nlist.n_value);
 		  textlow_not_set = 0;
 		}
-	      add_psymbol_to_list (sym_name, sym_len, true,
+	      add_psymbol_to_list (gdb::string_view (sym_name, sym_len), true,
 				   VAR_DOMAIN, LOC_BLOCK,
 				   SECT_OFF_TEXT (objfile),
 				   psymbol_placement::GLOBAL,
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4372a47..cac719a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8952,7 +8952,7 @@
              But in Ada and Fortran, we want to be able to access nested
              procedures globally.  So all Ada and Fortran subprograms are
              stored in the global scope.  */
-	  add_psymbol_to_list (actual_name, strlen (actual_name),
+	  add_psymbol_to_list (actual_name,
 			       built_actual_name != NULL,
 			       VAR_DOMAIN, LOC_BLOCK,
 			       SECT_OFF_TEXT (objfile),
@@ -8962,7 +8962,7 @@
 	}
       else
 	{
-	  add_psymbol_to_list (actual_name, strlen (actual_name),
+	  add_psymbol_to_list (actual_name,
 			       built_actual_name != NULL,
 			       VAR_DOMAIN, LOC_BLOCK,
 			       SECT_OFF_TEXT (objfile),
@@ -8974,7 +8974,7 @@
 	set_objfile_main_name (objfile, actual_name, cu->language);
       break;
     case DW_TAG_constant:
-      add_psymbol_to_list (actual_name, strlen (actual_name),
+      add_psymbol_to_list (actual_name,
 			   built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
 			   -1, (pdi->is_external
 				? psymbol_placement::GLOBAL
@@ -9010,7 +9010,7 @@
 	     table building.  */
 
 	  if (pdi->d.locdesc || pdi->has_type)
-	    add_psymbol_to_list (actual_name, strlen (actual_name),
+	    add_psymbol_to_list (actual_name,
 				 built_actual_name != NULL,
 				 VAR_DOMAIN, LOC_STATIC,
 				 SECT_OFF_TEXT (objfile),
@@ -9029,7 +9029,7 @@
 	      return;
 	    }
 
-	  add_psymbol_to_list (actual_name, strlen (actual_name),
+	  add_psymbol_to_list (actual_name,
 			       built_actual_name != NULL,
 			       VAR_DOMAIN, LOC_STATIC,
 			       SECT_OFF_TEXT (objfile),
@@ -9041,7 +9041,7 @@
     case DW_TAG_typedef:
     case DW_TAG_base_type:
     case DW_TAG_subrange_type:
-      add_psymbol_to_list (actual_name, strlen (actual_name),
+      add_psymbol_to_list (actual_name,
 			   built_actual_name != NULL,
 			   VAR_DOMAIN, LOC_TYPEDEF, -1,
 			   psymbol_placement::STATIC,
@@ -9049,7 +9049,7 @@
       break;
     case DW_TAG_imported_declaration:
     case DW_TAG_namespace:
-      add_psymbol_to_list (actual_name, strlen (actual_name),
+      add_psymbol_to_list (actual_name,
 			   built_actual_name != NULL,
 			   VAR_DOMAIN, LOC_TYPEDEF, -1,
 			   psymbol_placement::GLOBAL,
@@ -9060,7 +9060,7 @@
          available without any name.  If so, we skip the module as it
          doesn't bring any value.  */
       if (actual_name != nullptr)
-	add_psymbol_to_list (actual_name, strlen (actual_name),
+	add_psymbol_to_list (actual_name,
 			     built_actual_name != NULL,
 			     MODULE_DOMAIN, LOC_TYPEDEF, -1,
 			     psymbol_placement::GLOBAL,
@@ -9084,7 +9084,7 @@
 
       /* NOTE: carlton/2003-10-07: See comment in new_symbol about
 	 static vs. global.  */
-      add_psymbol_to_list (actual_name, strlen (actual_name),
+      add_psymbol_to_list (actual_name,
 			   built_actual_name != NULL,
 			   STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 			   cu->language == language_cplus
@@ -9094,7 +9094,7 @@
 
       break;
     case DW_TAG_enumerator:
-      add_psymbol_to_list (actual_name, strlen (actual_name),
+      add_psymbol_to_list (actual_name,
 			   built_actual_name != NULL,
 			   VAR_DOMAIN, LOC_CONST, -1,
 			   cu->language == language_cplus
@@ -9924,8 +9924,7 @@
 
       sym = allocate_symbol (objfile);
       SYMBOL_SET_LANGUAGE (sym, language_go, &objfile->objfile_obstack);
-      SYMBOL_SET_NAMES (sym, saved_package_name,
-			strlen (saved_package_name), 0, objfile);
+      SYMBOL_SET_NAMES (sym, saved_package_name, false, objfile);
       /* This is not VAR_DOMAIN because we want a way to ensure a lookup of,
 	 e.g., "main" finds the "main" module and not C's main().  */
       SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
@@ -18566,7 +18565,7 @@
 	      || pdi.tag == DW_TAG_subrange_type))
 	{
 	  if (building_psymtab && pdi.name != NULL)
-	    add_psymbol_to_list (pdi.name, strlen (pdi.name), false,
+	    add_psymbol_to_list (pdi.name, false,
 				 VAR_DOMAIN, LOC_TYPEDEF, -1,
 				 psymbol_placement::STATIC,
 				 0, cu->language, objfile);
@@ -18600,7 +18599,7 @@
 	  if (pdi.name == NULL)
 	    complaint (_("malformed enumerator DIE ignored"));
 	  else if (building_psymtab)
-	    add_psymbol_to_list (pdi.name, strlen (pdi.name), false,
+	    add_psymbol_to_list (pdi.name, false,
 				 VAR_DOMAIN, LOC_CONST, -1,
 				 cu->language == language_cplus
 				 ? psymbol_placement::GLOBAL
@@ -21606,7 +21605,7 @@
       /* Cache this symbol's name and the name's demangled form (if any).  */
       SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
       linkagename = dwarf2_physname (name, die, cu);
-      SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
+      SYMBOL_SET_NAMES (sym, linkagename, false, objfile);
 
       /* Fortran does not have mangling standard and the mangling does differ
 	 between gfortran, iFort etc.  */
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 1b5b4e0..c4ea470 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -210,8 +210,8 @@
     address = gdbarch_addr_bits_remove (gdbarch, address);
 
   struct minimal_symbol *result
-    = reader.record_full (name, name_len, copy_name, address,
-			  ms_type,
+    = reader.record_full (gdb::string_view (name, name_len), copy_name,
+			  address, ms_type,
 			  gdb_bfd_section_index (objfile->obfd,
 						 bfd_section));
   if ((objfile->flags & OBJF_MAINLINE) == 0
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index d53d57f..4549293 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -3050,8 +3050,9 @@
 			  namestring = gdbarch_static_transform_name
 					 (gdbarch, namestring);
 
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_STATIC,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_STATIC,
 					     SECT_OFF_DATA (objfile),
 					     psymbol_placement::STATIC,
 					     sh.value,
@@ -3061,8 +3062,9 @@
 			/* The addresses in these entries are reported
 			   to be wrong.  See the code that reads 'G's
 			   for symtabs.  */
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_STATIC,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_STATIC,
 					     SECT_OFF_DATA (objfile),
 					     psymbol_placement::GLOBAL,
 					     sh.value,
@@ -3080,21 +3082,20 @@
 			    || (p == namestring + 1
 				&& namestring[0] != ' '))
 			  {
-			    add_psymbol_to_list (namestring, p - namestring, true,
-						 STRUCT_DOMAIN, LOC_TYPEDEF,
-						 -1,
-						 psymbol_placement::STATIC,
-						 0, psymtab_language, objfile);
+			    add_psymbol_to_list
+			      (gdb::string_view (namestring, p - namestring),
+			       true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+			       psymbol_placement::STATIC, 0, psymtab_language,
+			       objfile);
 			    if (p[2] == 't')
 			      {
 				/* Also a typedef with the same name.  */
-				add_psymbol_to_list (namestring,
-						     p - namestring, true,
-						     VAR_DOMAIN, LOC_TYPEDEF,
-						     -1,
-						     psymbol_placement::STATIC,
-						     0, psymtab_language,
-						     objfile);
+				add_psymbol_to_list
+				  (gdb::string_view (namestring,
+						     p - namestring),
+				   true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+				   psymbol_placement::STATIC, 0,
+				   psymtab_language, objfile);
 				p += 1;
 			      }
 			  }
@@ -3103,11 +3104,12 @@
 			if (p != namestring)	/* a name is there, not
 						   just :T...  */
 			  {
-			    add_psymbol_to_list (namestring, p - namestring,
-						 true, VAR_DOMAIN, LOC_TYPEDEF,
-						 -1,
-						 psymbol_placement::STATIC,
-						 0, psymtab_language, objfile);
+			    add_psymbol_to_list
+			      (gdb::string_view (namestring,
+						 p - namestring),
+			       true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+			       psymbol_placement::STATIC, 0, psymtab_language,
+			       objfile);
 			  }
 		      check_enum:
 			/* If this is an enumerated type, we need to add
@@ -3168,9 +3170,10 @@
 				/* Note that the value doesn't matter for
 				   enum constants in psymtabs, just in
 				   symtabs.  */
-				add_psymbol_to_list (p, q - p, true,
-						     VAR_DOMAIN, LOC_CONST,
-						     -1,
+				add_psymbol_to_list (gdb::string_view (p,
+								       q - p),
+						     true, VAR_DOMAIN,
+						     LOC_CONST, -1,
 						     psymbol_placement::STATIC,
 						     0, psymtab_language,
 						     objfile);
@@ -3187,8 +3190,9 @@
 			continue;
 		      case 'c':
 			/* Constant, e.g. from "const" in Pascal.  */
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_CONST, -1,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_CONST, -1,
 					     psymbol_placement::STATIC,
 					     0, psymtab_language, objfile);
 			continue;
@@ -3200,8 +3204,9 @@
 			    function_outside_compilation_unit_complaint
 			      (copy.c_str ());
 			  }
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_BLOCK,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_BLOCK,
 					     SECT_OFF_TEXT (objfile),
 					     psymbol_placement::STATIC,
 					     sh.value,
@@ -3219,8 +3224,9 @@
 			    function_outside_compilation_unit_complaint
 			      (copy.c_str ());
 			  }
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_BLOCK,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_BLOCK,
 					     SECT_OFF_TEXT (objfile),
 					     psymbol_placement::GLOBAL,
 					     sh.value,
@@ -3454,13 +3460,13 @@
 		     symbol table, and the MAIN__ symbol via the minimal
 		     symbol table.  */
 		  if (sh.st == stProc)
-		    add_psymbol_to_list (sym_name, strlen (sym_name), true,
+		    add_psymbol_to_list (sym_name, true,
 					 VAR_DOMAIN, LOC_BLOCK,
 					 section,
 					 psymbol_placement::GLOBAL,
 					 sh.value, psymtab_language, objfile);
 		  else
-		    add_psymbol_to_list (sym_name, strlen (sym_name), true,
+		    add_psymbol_to_list (sym_name, true,
 					 VAR_DOMAIN, LOC_BLOCK,
 					 section,
 					 psymbol_placement::STATIC,
@@ -3527,7 +3533,7 @@
 		      && sh.iss != 0
 		      && sh.index != cur_sdx + 2)
 		    {
-		      add_psymbol_to_list (sym_name, strlen (sym_name), true,
+		      add_psymbol_to_list (sym_name, true,
 					   STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 					   psymbol_placement::STATIC,
 					   0, psymtab_language, objfile);
@@ -3567,7 +3573,7 @@
 		  continue;
 		}
 	      /* Use this gdb symbol.  */
-	      add_psymbol_to_list (sym_name, strlen (sym_name), true,
+	      add_psymbol_to_list (sym_name, true,
 				   VAR_DOMAIN, theclass, section,
 				   psymbol_placement::STATIC,
 				   sh.value, psymtab_language, objfile);
@@ -3646,7 +3652,7 @@
 		  break;
 		}
 	      char *sym_name = debug_info->ssext + psh->iss;
-	      add_psymbol_to_list (sym_name, strlen (sym_name), true,
+	      add_psymbol_to_list (sym_name, true,
 				   VAR_DOMAIN, theclass,
 				   section,
 				   psymbol_placement::GLOBAL,
@@ -3809,7 +3815,7 @@
 
       /* Note that the value doesn't matter for enum constants
          in psymtabs, just in symtabs.  */
-      add_psymbol_to_list (name, strlen (name), true,
+      add_psymbol_to_list (name, true,
 			   VAR_DOMAIN, LOC_CONST, -1,
 			   psymbol_placement::STATIC, 0,
 			   psymtab_language, objfile);
@@ -4758,7 +4764,7 @@
 
   SYMBOL_SET_LANGUAGE (s, psymtab_language,
 		       &mdebugread_objfile->objfile_obstack);
-  SYMBOL_SET_NAMES (s, name, strlen (name), 1, mdebugread_objfile);
+  SYMBOL_SET_NAMES (s, name, true, mdebugread_objfile);
   return s;
 }
 
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index c41e5c3..1f123f7 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1086,7 +1086,7 @@
 /* See minsyms.h.  */
 
 struct minimal_symbol *
-minimal_symbol_reader::record_full (const char *name, int name_len,
+minimal_symbol_reader::record_full (gdb::string_view name,
 				    bool copy_name, CORE_ADDR address,
 				    enum minimal_symbol_type ms_type,
 				    int section)
@@ -1100,24 +1100,22 @@
      lookup_minimal_symbol_by_pc would have no way of getting the
      right one.  */
   if (ms_type == mst_file_text && name[0] == 'g'
-      && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0
-	  || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0))
+      && (name == GCC_COMPILED_FLAG_SYMBOL
+	  || name == GCC2_COMPILED_FLAG_SYMBOL))
     return (NULL);
 
   /* It's safe to strip the leading char here once, since the name
      is also stored stripped in the minimal symbol table.  */
   if (name[0] == get_symbol_leading_char (m_objfile->obfd))
-    {
-      ++name;
-      --name_len;
-    }
+    name = name.substr (1);
 
   if (ms_type == mst_file_text && startswith (name, "__gnu_compiled"))
     return (NULL);
 
   if (symtab_create_debug >= 2)
-    printf_unfiltered ("Recording minsym:  %-21s  %18s  %4d  %s\n",
-               mst_str (ms_type), hex_string (address), section, name);
+    printf_unfiltered ("Recording minsym:  %-21s  %18s  %4d  %.*s\n",
+               mst_str (ms_type), hex_string (address), section,
+	       (int) name.size (), name.data ());
 
   if (m_msym_bunch_index == BUNCH_SIZE)
     {
@@ -1129,7 +1127,7 @@
   msymbol = &m_msym_bunch->contents[m_msym_bunch_index];
   symbol_set_language (msymbol, language_auto,
 		       &m_objfile->per_bfd->storage_obstack);
-  symbol_set_names (msymbol, name, name_len, copy_name, m_objfile->per_bfd);
+  symbol_set_names (msymbol, name, copy_name, m_objfile->per_bfd);
 
   SET_MSYMBOL_VALUE_ADDRESS (msymbol, address);
   MSYMBOL_SECTION (msymbol) = section;
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index 0a19f0b..deaecb4 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -88,7 +88,6 @@
      Arguments are:
 
      NAME - the symbol's name
-     NAME_LEN - the length of the name
      COPY_NAME - if true, the minsym code must make a copy of NAME.  If
      false, then NAME must be NUL-terminated, and must have a lifetime
      that is at least as long as OBJFILE's lifetime.
@@ -97,15 +96,14 @@
      SECTION - the symbol's section
   */
 
-  struct minimal_symbol *record_full (const char *name,
-				      int name_len,
+  struct minimal_symbol *record_full (gdb::string_view name,
 				      bool copy_name,
 				      CORE_ADDR address,
 				      enum minimal_symbol_type ms_type,
 				      int section);
 
   /* Like record_full, but:
-     - uses strlen to compute NAME_LEN,
+     - computes the length of NAME
      - passes COPY_NAME = true,
      - and passes a default SECTION, depending on the type
 
@@ -115,7 +113,7 @@
 	       enum minimal_symbol_type ms_type);
 
   /* Like record_full, but:
-     - uses strlen to compute NAME_LEN,
+     - computes the length of NAME
      - passes COPY_NAME = true.
 
      This variant does not return the new symbol.  */
@@ -124,7 +122,7 @@
 			 enum minimal_symbol_type ms_type,
 			 int section)
   {
-    record_full (name, strlen (name), true, address, ms_type, section);
+    record_full (name, true, address, ms_type, section);
   }
 
  private:
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 3e89742..19d692b 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -22,6 +22,7 @@
 
 #include "psymtab.h"
 #include "objfiles.h"
+#include "gdbsupport/gdb_string_view.h"
 
 /* A partial_symbol records the name, domain, and address class of
    symbols whose types we have not parsed yet.  For functions, it also
@@ -304,7 +305,7 @@
    LANGUAGE is the language from which the symbol originates.  This will
    influence, amongst other things, how the symbol name is demangled. */
 
-extern void add_psymbol_to_list (const char *name, int namelength,
+extern void add_psymbol_to_list (gdb::string_view name,
 				 bool copy_name, domain_enum domain,
 				 enum address_class theclass,
 				 short section,
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 31b6d59..b30d29e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1568,7 +1568,7 @@
    different domain (or address) is possible and correct.  */
 
 static struct partial_symbol *
-add_psymbol_to_bcache (const char *name, int namelength, bool copy_name,
+add_psymbol_to_bcache (gdb::string_view name, bool copy_name,
 		       domain_enum domain,
 		       enum address_class theclass,
 		       short section,
@@ -1585,7 +1585,7 @@
   psymbol.aclass = theclass;
   symbol_set_language (&psymbol.ginfo, language,
 		       objfile->partial_symtabs->obstack ());
-  symbol_set_names (&psymbol.ginfo, name, namelength, copy_name,
+  symbol_set_names (&psymbol.ginfo, name, copy_name,
 		    objfile->per_bfd);
 
   /* Stash the partial symbol away in the cache.  */
@@ -1608,7 +1608,7 @@
 /* See psympriv.h.  */
 
 void
-add_psymbol_to_list (const char *name, int namelength, bool copy_name,
+add_psymbol_to_list (gdb::string_view name, bool copy_name,
 		     domain_enum domain,
 		     enum address_class theclass,
 		     short section,
@@ -1621,7 +1621,7 @@
   int added;
 
   /* Stash the partial symbol away in the cache.  */
-  psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
+  psym = add_psymbol_to_bcache (name, copy_name, domain, theclass,
 				section, coreaddr, language, objfile, &added);
 
   /* Do not duplicate global partial symbols.  */
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 2896d98..c46fa37 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -752,11 +752,12 @@
       if (!new_name.empty ())
 	{
 	  SYMBOL_SET_NAMES (sym,
-			    new_name.c_str (), new_name.length (),
+			    new_name,
 			    1, objfile);
 	}
       else
-	SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile);
+	SYMBOL_SET_NAMES (sym, gdb::string_view (string, p - string), true,
+			  objfile);
 
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
 	cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 0a87fec..3afa2bc 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -825,26 +825,24 @@
 
 void
 symbol_set_names (struct general_symbol_info *gsymbol,
-		  const char *linkage_name, int len, bool copy_name,
+		  gdb::string_view linkage_name, bool copy_name,
 		  struct objfile_per_bfd_storage *per_bfd)
 {
   struct demangled_name_entry **slot;
-  /* A 0-terminated copy of the linkage name.  */
-  const char *linkage_name_copy;
 
   if (gsymbol->language == language_ada)
     {
       /* In Ada, we do the symbol lookups using the mangled name, so
          we can save some space by not storing the demangled name.  */
       if (!copy_name)
-	gsymbol->name = linkage_name;
+	gsymbol->name = linkage_name.data ();
       else
 	{
 	  char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
-					       len + 1);
+					       linkage_name.length () + 1);
 
-	  memcpy (name, linkage_name, len);
-	  name[len] = '\0';
+	  memcpy (name, linkage_name.data (), linkage_name.length ());
+	  name[linkage_name.length ()] = '\0';
 	  gsymbol->name = name;
 	}
       symbol_set_demangled_name (gsymbol, NULL, &per_bfd->storage_obstack);
@@ -855,20 +853,24 @@
   if (per_bfd->demangled_names_hash == NULL)
     create_demangled_names_hash (per_bfd);
 
-  if (linkage_name[len] != '\0')
+  /* A 0-terminated copy of the linkage name.  */
+  gdb::string_view linkage_name_copy;
+  /* Don't use string_view::operator[] because we are accessing beyond
+     the size of the string_view, which is technically unsupported.  */
+  if (linkage_name.data ()[linkage_name.length ()] != '\0')
     {
       char *alloc_name;
 
-      alloc_name = (char *) alloca (len + 1);
-      memcpy (alloc_name, linkage_name, len);
-      alloc_name[len] = '\0';
+      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 = alloc_name;
+      linkage_name_copy = gdb::string_view (alloc_name, linkage_name.length ());
     }
   else
     linkage_name_copy = linkage_name;
 
-  struct demangled_name_entry entry (gdb::string_view (linkage_name_copy, len));
+  struct demangled_name_entry entry (linkage_name_copy);
   slot = ((struct demangled_name_entry **)
 	  htab_find_slot (per_bfd->demangled_names_hash.get (),
 			  &entry, INSERT));
@@ -881,7 +883,7 @@
 	  && (*slot)->demangled[0] == '\0'))
     {
       char *demangled_name_ptr
-	= symbol_find_demangled_name (gsymbol, linkage_name_copy);
+	= symbol_find_demangled_name (gsymbol, linkage_name_copy.data ());
       gdb::unique_xmalloc_ptr<char> demangled_name (demangled_name_ptr);
       int demangled_len = demangled_name ? strlen (demangled_name.get ()) : 0;
 
@@ -894,15 +896,14 @@
 	 It turns out that it is actually important to still save such
 	 an entry in the hash table, because storing this name gives
 	 us better bcache hit rates for partial symbols.  */
-      if (!copy_name && linkage_name_copy == linkage_name)
+      if (!copy_name)
 	{
 	  *slot
 	    = ((struct demangled_name_entry *)
 	       obstack_alloc (&per_bfd->storage_obstack,
 			      offsetof (struct demangled_name_entry, demangled)
 			      + demangled_len + 1));
-	  new (*slot) demangled_name_entry
-	    (gdb::string_view (linkage_name, len));
+	  new (*slot) demangled_name_entry (linkage_name);
 	}
       else
 	{
@@ -915,11 +916,12 @@
 	    = ((struct demangled_name_entry *)
 	       obstack_alloc (&per_bfd->storage_obstack,
 			      offsetof (struct demangled_name_entry, demangled)
-			      + len + demangled_len + 2));
+			      + linkage_name.length () + demangled_len + 2));
 	  mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
-	  strcpy (mangled_ptr, linkage_name_copy);
+	  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, len));
+	    (gdb::string_view (mangled_ptr, linkage_name.length ()));
 	}
       (*slot)->language = gsymbol->language;
 
diff --git a/gdb/symtab.h b/gdb/symtab.h
index dc65409..6646e7d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -29,6 +29,7 @@
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/function-view.h"
 #include "gdbsupport/gdb_optional.h"
+#include "gdbsupport/gdb_string_view.h"
 #include "gdbsupport/next-iterator.h"
 #include "completer.h"
 
@@ -505,11 +506,11 @@
 
 /* Set the linkage and natural names of a symbol, by demangling
    the linkage name.  */
-#define SYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile)	\
-  symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, \
+#define SYMBOL_SET_NAMES(symbol,linkage_name,copy_name,objfile)	\
+  symbol_set_names (&(symbol)->ginfo, linkage_name, copy_name, \
 		    (objfile)->per_bfd)
 extern void symbol_set_names (struct general_symbol_info *symbol,
-			      const char *linkage_name, int len, bool copy_name,
+			      gdb::string_view linkage_name, bool copy_name,
 			      struct objfile_per_bfd_storage *per_bfd);
 
 /* Now come lots of name accessor macros.  Short version as to when to
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index bc48773..20a2187 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2634,8 +2634,9 @@
 		  namestring = gdbarch_static_transform_name
 				 (gdbarch, namestring);
 
-		add_psymbol_to_list (namestring, p - namestring, true,
-				     VAR_DOMAIN, LOC_STATIC,
+		add_psymbol_to_list (gdb::string_view (namestring,
+						       p - namestring),
+				     true, VAR_DOMAIN, LOC_STATIC,
 				     SECT_OFF_DATA (objfile),
 				     psymbol_placement::STATIC,
 				     symbol.n_value,
@@ -2645,8 +2646,9 @@
 	      case 'G':
 		/* The addresses in these entries are reported to be
 		   wrong.  See the code that reads 'G's for symtabs.  */
-		add_psymbol_to_list (namestring, p - namestring, true,
-				     VAR_DOMAIN, LOC_STATIC,
+		add_psymbol_to_list (gdb::string_view (namestring,
+						       p - namestring),
+				     true, VAR_DOMAIN, LOC_STATIC,
 				     SECT_OFF_DATA (objfile),
 				     psymbol_placement::GLOBAL,
 				     symbol.n_value,
@@ -2664,15 +2666,17 @@
 		    || (p == namestring + 1
 			&& namestring[0] != ' '))
 		  {
-		    add_psymbol_to_list (namestring, p - namestring, true,
-					 STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+		    add_psymbol_to_list (gdb::string_view (namestring,
+							   p - namestring),
+					 true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
 					 psymbol_placement::STATIC,
 					 0, psymtab_language, objfile);
 		    if (p[2] == 't')
 		      {
 			/* Also a typedef with the same name.  */
-			add_psymbol_to_list (namestring, p - namestring, true,
-					     VAR_DOMAIN, LOC_TYPEDEF, -1,
+			add_psymbol_to_list (gdb::string_view (namestring,
+							       p - namestring),
+					     true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 					     psymbol_placement::STATIC,
 					     0, psymtab_language, objfile);
 			p += 1;
@@ -2683,8 +2687,9 @@
 	      case 't':
 		if (p != namestring)	/* a name is there, not just :T...  */
 		  {
-		    add_psymbol_to_list (namestring, p - namestring, true,
-					 VAR_DOMAIN, LOC_TYPEDEF, -1,
+		    add_psymbol_to_list (gdb::string_view (namestring,
+							   p - namestring),
+					 true, VAR_DOMAIN, LOC_TYPEDEF, -1,
 					 psymbol_placement::STATIC,
 					 0, psymtab_language, objfile);
 		  }
@@ -2745,7 +2750,7 @@
 			  ;
 			/* Note that the value doesn't matter for
 			   enum constants in psymtabs, just in symtabs.  */
-			add_psymbol_to_list (p, q - p, true,
+			add_psymbol_to_list (gdb::string_view (p, q - p), true,
 					     VAR_DOMAIN, LOC_CONST, -1,
 					     psymbol_placement::STATIC,
 					     0, psymtab_language, objfile);
@@ -2763,8 +2768,9 @@
 
 	      case 'c':
 		/* Constant, e.g. from "const" in Pascal.  */
-		add_psymbol_to_list (namestring, p - namestring, true,
-				     VAR_DOMAIN, LOC_CONST, -1,
+		add_psymbol_to_list (gdb::string_view (namestring,
+						       p - namestring),
+				     true, VAR_DOMAIN, LOC_CONST, -1,
 				     psymbol_placement::STATIC,
 				     0, psymtab_language, objfile);
 		continue;
@@ -2780,8 +2786,9 @@
 		    function_outside_compilation_unit_complaint (name);
 		    xfree (name);
 		  }
-		add_psymbol_to_list (namestring, p - namestring, true,
-				     VAR_DOMAIN, LOC_BLOCK,
+		add_psymbol_to_list (gdb::string_view (namestring,
+						       p - namestring),
+				     true, VAR_DOMAIN, LOC_BLOCK,
 				     SECT_OFF_TEXT (objfile),
 				     psymbol_placement::STATIC,
 				     symbol.n_value,
@@ -2810,8 +2817,9 @@
 		if (startswith (namestring, "@FIX"))
 		  continue;
 
-		add_psymbol_to_list (namestring, p - namestring, true,
-				     VAR_DOMAIN, LOC_BLOCK,
+		add_psymbol_to_list (gdb::string_view (namestring,
+						       p - namestring),
+				     true, VAR_DOMAIN, LOC_BLOCK,
 				     SECT_OFF_TEXT (objfile),
 				     psymbol_placement::GLOBAL,
 				     symbol.n_value,
