Work around GCC 6.3.1 bug
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index 5f6db60ecabfb3b69362052de01ec893d390ff4a..37edbd8e8273cab7c59722375bab8f7be2e90f9c 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.  */
@@ -73,7 +90,7 @@ msymbol_hash_iw (const char *string)
 
   while (*string && *string != '(')
     {
-      string = skip_spaces_const (string);
+      string = skip_spaces (string);
       if (*string && *string != '(')
        {
          hash = SYMBOL_HASH_NEXT (hash, *string);
@@ -158,22 +175,20 @@ lookup_minimal_symbol (const char *name, const char *sfile,
   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 ();
        }
     }
 
@@ -272,9 +287,6 @@ lookup_minimal_symbol (const char *name, const char *sfile,
        }
     }
 
-  if (needtofreename)
-    xfree ((void *) modified_name);
-
   /* External symbols are best.  */
   if (found_symbol.minsym != NULL)
     {
@@ -943,7 +955,7 @@ minimal_symbol_reader::~minimal_symbol_reader ()
 
 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;
 
@@ -974,10 +986,9 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address,
 
 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;
This page took 0.025276 seconds and 4 git commands to generate.