/* 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.
#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"
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 *
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);
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;
}