for (minimal_symbol *msymbol : objfile->msymbols ())
{
if (match_name (msymbol->linkage_name (), lookup_name, NULL)
- && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
+ && msymbol->type () != mst_solib_trampoline)
{
result.minsym = msymbol;
result.objfile = objfile;
struct bound_minimal_symbol msym
= 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 "
"information.\nCannot insert Ada exception catchpoint "
"in this configuration."));
struct bound_minimal_symbol msym
= 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 "
"information.\nCannot insert Ada exception catchpoint "
"in this configuration."));
struct bound_minimal_symbol m;
m = lookup_minimal_symbol (func_name, NULL, objfile);
- if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text
- && MSYMBOL_TYPE (m.minsym) != mst_file_text))
+ if (m.minsym == NULL || (m.minsym->type () != mst_text
+ && m.minsym->type () != mst_file_text))
{
/* Prevent future lookups in this objfile. */
bp_objfile_data->terminate_msym.minsym = &msym_not_found;
const char *function_name;
if (loc->msymbol != NULL
- && (MSYMBOL_TYPE (loc->msymbol) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (loc->msymbol) == mst_data_gnu_ifunc))
+ && (loc->msymbol->type () == mst_text_gnu_ifunc
+ || loc->msymbol->type () == mst_data_gnu_ifunc))
{
struct breakpoint *b = loc->owner;
is important for example for "p
*__errno_location()". */
symbol *alias_target
- = ((msymbol.minsym->type != mst_text_gnu_ifunc
- && msymbol.minsym->type != mst_data_gnu_ifunc)
+ = ((msymbol.minsym->type () != mst_text_gnu_ifunc
+ && msymbol.minsym->type () != mst_data_gnu_ifunc)
? find_function_alias_target (msymbol)
: NULL);
if (alias_target != NULL)
sym_name, dll_name, forward_qualified_name);
vma = msymbol.value_address ();
- msymtype = MSYMBOL_TYPE (msymbol.minsym);
+ msymtype = msymbol.minsym->type ();
section = msymbol.minsym->section_index ();
/* Generate a (hopefully unique) qualified name using the first part
or "_imp_", get rid of the prefix, and search the minimal
symbol in OBJFILE. Note that 'maintenance print msymbols'
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;
respectively in OBJFILE. Set the type of symbol "foo"
as 'mst_solib_trampoline'. */
if (found.minsym != NULL
- && MSYMBOL_TYPE (found.minsym) == mst_text)
- MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline;
+ && found.minsym->type () == mst_text)
+ found.minsym->set_type (mst_solib_trampoline);
}
}
}
addr = msym->value_address (objfile);
/* Conversion copied from write_exp_msymbol. */
- switch (MSYMBOL_TYPE (msym))
+ switch (msym->type ())
{
case mst_text:
case mst_file_text:
"symbol\n",
identifier);
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);
found = 1;
}
addr = msym->value_address (objfile);
/* Conversion copied from write_exp_msymbol. */
- switch (MSYMBOL_TYPE (msym))
+ switch (msym->type ())
{
case mst_text:
case mst_file_text:
"symbol\n",
identifier);
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);
found = 1;
}
bmsym = lookup_minimal_symbol (sym->name, NULL, NULL);
switch (bmsym.minsym == NULL
- ? mst_unknown : MSYMBOL_TYPE (bmsym.minsym))
+ ? mst_unknown : bmsym.minsym->type ())
{
case mst_text:
case mst_bss:
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 = msym.value_address ();
for (const auto &elem : ls->minimal_symbols)
{
- if (MSYMBOL_TYPE (elem.minsym) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc)
+ if (elem.minsym->type () == mst_text_gnu_ifunc
+ || elem.minsym->type () == mst_data_gnu_ifunc)
{
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
= elem.objfile->arch ();
{
const char *msym_name = msymbol->linkage_name ();
- if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+ if (msymbol->type () == mst_text_gnu_ifunc
+ || msymbol->type () == mst_data_gnu_ifunc)
want_start_sal = gnu_ifunc_resolve_name (msym_name, &func_addr);
else
want_start_sal = true;
for (const bound_minimal_symbol &item : minsyms)
{
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)
{
/* Trampoline symbols can only jump to exported
symbols. */
- if (msymbol_type_is_static (MSYMBOL_TYPE (item2.minsym)))
+ if (msymbol_type_is_static (item2.minsym->type ()))
continue;
if (strcmp (item.minsym->linkage_name (),
{
CORE_ADDR msym_addr = minsym->value_address (objfile);
- switch (minsym->type)
+ switch (minsym->type ())
{
case mst_slot_got_plt:
case mst_data:
struct objfile *objfile,
minimal_symbol *msymbol)
{
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_file_text:
case mst_file_data:
msymbol = msymbol->hash_next)
{
if (strcmp (msymbol->linkage_name (), name) == 0
- && (MSYMBOL_TYPE (msymbol) == mst_data
- || MSYMBOL_TYPE (msymbol) == mst_bss))
+ && (msymbol->type () == mst_data
+ || msymbol->type () == mst_bss))
return {msymbol, objfile};
}
}
msymbol = msymbol->hash_next)
{
if (strcmp (msymbol->linkage_name (), name) == 0 &&
- (MSYMBOL_TYPE (msymbol) == mst_text
- || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (msymbol) == mst_file_text))
+ (msymbol->type () == mst_text
+ || msymbol->type () == mst_text_gnu_ifunc
+ || msymbol->type () == mst_file_text))
{
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_file_text:
found_file_symbol.minsym = msymbol;
triggered by a special mst_abs_or_lib or some
such. */
- if (MSYMBOL_TYPE (&msymbol[hi]) == mst_abs)
+ if (msymbol[hi].type () == mst_abs)
{
hi--;
continue;
preceding symbol too. If they are otherwise
identical prefer that one. */
if (hi > 0
- && MSYMBOL_TYPE (&msymbol[hi]) != want_type
- && MSYMBOL_TYPE (&msymbol[hi - 1]) == want_type
+ && msymbol[hi].type () != want_type
+ && msymbol[hi - 1].type () == want_type
&& (MSYMBOL_SIZE (&msymbol[hi])
== MSYMBOL_SIZE (&msymbol[hi - 1]))
&& (msymbol[hi].value_raw_address ()
bound_minimal_symbol msymbol
= lookup_minimal_symbol_by_pc_section (pc, NULL,
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. */
msymbol->set_value_address (address);
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
ever allocate a new one. */
&& strcmp (copyfrom->linkage_name (),
(copyfrom + 1)->linkage_name ()) == 0)
{
- if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown)
- {
- MSYMBOL_TYPE ((copyfrom + 1)) = MSYMBOL_TYPE (copyfrom);
- }
+ if ((copyfrom + 1)->type () == mst_unknown)
+ (copyfrom + 1)->set_type (copyfrom->type ());
+
copyfrom++;
}
else
lookup_msym_prefer::TRAMPOLINE);
if (msymbol.minsym != NULL
- && MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+ && msymbol.minsym->type () == mst_solib_trampoline)
return msymbol.minsym;
return NULL;
}
{
/* 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)
+ if ((msymbol->type () == mst_text
+ || msymbol->type () == mst_text_gnu_ifunc
+ || msymbol->type () == mst_data
+ || msymbol->type () == mst_data_gnu_ifunc)
&& strcmp (msymbol->linkage_name (),
tsymbol->linkage_name ()) == 0)
{
{
bound_minimal_symbol bound_msym = {msymbol, 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
&& section->the_bfd_section->flags & SEC_THREAD_LOCAL);
/* This means we resolved a function descriptor, and we now
have an address for a code/text symbol instead of a data
symbol. */
- if (MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
+ if (msymbol->type () == mst_data_gnu_ifunc)
type = mst_text_gnu_ifunc;
else
type = mst_text;
if (msymbol.minsym != NULL
&& MSYMBOL_HAS_SIZE (msymbol.minsym)
&& MSYMBOL_SIZE (msymbol.minsym) == 0
- && MSYMBOL_TYPE (msymbol.minsym) != mst_text
- && MSYMBOL_TYPE (msymbol.minsym) != mst_text_gnu_ifunc
- && MSYMBOL_TYPE (msymbol.minsym) != mst_file_text)
+ && msymbol.minsym->type () != mst_text
+ && msymbol.minsym->type () != mst_text_gnu_ifunc
+ && msymbol.minsym->type () != mst_file_text)
msymbol.minsym = NULL;
if (msymbol.minsym != NULL)
first instruction of a Thumb function as <function>; the
second instruction will be <function+2>, even though the
pointer is <function+3>. This matches the ISA behavior. */
- if (MSYMBOL_TYPE (msymbol.minsym) == mst_text
- || MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (msymbol.minsym) == mst_file_text
- || MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+ if (msymbol.minsym->type () == mst_text
+ || msymbol.minsym->type () == mst_text_gnu_ifunc
+ || msymbol.minsym->type () == mst_file_text
+ || msymbol.minsym->type () == mst_solib_trampoline)
addr = gdbarch_addr_bits_remove (gdbarch, addr);
symbol = 0;
QUIT;
/* Skip static symbols. */
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_file_text:
case mst_file_data:
{
struct obj_section *section = msymbol->obj_section (objfile);
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_unknown:
ms_type = 'u';
bool
minimal_symbol::data_p () const
{
- return type == mst_data
- || type == mst_bss
- || type == mst_abs
- || type == mst_file_data
- || type == mst_file_bss;
+ return m_type == mst_data
+ || m_type == mst_bss
+ || m_type == mst_abs
+ || m_type == mst_file_data
+ || m_type == mst_file_bss;
}
/* See symtab.h. */
bool
minimal_symbol::text_p () const
{
- return type == mst_text
- || type == mst_text_gnu_ifunc
- || type == mst_data_gnu_ifunc
- || type == mst_slot_got_plt
- || type == mst_solib_trampoline
- || type == mst_file_text;
+ return m_type == mst_text
+ || m_type == mst_text_gnu_ifunc
+ || m_type == mst_data_gnu_ifunc
+ || m_type == mst_slot_got_plt
+ || m_type == mst_solib_trampoline
+ || m_type == mst_file_text;
}
/* See whether FILENAME matches SEARCH_NAME using the rule that we
*/
msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol.minsym != NULL)
- if (MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+ if (msymbol.minsym->type () == mst_solib_trampoline)
{
struct bound_minimal_symbol mfunsym
= lookup_minimal_symbol_text (msymbol.minsym->linkage_name (),
global_symbol_searcher::is_suitable_msymbol
(const enum search_domain kind, const minimal_symbol *msymbol)
{
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_data:
case mst_bss:
bool
symbol_is_function_or_method (minimal_symbol *msymbol)
{
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_text:
case mst_text_gnu_ifunc:
iterate_over_minimal_symbols (objfile, lookup_name,
[&] (minimal_symbol *minsym)
{
- if (MSYMBOL_TYPE (minsym) == mst_text_gnu_ifunc
- || MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc)
+ if (minsym->type () == mst_text_gnu_ifunc
+ || minsym->type () == mst_data_gnu_ifunc)
{
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 ();
msym_addr = gdbarch_convert_from_func_ptr_addr
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
information to calculate the end of the partial symtab based on the
address of the last symbol plus the size of the last 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.
Such symbols do not appear in the output of "info var|fun". */
(msymbol)->has_size = 1; \
} while (0)
#define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0)
-#define MSYMBOL_TYPE(msymbol) (msymbol)->type
#include "minsyms.h"