gdb: remove MSYMBOL_TYPE macro

Add a getter and a setter for a minimal symbol's type.  Remove the
corresponding macro and adjust all callers.

Change-Id: I89900df5ffa5687133fe1a16b2e0d4684e67a77d
This commit is contained in:
Simon Marchi 2022-01-28 10:28:57 -05:00
parent 4aeddc50d7
commit 60f62e2b83
17 changed files with 90 additions and 78 deletions

View file

@ -4898,7 +4898,7 @@ ada_lookup_simple_minsym (const char *name)
for (minimal_symbol *msymbol : objfile->msymbols ()) for (minimal_symbol *msymbol : objfile->msymbols ())
{ {
if (match_name (msymbol->linkage_name (), lookup_name, NULL) if (match_name (msymbol->linkage_name (), lookup_name, NULL)
&& MSYMBOL_TYPE (msymbol) != mst_solib_trampoline) && msymbol->type () != mst_solib_trampoline)
{ {
result.minsym = msymbol; result.minsym = msymbol;
result.objfile = objfile; result.objfile = objfile;
@ -11717,7 +11717,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
struct bound_minimal_symbol msym struct bound_minimal_symbol msym
= lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL); = lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL);
if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline) if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
error (_("Your Ada runtime appears to be missing some debugging " error (_("Your Ada runtime appears to be missing some debugging "
"information.\nCannot insert Ada exception catchpoint " "information.\nCannot insert Ada exception catchpoint "
"in this configuration.")); "in this configuration."));
@ -11740,7 +11740,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
struct bound_minimal_symbol msym struct bound_minimal_symbol msym
= lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL); = lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL);
if (msym.minsym && MSYMBOL_TYPE (msym.minsym) != mst_solib_trampoline) if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
error (_("Your Ada runtime appears to be missing some debugging " error (_("Your Ada runtime appears to be missing some debugging "
"information.\nCannot insert Ada exception catchpoint " "information.\nCannot insert Ada exception catchpoint "
"in this configuration.")); "in this configuration."));

View file

@ -3439,8 +3439,8 @@ create_std_terminate_master_breakpoint (void)
struct bound_minimal_symbol m; struct bound_minimal_symbol m;
m = lookup_minimal_symbol (func_name, NULL, objfile); m = lookup_minimal_symbol (func_name, NULL, objfile);
if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text if (m.minsym == NULL || (m.minsym->type () != mst_text
&& MSYMBOL_TYPE (m.minsym) != mst_file_text)) && m.minsym->type () != mst_file_text))
{ {
/* Prevent future lookups in this objfile. */ /* Prevent future lookups in this objfile. */
bp_objfile_data->terminate_msym.minsym = &msym_not_found; bp_objfile_data->terminate_msym.minsym = &msym_not_found;
@ -7175,8 +7175,8 @@ set_breakpoint_location_function (struct bp_location *loc)
const char *function_name; const char *function_name;
if (loc->msymbol != NULL if (loc->msymbol != NULL
&& (MSYMBOL_TYPE (loc->msymbol) == mst_text_gnu_ifunc && (loc->msymbol->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (loc->msymbol) == mst_data_gnu_ifunc)) || loc->msymbol->type () == mst_data_gnu_ifunc))
{ {
struct breakpoint *b = loc->owner; struct breakpoint *b = loc->owner;

View file

@ -1232,8 +1232,8 @@ variable: name_not_typename
is important for example for "p is important for example for "p
*__errno_location()". */ *__errno_location()". */
symbol *alias_target symbol *alias_target
= ((msymbol.minsym->type != mst_text_gnu_ifunc = ((msymbol.minsym->type () != mst_text_gnu_ifunc
&& msymbol.minsym->type != mst_data_gnu_ifunc) && msymbol.minsym->type () != mst_data_gnu_ifunc)
? find_function_alias_target (msymbol) ? find_function_alias_target (msymbol)
: NULL); : NULL);
if (alias_target != NULL) if (alias_target != NULL)

View file

@ -245,7 +245,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
sym_name, dll_name, forward_qualified_name); sym_name, dll_name, forward_qualified_name);
vma = msymbol.value_address (); vma = msymbol.value_address ();
msymtype = MSYMBOL_TYPE (msymbol.minsym); msymtype = msymbol.minsym->type ();
section = msymbol.minsym->section_index (); section = msymbol.minsym->section_index ();
/* Generate a (hopefully unique) qualified name using the first part /* Generate a (hopefully unique) qualified name using the first part

View file

@ -647,7 +647,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
or "_imp_", get rid of the prefix, and search the minimal or "_imp_", get rid of the prefix, and search the minimal
symbol in OBJFILE. Note that 'maintenance print msymbols' symbol in OBJFILE. Note that 'maintenance print msymbols'
shows that type of these "_imp_XXXX" symbols is mst_data. */ shows that type of these "_imp_XXXX" symbols is mst_data. */
if (MSYMBOL_TYPE (msym) == mst_data) if (msym->type () == mst_data)
{ {
const char *name1 = NULL; const char *name1 = NULL;
@ -669,8 +669,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
respectively in OBJFILE. Set the type of symbol "foo" respectively in OBJFILE. Set the type of symbol "foo"
as 'mst_solib_trampoline'. */ as 'mst_solib_trampoline'. */
if (found.minsym != NULL if (found.minsym != NULL
&& MSYMBOL_TYPE (found.minsym) == mst_text) && found.minsym->type () == mst_text)
MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline; found.minsym->set_type (mst_solib_trampoline);
} }
} }
} }

