Split rank_one_type_parm_complex from rank_one_type
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index 0f854422e0f7bdfc7dfb8efe2278428cdc46e72a..0513cfe69f42fef43ef605a61cf59c84dbb7fabe 100644 (file)
@@ -1,5 +1,5 @@
 /* GDB routines for manipulating the minimal symbol tables.
-   Copyright (C) 1992-2018 Free Software Foundation, Inc.
+   Copyright (C) 1992-2019 Free Software Foundation, Inc.
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
    This file is part of GDB.
@@ -50,7 +50,7 @@
 #include "cp-support.h"
 #include "language.h"
 #include "cli/cli-utils.h"
-#include "symbol.h"
+#include "common/symbol.h"
 #include <algorithm>
 #include "safe-ctype.h"
 
@@ -1080,6 +1080,33 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address,
   record_with_info (name, address, ms_type, section);
 }
 
+/* Convert an enumerator of type minimal_symbol_type to its string
+   representation.  */
+
+static const char *
+mst_str (minimal_symbol_type t)
+{
+#define MST_TO_STR(x) case x: return #x;
+  switch (t)
+  {
+    MST_TO_STR (mst_unknown);
+    MST_TO_STR (mst_text);
+    MST_TO_STR (mst_text_gnu_ifunc);
+    MST_TO_STR (mst_slot_got_plt);
+    MST_TO_STR (mst_data);
+    MST_TO_STR (mst_bss);
+    MST_TO_STR (mst_abs);
+    MST_TO_STR (mst_solib_trampoline);
+    MST_TO_STR (mst_file_text);
+    MST_TO_STR (mst_file_data);
+    MST_TO_STR (mst_file_bss);
+
+    default:
+      return "mst_???";
+  }
+#undef MST_TO_STR
+}
+
 /* See minsyms.h.  */
 
 struct minimal_symbol *
@@ -1112,6 +1139,10 @@ minimal_symbol_reader::record_full (const char *name, int name_len,
   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);
+
   if (m_msym_bunch_index == BUNCH_SIZE)
     {
       newobj = XCNEW (struct msym_bunch);
@@ -1457,30 +1488,32 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
 CORE_ADDR
 find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
 {
-  struct objfile *objfile;
-  struct minimal_symbol *msymbol;
   struct minimal_symbol *tsymbol = lookup_solib_trampoline_symbol_by_pc (pc);
 
   if (tsymbol != NULL)
     {
-      ALL_MSYMBOLS (objfile, msymbol)
-      {
-       /* Also handle minimal symbols pointing to function descriptors.  */
-       if ((MSYMBOL_TYPE (msymbol) == mst_text
-            || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
-            || MSYMBOL_TYPE (msymbol) == mst_data
-            || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
-           && strcmp (MSYMBOL_LINKAGE_NAME (msymbol),
-                      MSYMBOL_LINKAGE_NAME (tsymbol)) == 0)
-         {
-           CORE_ADDR func;
+      for (objfile *objfile : current_program_space->objfiles ())
+       {
+         for (minimal_symbol *msymbol : objfile->msymbols ())
+           {
+             /* Also handle minimal symbols pointing to function
+                descriptors.  */
+             if ((MSYMBOL_TYPE (msymbol) == mst_text
+                  || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
+                  || MSYMBOL_TYPE (msymbol) == mst_data
+                  || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+                 && strcmp (MSYMBOL_LINKAGE_NAME (msymbol),
+                            MSYMBOL_LINKAGE_NAME (tsymbol)) == 0)
+               {
+                 CORE_ADDR func;
 
-           /* Ignore data symbols that are not function
-              descriptors.  */
-           if (msymbol_is_function (objfile, msymbol, &func))
-             return func;
-         }
-      }
+                 /* Ignore data symbols that are not function
+                    descriptors.  */
+                 if (msymbol_is_function (objfile, msymbol, &func))
+                   return func;
+               }
+           }
+       }
     }
   return 0;
 }
This page took 0.024989 seconds and 4 git commands to generate.