aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ada-lang.c9
-rw-r--r--gdb/amdgpu-tdep.c51
-rw-r--r--gdb/cli/cli-script.c4
-rw-r--r--gdb/dbxread.c18
-rw-r--r--gdb/debuginfod-support.c7
-rw-r--r--gdb/dwarf2/cooked-index.c6
-rw-r--r--gdb/dwarf2/cooked-index.h2
-rw-r--r--gdb/dwarf2/index-common.c2
-rw-r--r--gdb/dwarf2/index-common.h2
-rw-r--r--gdb/dwarf2/read.c3
-rw-r--r--gdb/elfread.c8
-rw-r--r--gdb/eval.c1
-rw-r--r--gdb/language.c2
-rw-r--r--gdb/linux-tdep.c8
-rw-r--r--gdb/mdebugread.c18
-rw-r--r--gdb/minsyms.c4
-rw-r--r--gdb/minsyms.h2
-rw-r--r--gdb/psymtab.c2
-rw-r--r--gdb/psymtab.h4
-rw-r--r--gdb/solib-rocm.c21
-rw-r--r--gdb/split-name.c4
-rw-r--r--gdb/split-name.h4
-rw-r--r--gdb/stabsread.c2
-rw-r--r--gdb/symtab.c14
-rw-r--r--gdb/symtab.h14
-rw-r--r--gdb/tui/tui-io.c5
-rw-r--r--gdb/tui/tui-win.c6
-rw-r--r--gdb/xcoffread.c18
-rw-r--r--gdbsupport/common-utils.h8
-rw-r--r--gdbsupport/format.h5
-rw-r--r--gdbsupport/gdb_string_view.h2
31 files changed, 133 insertions, 123 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 58c7016..843583e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -58,6 +58,7 @@
#include "gdbsupport/function-view.h"
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/selftest.h"
+#include "gdbsupport/gdb_string_view.h"
#include <algorithm>
#include "ada-exp.h"
#include "charset.h"
@@ -1035,7 +1036,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 +13251,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 +13270,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 +13327,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 3a521a4..58d26fc 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -27,6 +27,7 @@
#include "frame-unwind.h"
#include "gdbarch.h"
#include "gdbsupport/selftest.h"
+#include "gdbsupport/gdb_string_view.h"
#include "gdbtypes.h"
#include "inferior.h"
#include "objfiles.h"
@@ -237,7 +238,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 +271,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 +298,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 +327,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 +350,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 +366,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 +374,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 +395,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 +413,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 +440,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 +453,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 +468,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 +514,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 +568,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 +597,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 +621,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 +649,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 8ec5689..b355a6d 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 @@ private:
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 3afafa7..b92193b 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 1ebd98c..a989eb9 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -20,6 +20,7 @@
#include "diagnostics.h"
#include <errno.h>
#include "gdbsupport/scoped_fd.h"
+#include "gdbsupport/gdb_string_view.h"
#include "debuginfod-support.h"
#include <optional>
#include "cli/cli-cmds.h"
@@ -246,11 +247,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 +267,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 58ea541..7c4af3a 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 5aacb32..5675ea6 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 07330a8..04b04f9 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 23e814a..79d3a59 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 6d86d28..a16139d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -96,6 +96,7 @@
#include "split-name.h"
#include "gdbsupport/parallel-for.h"
#include "gdbsupport/thread-pool.h"
+#include "gdbsupport/gdb_string_view.h"
/* When == 1, print basic high level tracing messages.
When > 1, be more verbose.
@@ -16767,7 +16768,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 86e7f61..5dc8f21 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -45,7 +45,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 "dwarf2/public.h"
#include "cli/cli-cmds.h"
@@ -195,7 +195,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)
@@ -503,7 +503,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)
@@ -517,7 +517,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/eval.c b/gdb/eval.c
index 3358b0d..8664d49 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -37,6 +37,7 @@
#include "user-regs.h"
#include "valprint.h"
#include "gdbsupport/gdb_obstack.h"
+#include "gdbsupport/gdb_string_view.h"
#include "objfiles.h"
#include "typeprint.h"
#include <ctype.h>
diff --git a/gdb/language.c b/gdb/language.c
index c768971..cfd4a62 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 db29b03..26cf483 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 cd66382..fc73160 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 1d77882..72e500b 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 f3a2474..ee415c4 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 484d4ea..d4cd581 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 4bafc6e..005a63c 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 cf56a81..9ceb7a9 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -31,6 +31,7 @@
#include "solib-svr4.h"
#include "solist.h"
#include "symfile.h"
+#include "gdbsupport/gdb_string_view.h"
#include <unordered_map>
@@ -436,8 +437,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 ();
@@ -445,7 +446,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);
@@ -461,7 +462,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;
}
@@ -469,7 +470,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)
{
@@ -481,15 +482,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);
}
}
@@ -499,7 +500,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 0253b3c..0805cb8 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 7648cf9..ad2862e 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 7402a26..4011475 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 17d1987..1547155 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 0fb0c86..ec2ac49 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 @@ private:
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 b8954af..8472464 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 = gdb::string_view (keyname (ch));
+ std::string_view name;
+ const char *name_str = keyname (ch);
+ if (name_str != nullptr)
+ name = std::string_view (name_str);
/* The following sequences are hardcoded in readline as
well. */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index a0a1233..9219c1f 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 e6ecf2a..829fc1f 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 4ceb44d..1efc5bb 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 2af34ab..26e327a 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
@@ -56,12 +56,13 @@ struct format_piece
argclass (argc),
n_int_args (n)
{
+ gdb_assert (str != nullptr);
}
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 26a3a9f..cf7af62 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 () };
}