View file

@ -273,7 +273,7 @@ convert_symbol_bmsym (compile_c_instance *context,
addr = msym->value_address (objfile); addr = msym->value_address (objfile);
/* Conversion copied from write_exp_msymbol. */ /* Conversion copied from write_exp_msymbol. */
switch (MSYMBOL_TYPE (msym)) switch (msym->type ())
{ {
case mst_text: case mst_text:
case mst_file_text: case mst_file_text:
@ -422,7 +422,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
"symbol\n", "symbol\n",
identifier); identifier);
result = msym.value_address (); result = msym.value_address ();
if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc) if (msym.minsym->type () == mst_text_gnu_ifunc)
result = gnu_ifunc_resolve_addr (target_gdbarch (), result); result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1; found = 1;
} }

View file

@ -284,7 +284,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance,
addr = msym->value_address (objfile); addr = msym->value_address (objfile);
/* Conversion copied from write_exp_msymbol. */ /* Conversion copied from write_exp_msymbol. */
switch (MSYMBOL_TYPE (msym)) switch (msym->type ())
{ {
case mst_text: case mst_text:
case mst_file_text: case mst_file_text:
@ -459,7 +459,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
"symbol\n", "symbol\n",
identifier); identifier);
result = msym.value_address (); result = msym.value_address ();
if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc) if (msym.minsym->type () == mst_text_gnu_ifunc)
result = gnu_ifunc_resolve_addr (target_gdbarch (), result); result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1; found = 1;
} }

View file

