/* Read ELF (Executable and Linking Format) object files for GDB.
- Copyright (C) 1991-2021 Free Software Foundation, Inc.
+ Copyright (C) 1991-2022 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
continue;
}
+ elf_symbol_type *elf_sym = (elf_symbol_type *) sym;
+
/* Skip "special" symbols, e.g. ARM mapping symbols. These are
symbols which do not correspond to objects in the symbol table,
but have some other target-specific meaning. */
NOTE: uweigand-20071112: Synthetic symbols do not
have an ELF-private part, so do not touch those. */
unsigned int shndx = type == ST_SYNTHETIC ? 0 :
- ((elf_symbol_type *) sym)->internal_elf_sym.st_shndx;
+ elf_sym->internal_elf_sym.st_shndx;
switch (shndx)
{
if (type != ST_SYNTHETIC)
{
/* Pass symbol size field in via BFD. FIXME!!! */
- elf_symbol_type *elf_sym = (elf_symbol_type *) sym;
- SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
+ msym->set_size (elf_sym->internal_elf_sym.st_size);
}
msym->filename = filesymname;
if (msym != NULL)
{
const char *atsign = strchr (sym->name, '@');
-
- if (atsign != NULL && atsign[1] == '@' && atsign > sym->name)
- {
- int len = atsign - sym->name;
-
- record_minimal_symbol (reader,
- gdb::string_view (sym->name, len),
- true, symaddr, ms_type, sym->section,
- objfile);
- }
- }
-
- /* For @plt symbols, also record a trampoline to the
- destination symbol. The @plt symbol will be used in
- disassembly, and the trampoline will be used when we are
- trying to find the target. */
- if (msym && ms_type == mst_text && type == ST_SYNTHETIC)
- {
- int len = strlen (sym->name);
-
- if (len > 4 && strcmp (sym->name + len - 4, "@plt") == 0)
+ bool is_at_symbol = atsign != nullptr && atsign > sym->name;
+ bool is_plt = is_at_symbol && strcmp (atsign, "@plt") == 0;
+ int len = is_at_symbol ? atsign - sym->name : 0;
+
+ if (is_at_symbol
+ && !is_plt
+ && (elf_sym->version & VERSYM_HIDDEN) == 0)
+ record_minimal_symbol (reader,
+ gdb::string_view (sym->name, len),
+ true, symaddr, ms_type, sym->section,
+ objfile);
+ else if (is_plt)
{
- struct minimal_symbol *mtramp;
-
- mtramp = record_minimal_symbol
- (reader, gdb::string_view (sym->name, len - 4), true,
- symaddr, mst_solib_trampoline, sym->section, objfile);
- if (mtramp)
+ /* For @plt symbols, also record a trampoline to the
+ destination symbol. The @plt symbol will be used
+ in disassembly, and the trampoline will be used
+ when we are trying to find the target. */
+ if (ms_type == mst_text && type == ST_SYNTHETIC)
{
- SET_MSYMBOL_SIZE (mtramp, MSYMBOL_SIZE (msym));
- mtramp->created_by_gdb = 1;
- mtramp->filename = filesymname;
- if (elf_make_msymbol_special_p)
- gdbarch_elf_make_msymbol_special (gdbarch,
- sym, mtramp);
+ struct minimal_symbol *mtramp;
+
+ mtramp = record_minimal_symbol
+ (reader, gdb::string_view (sym->name, len), true,
+ symaddr, mst_solib_trampoline, sym->section, objfile);
+ if (mtramp)
+ {
+ mtramp->set_size (msym->size());
+ mtramp->created_by_gdb = 1;
+ mtramp->filename = filesymname;
+ if (elf_make_msymbol_special_p)
+ gdbarch_elf_make_msymbol_special (gdbarch,
+ sym, mtramp);
+ }
}
}
}
true, address, mst_slot_got_plt,
msym_section, objfile);
if (msym)
- SET_MSYMBOL_SIZE (msym, ptr_size);
+ msym->set_size (ptr_size);
}
}
msym = lookup_minimal_symbol_by_pc (addr);
if (msym.minsym == NULL)
return 0;
- if (BMSYMBOL_VALUE_ADDRESS (msym) != addr)
+ if (msym.value_address () != addr)
return 0;
objfile = msym.objfile;
msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
if (msym.minsym == NULL)
continue;
- if (MSYMBOL_TYPE (msym.minsym) != mst_slot_got_plt)
+ if (msym.minsym->type () != mst_slot_got_plt)
continue;
- pointer_address = BMSYMBOL_VALUE_ADDRESS (msym);
+ pointer_address = msym.value_address ();
plt = bfd_get_section_by_name (obfd, ".plt");
if (plt == NULL)
continue;
- if (MSYMBOL_SIZE (msym.minsym) != ptr_size)
+ if (msym.minsym->size () != ptr_size)
continue;
if (target_read_memory (pointer_address, buf, ptr_size) != 0)
continue;
/* Handle inferior hit of bp_gnu_ifunc_resolver, see its definition. */
static void
-elf_gnu_ifunc_resolver_stop (struct breakpoint *b)
+elf_gnu_ifunc_resolver_stop (code_breakpoint *b)
{
struct breakpoint *b_return;
struct frame_info *prev_frame = get_prev_frame (get_current_frame ());
/* Handle inferior hit of bp_gnu_ifunc_resolver_return, see its definition. */
static void
-elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b)
+elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
{
thread_info *thread = inferior_thread ();
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
"gnu-indirect-function breakpoint type %d"),
(int) b->type);
}
- b = b_next;
+ b = (code_breakpoint *) b_next;
}
gdb_assert (b->type == bp_gnu_ifunc_resolver);
gdb_assert (b->loc->next == NULL);
if (symtab_create_debug)
{
- fprintf_unfiltered (gdb_stdlog,
- "Reading minimal symbols of objfile %s ...\n",
- objfile_name (objfile));
+ gdb_printf (gdb_stdlog,
+ "Reading minimal symbols of objfile %s ...\n",
+ objfile_name (objfile));
}
/* If we already have minsyms, then we can skip some work here.
&& ei->ctfsect == NULL)
{
if (symtab_create_debug)
- fprintf_unfiltered (gdb_stdlog,
- "... minimal symbols previously read\n");
+ gdb_printf (gdb_stdlog,
+ "... minimal symbols previously read\n");
return;
}
reader.install ();
if (symtab_create_debug)
- fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n");
+ gdb_printf (gdb_stdlog, "Done reading minimal symbols.\n");
}
/* Scan and build partial symbols for a symbol file.