/* GDB routines for manipulating the minimal symbol tables.
- Copyright (C) 1992-2016 Free Software Foundation, Inc.
+ Copyright (C) 1992-2017 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB.
#include "cli/cli-utils.h"
#include "symbol.h"
+/* See minsyms.h. */
+
+bool
+msymbol_is_text (minimal_symbol *msymbol)
+{
+ switch (MSYMBOL_TYPE (msymbol))
+ {
+ case mst_text:
+ case mst_text_gnu_ifunc:
+ case mst_solib_trampoline:
+ case mst_file_text:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE.
At the end, copy them all into one newly allocated location on an objfile's
per-BFD storage obstack. */
while (*string && *string != '(')
{
- string = skip_spaces_const (string);
+ string = skip_spaces (string);
if (*string && *string != '(')
{
hash = SYMBOL_HASH_NEXT (hash, *string);
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE;
- int needtofreename = 0;
- const char *modified_name;
+ const char *modified_name = name;
if (sfile != NULL)
sfile = lbasename (sfile);
/* For C++, canonicalize the input name. */
- modified_name = name;
+ std::string modified_name_storage;
if (current_language->la_language == language_cplus)
{
- char *cname = cp_canonicalize_string (name);
-
- if (cname)
+ std::string cname = cp_canonicalize_string (name);
+ if (!cname.empty ())
{
- modified_name = cname;
- needtofreename = 1;
+ std::swap (modified_name_storage, cname);
+ modified_name = modified_name_storage.c_str ();
}
}
}
}
- if (needtofreename)
- xfree ((void *) modified_name);
-
/* External symbols are best. */
if (found_symbol.minsym != NULL)
{
void
minimal_symbol_reader::record (const char *name, CORE_ADDR address,
- enum minimal_symbol_type ms_type)
+ enum minimal_symbol_type ms_type)
{
int section;
struct minimal_symbol *
minimal_symbol_reader::record_full (const char *name, int name_len,
- int copy_name,
- CORE_ADDR address,
- enum minimal_symbol_type ms_type,
- int section)
+ bool copy_name, CORE_ADDR address,
+ enum minimal_symbol_type ms_type,
+ int section)
{
struct msym_bunch *newobj;
struct minimal_symbol *msymbol;