@ -766,7 +766,7 @@ compile_object_load (const compile_file_names &file_names,
bmsym = lookup_minimal_symbol (sym->name, NULL, NULL); bmsym = lookup_minimal_symbol (sym->name, NULL, NULL);
switch (bmsym.minsym == NULL switch (bmsym.minsym == NULL
? mst_unknown : MSYMBOL_TYPE (bmsym.minsym)) ? mst_unknown : bmsym.minsym->type ())
{ {
case mst_text: case mst_text:
case mst_bss: case mst_bss:

View file

@ -828,7 +828,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
msym = lookup_minimal_symbol (name_got_plt, NULL, objfile); msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
if (msym.minsym == NULL) if (msym.minsym == NULL)
continue; continue;
if (MSYMBOL_TYPE (msym.minsym) != mst_slot_got_plt) if (msym.minsym->type () != mst_slot_got_plt)
continue; continue;
pointer_address = msym.value_address (); pointer_address = msym.value_address ();

View file

@ -2228,11 +2228,11 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
for (const auto &elem : ls->minimal_symbols) for (const auto &elem : ls->minimal_symbols)
{ {
if (MSYMBOL_TYPE (elem.minsym) == mst_text_gnu_ifunc if (elem.minsym->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc) || elem.minsym->type () == mst_data_gnu_ifunc)
{ {
CORE_ADDR msym_addr = elem.value_address (); CORE_ADDR msym_addr = elem.value_address ();
if (MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc) if (elem.minsym->type () == mst_data_gnu_ifunc)
{ {
struct gdbarch *gdbarch struct gdbarch *gdbarch
= elem.objfile->arch (); = elem.objfile->arch ();
@ -4146,8 +4146,8 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
{ {
const char *msym_name = msymbol->linkage_name (); const char *msym_name = msymbol->linkage_name ();
if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc if (msymbol->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc) || msymbol->type () == mst_data_gnu_ifunc)
want_start_sal = gnu_ifunc_resolve_name (msym_name, &func_addr); want_start_sal = gnu_ifunc_resolve_name (msym_name, &func_addr);
else else
want_start_sal = true; want_start_sal = true;
@ -4284,7 +4284,7 @@ search_minsyms_for_name (struct collect_info *info,
for (const bound_minimal_symbol &item : minsyms) for (const bound_minimal_symbol &item : minsyms)
{ {
bool skip = false; bool skip = false;
if (MSYMBOL_TYPE (item.minsym) == mst_solib_trampoline) if (item.minsym->type () == mst_solib_trampoline)
{ {
for (const bound_minimal_symbol &item2 : minsyms) for (const bound_minimal_symbol &item2 : minsyms)
{ {
@ -4293,7 +4293,7 @@ search_minsyms_for_name (struct collect_info *info,
/* Trampoline symbols can only jump to exported /* Trampoline symbols can only jump to exported
symbols. */ symbols. */
if (msymbol_type_is_static (MSYMBOL_TYPE (item2.minsym))) if (msymbol_type_is_static (item2.minsym->type ()))
continue; continue;
if (strcmp (item.minsym->linkage_name (), if (strcmp (item.minsym->linkage_name (),

View file

@ -115,7 +115,7 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
{ {
CORE_ADDR msym_addr = minsym->value_address (objfile); CORE_ADDR msym_addr = minsym->value_address (objfile);
switch (minsym->type) switch (minsym->type ())
{ {
case mst_slot_got_plt: case mst_slot_got_plt:
case mst_data: case mst_data:
@ -253,7 +253,7 @@ found_minimal_symbols::maybe_collect (const char *sfile,
struct objfile *objfile, struct objfile *objfile,
minimal_symbol *msymbol) minimal_symbol *msymbol)
{ {
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_file_text: case mst_file_text:
case mst_file_data: case mst_file_data:
@ -586,8 +586,8 @@ lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
msymbol = msymbol->hash_next) msymbol = msymbol->hash_next)
{ {
if (strcmp (msymbol->linkage_name (), name) == 0 if (strcmp (msymbol->linkage_name (), name) == 0
&& (MSYMBOL_TYPE (msymbol) == mst_data && (msymbol->type () == mst_data
|| MSYMBOL_TYPE (msymbol) == mst_bss)) || msymbol->type () == mst_bss))
return {msymbol, objfile}; return {msymbol, objfile};
} }
} }
@ -619,11 +619,11 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
msymbol = msymbol->hash_next) msymbol = msymbol->hash_next)
{ {
if (strcmp (msymbol->linkage_name (), name) == 0 && if (strcmp (msymbol->linkage_name (), name) == 0 &&
(MSYMBOL_TYPE (msymbol) == mst_text (msymbol->type () == mst_text
|| MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc || msymbol->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (msymbol) == mst_file_text)) || msymbol->type () == mst_file_text))
{ {
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_file_text: case mst_file_text:
found_file_symbol.minsym = msymbol; found_file_symbol.minsym = msymbol;
@ -840,7 +840,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
triggered by a special mst_abs_or_lib or some triggered by a special mst_abs_or_lib or some
such. */ such. */
if (MSYMBOL_TYPE (&msymbol[hi]) == mst_abs) if (msymbol[hi].type () == mst_abs)
{ {
hi--; hi--;
continue; continue;
@ -866,8 +866,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
preceding symbol too. If they are otherwise preceding symbol too. If they are otherwise
identical prefer that one. */ identical prefer that one. */
if (hi > 0 if (hi > 0
&& MSYMBOL_TYPE (&msymbol[hi]) != want_type && msymbol[hi].type () != want_type
&& MSYMBOL_TYPE (&msymbol[hi - 1]) == want_type && msymbol[hi - 1].type () == want_type
&& (MSYMBOL_SIZE (&msymbol[hi]) && (MSYMBOL_SIZE (&msymbol[hi])
== MSYMBOL_SIZE (&msymbol[hi - 1])) == MSYMBOL_SIZE (&msymbol[hi - 1]))
&& (msymbol[hi].value_raw_address () && (msymbol[hi].value_raw_address ()
@ -993,7 +993,7 @@ in_gnu_ifunc_stub (CORE_ADDR pc)
bound_minimal_symbol msymbol bound_minimal_symbol msymbol
= lookup_minimal_symbol_by_pc_section (pc, NULL, = lookup_minimal_symbol_by_pc_section (pc, NULL,
lookup_msym_prefer::GNU_IFUNC); lookup_msym_prefer::GNU_IFUNC);
return msymbol.minsym && MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc; return msymbol.minsym && msymbol.minsym->type () == mst_text_gnu_ifunc;
} }
/* See elf_gnu_ifunc_resolve_addr for its real implementation. */ /* See elf_gnu_ifunc_resolve_addr for its real implementation. */
@ -1211,7 +1211,7 @@ minimal_symbol_reader::record_full (gdb::string_view name,
msymbol->set_value_address (address); msymbol->set_value_address (address);
msymbol->set_section_index (section); msymbol->set_section_index (section);
MSYMBOL_TYPE (msymbol) = ms_type; msymbol->set_type (ms_type);
/* If we already read minimal symbols for this objfile, then don't /* If we already read minimal symbols for this objfile, then don't
ever allocate a new one. */ ever allocate a new one. */
@ -1303,10 +1303,9 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
&& strcmp (copyfrom->linkage_name (), && strcmp (copyfrom->linkage_name (),
(copyfrom + 1)->linkage_name ()) == 0) (copyfrom + 1)->linkage_name ()) == 0)
{ {
if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown) if ((copyfrom + 1)->type () == mst_unknown)
{ (copyfrom + 1)->set_type (copyfrom->type ());
MSYMBOL_TYPE ((copyfrom + 1)) = MSYMBOL_TYPE (copyfrom);
}
copyfrom++; copyfrom++;
} }
else else
@ -1530,7 +1529,7 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
lookup_msym_prefer::TRAMPOLINE); lookup_msym_prefer::TRAMPOLINE);
if (msymbol.minsym != NULL if (msymbol.minsym != NULL
&& MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline) && msymbol.minsym->type () == mst_solib_trampoline)
return msymbol.minsym; return msymbol.minsym;
return NULL; return NULL;
} }
@ -1558,10 +1557,10 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
{ {
/* Also handle minimal symbols pointing to function /* Also handle minimal symbols pointing to function
descriptors. */ descriptors. */
if ((MSYMBOL_TYPE (msymbol) == mst_text if ((msymbol->type () == mst_text
|| MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc || msymbol->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (msymbol) == mst_data || msymbol->type () == mst_data
|| MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc) || msymbol->type () == mst_data_gnu_ifunc)
&& strcmp (msymbol->linkage_name (), && strcmp (msymbol->linkage_name (),
tsymbol->linkage_name ()) == 0) tsymbol->linkage_name ()) == 0)
{ {

View file

@ -103,7 +103,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
{ {
bound_minimal_symbol bound_msym = {msymbol, objfile}; bound_minimal_symbol bound_msym = {msymbol, objfile};
struct obj_section *section = msymbol->obj_section (objfile); struct obj_section *section = msymbol->obj_section (objfile);
enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol); enum minimal_symbol_type type = msymbol->type ();
bool is_tls = (section != NULL bool is_tls = (section != NULL
&& section->the_bfd_section->flags & SEC_THREAD_LOCAL); && section->the_bfd_section->flags & SEC_THREAD_LOCAL);
@ -124,7 +124,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
/* This means we resolved a function descriptor, and we now /* This means we resolved a function descriptor, and we now
have an address for a code/text symbol instead of a data have an address for a code/text symbol instead of a data
symbol. */ symbol. */
if (MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc) if (msymbol->type () == mst_data_gnu_ifunc)
type = mst_text_gnu_ifunc; type = mst_text_gnu_ifunc;
else else
type = mst_text; type = mst_text;

View file

@ -655,9 +655,9 @@ build_address_symbolic (struct gdbarch *gdbarch,
if (msymbol.minsym != NULL if (msymbol.minsym != NULL
&& MSYMBOL_HAS_SIZE (msymbol.minsym) && MSYMBOL_HAS_SIZE (msymbol.minsym)
&& MSYMBOL_SIZE (msymbol.minsym) == 0 && MSYMBOL_SIZE (msymbol.minsym) == 0
&& MSYMBOL_TYPE (msymbol.minsym) != mst_text && msymbol.minsym->type () != mst_text
&& MSYMBOL_TYPE (msymbol.minsym) != mst_text_gnu_ifunc && msymbol.minsym->type () != mst_text_gnu_ifunc
&& MSYMBOL_TYPE (msymbol.minsym) != mst_file_text) && msymbol.minsym->type () != mst_file_text)
msymbol.minsym = NULL; msymbol.minsym = NULL;
if (msymbol.minsym != NULL) if (msymbol.minsym != NULL)
@ -681,10 +681,10 @@ build_address_symbolic (struct gdbarch *gdbarch,
first instruction of a Thumb function as <function>; the first instruction of a Thumb function as <function>; the
second instruction will be <function+2>, even though the second instruction will be <function+2>, even though the
pointer is <function+3>. This matches the ISA behavior. */ pointer is <function+3>. This matches the ISA behavior. */
if (MSYMBOL_TYPE (msymbol.minsym) == mst_text if (msymbol.minsym->type () == mst_text
|| MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc || msymbol.minsym->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (msymbol.minsym) == mst_file_text || msymbol.minsym->type () == mst_file_text
|| MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline) || msymbol.minsym->type () == mst_solib_trampoline)
addr = gdbarch_addr_bits_remove (gdbarch, addr); addr = gdbarch_addr_bits_remove (gdbarch, addr);
symbol = 0; symbol = 0;

View file

@ -4538,7 +4538,7 @@ scan_file_globals (struct objfile *objfile)
QUIT; QUIT;
/* Skip static symbols. */ /* Skip static symbols. */
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_file_text: case mst_file_text:
case mst_file_data: case mst_file_data:

View file

@ -160,7 +160,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
{ {
struct obj_section *section = msymbol->obj_section (objfile); struct obj_section *section = msymbol->obj_section (objfile);
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_unknown: case mst_unknown:
ms_type = 'u'; ms_type = 'u';

View file

@ -432,11 +432,11 @@ minimal_symbol::value_address (objfile *objfile) const
bool bool
minimal_symbol::data_p () const minimal_symbol::data_p () const
{ {
return type == mst_data return m_type == mst_data
|| type == mst_bss || m_type == mst_bss
|| type == mst_abs || m_type == mst_abs
|| type == mst_file_data || m_type == mst_file_data
|| type == mst_file_bss; || m_type == mst_file_bss;
} }
/* See symtab.h. */ /* See symtab.h. */
@ -444,12 +444,12 @@ minimal_symbol::data_p () const
bool bool
minimal_symbol::text_p () const minimal_symbol::text_p () const
{ {
return type == mst_text return m_type == mst_text
|| type == mst_text_gnu_ifunc || m_type == mst_text_gnu_ifunc
|| type == mst_data_gnu_ifunc || m_type == mst_data_gnu_ifunc
|| type == mst_slot_got_plt || m_type == mst_slot_got_plt
|| type == mst_solib_trampoline || m_type == mst_solib_trampoline
|| type == mst_file_text; || m_type == mst_file_text;
} }
/* See whether FILENAME matches SEARCH_NAME using the rule that we /* See whether FILENAME matches SEARCH_NAME using the rule that we
@ -3238,7 +3238,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
*/ */
msymbol = lookup_minimal_symbol_by_pc (pc); msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol.minsym != NULL) if (msymbol.minsym != NULL)
if (MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline) if (msymbol.minsym->type () == mst_solib_trampoline)
{ {
struct bound_minimal_symbol mfunsym struct bound_minimal_symbol mfunsym
= lookup_minimal_symbol_text (msymbol.minsym->linkage_name (), = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (),
@ -4751,7 +4751,7 @@ bool
global_symbol_searcher::is_suitable_msymbol global_symbol_searcher::is_suitable_msymbol
(const enum search_domain kind, const minimal_symbol *msymbol) (const enum search_domain kind, const minimal_symbol *msymbol)
{ {
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_data: case mst_data:
case mst_bss: case mst_bss:
@ -5767,7 +5767,7 @@ symbol_is_function_or_method (symbol *sym)
bool bool
symbol_is_function_or_method (minimal_symbol *msymbol) symbol_is_function_or_method (minimal_symbol *msymbol)
{ {
switch (MSYMBOL_TYPE (msymbol)) switch (msymbol->type ())
{ {
case mst_text: case mst_text:
case mst_text_gnu_ifunc: case mst_text_gnu_ifunc:
@ -5797,11 +5797,11 @@ find_gnu_ifunc (const symbol *sym)
iterate_over_minimal_symbols (objfile, lookup_name, iterate_over_minimal_symbols (objfile, lookup_name,
[&] (minimal_symbol *minsym) [&] (minimal_symbol *minsym)
{ {
if (MSYMBOL_TYPE (minsym) == mst_text_gnu_ifunc if (minsym->type () == mst_text_gnu_ifunc
|| MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) || minsym->type () == mst_data_gnu_ifunc)
{ {
CORE_ADDR msym_addr = minsym->value_address (objfile); CORE_ADDR msym_addr = minsym->value_address (objfile);
if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) if (minsym->type () == mst_data_gnu_ifunc)
{ {
struct gdbarch *gdbarch = objfile->arch (); struct gdbarch *gdbarch = objfile->arch ();
msym_addr = gdbarch_convert_from_func_ptr_addr msym_addr = gdbarch_convert_from_func_ptr_addr

View file

@ -699,6 +699,20 @@ struct minimal_symbol : public general_symbol_info
return m_value.address; return m_value.address;
} }
/* Return this minimal symbol's type. */
minimal_symbol_type type () const
{
return m_type;
}
/* Set this minimal symbol's type. */
void set_type (minimal_symbol_type type)
{
m_type = type;
}
/* Size of this symbol. dbx_end_psymtab in dbxread.c uses this /* Size of this symbol. dbx_end_psymtab in dbxread.c uses this
information to calculate the end of the partial symtab based on the information to calculate the end of the partial symtab based on the
address of the last symbol plus the size of the last symbol. */ address of the last symbol plus the size of the last symbol. */
@ -710,7 +724,7 @@ struct minimal_symbol : public general_symbol_info
/* Classification type for this minimal symbol. */ /* Classification type for this minimal symbol. */
ENUM_BITFIELD(minimal_symbol_type) type : MINSYM_TYPE_BITS; ENUM_BITFIELD(minimal_symbol_type) m_type : MINSYM_TYPE_BITS;
/* Non-zero if this symbol was created by gdb. /* Non-zero if this symbol was created by gdb.
Such symbols do not appear in the output of "info var|fun". */ Such symbols do not appear in the output of "info var|fun". */
@ -766,7 +780,6 @@ struct minimal_symbol : public general_symbol_info
(msymbol)->has_size = 1; \ (msymbol)->has_size = 1; \
} while (0) } while (0)
#define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0) #define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0)
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
#include "minsyms.h" #include "minsyms.h"