struct symtab *symtab = NULL;
if (syms[i].symbol->is_objfile_owned ())
- symtab = symbol_symtab (syms[i].symbol);
+ symtab = syms[i].symbol->symtab ();
if (syms[i].symbol->line () != 0 && symtab != NULL)
{
the symbol is local or not, we check the block where we found it
against the global and static blocks of its associated symtab. */
if (sym
- && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector (),
+ && BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
GLOBAL_BLOCK) != block
- && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector (),
+ && BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
STATIC_BLOCK) != block)
return;
sym = bfun->sym;
if (sym != NULL)
- filename = symtab_to_filename_for_display (symbol_symtab (sym));
+ filename = symtab_to_filename_for_display (sym->symtab ());
else
filename = "<unknown>";
return 1;
/* Check the location of those functions, as well. */
- bfname = symtab_to_fullname (symbol_symtab (sym));
- fname = symtab_to_fullname (symbol_symtab (fun));
+ bfname = symtab_to_fullname (sym->symtab ());
+ fname = symtab_to_fullname (fun->symtab ());
if (filename_cmp (fname, bfname) != 0)
return 1;
}
/* Inlined functions may have symbols not in the global or
static symbol lists. */
if (BLOCK_FUNCTION (block) != NULL)
- if (symbol_symtab (BLOCK_FUNCTION (block)) == NULL)
- symbol_set_symtab (BLOCK_FUNCTION (block), symtab);
+ if (BLOCK_FUNCTION (block)->symtab () == NULL)
+ BLOCK_FUNCTION (block)->set_symtab (symtab);
/* Note that we only want to fix up symbols from the local
blocks, not blocks coming from included symtabs. That is why
we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
- if (symbol_symtab (sym) == NULL)
- symbol_set_symtab (sym, symtab);
+ if (sym->symtab () == NULL)
+ sym->set_symtab (symtab);
}
}
{
for (i = 0; i < pending->nsyms; ++i)
{
- if (symbol_symtab (pending->symbol[i]) == NULL)
- symbol_set_symtab (pending->symbol[i], cu->primary_filetab ());
+ if (pending->symbol[i]->symtab () == NULL)
+ pending->symbol[i]->set_symtab (cu->primary_filetab ());
}
}
}
int is_local)
{
gcc_type sym_type;
- const char *filename = symbol_symtab (sym.symbol)->filename;
+ const char *filename = sym.symbol->symtab ()->filename;
unsigned short line = sym.symbol->line ();
context->error_symbol_once (sym.symbol);
{
/* Squash compiler warning. */
gcc_type sym_type = 0;
- const char *filename = symbol_symtab (sym.symbol)->filename;
+ const char *filename = sym.symbol->symtab ()->filename;
unsigned short line = sym.symbol->line ();
instance->error_symbol_once (sym.symbol);
we can do but ignore this member. */
continue;
}
- const char *filename = symbol_symtab (sym.symbol)->filename;
+ const char *filename = sym.symbol->symtab ()->filename;
unsigned int line = sym.symbol->line ();
physaddr = sym.symbol->value_address ();
continue;
}
- const char *filename = symbol_symtab (sym.symbol)->filename;
+ const char *filename = sym.symbol->symtab ()->filename;
unsigned int line = sym.symbol->line ();
CORE_ADDR address = BLOCK_START (sym.symbol->value_block ());
const char *kind;
lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
symbol_name_match_type::SEARCH_NAME);
- bv = symbol_symtab (func_sym)->compunit ()->blockvector ();
+ bv = func_sym->symtab ()->compunit ()->blockvector ();
nblocks = BLOCKVECTOR_NBLOCKS (bv);
gdb_ptr_type_sym = NULL;
struct objfile *objfile = cu->per_objfile->objfile;
if (strcmp (package_name.get (), this_package_name.get ()) != 0)
complaint (_("Symtab %s has objects from two different Go packages: %s and %s"),
- (symbol_symtab (sym) != NULL
+ (sym->symtab () != NULL
? symtab_to_filename_for_display
- (symbol_symtab (sym))
+ (sym->symtab ())
: objfile_name (objfile)),
this_package_name.get (), package_name.get ());
}
of gdb assume that symbols do, and this is reasonably
true. */
for (symbol *sym : template_args)
- symbol_set_symtab (sym, symbol_symtab (templ_func));
+ sym->set_symtab (templ_func->symtab ());
}
/* In C++, we can have functions nested inside functions (e.g., when
{
struct symtab *symtab;
if (sym != nullptr)
- symtab = symbol_symtab (sym);
+ symtab = sym->symtab ();
else if (cu->line_header != nullptr)
{
/* Any related symtab will do. */
other parts of gdb assume that symbols do, and this is
reasonably true. */
for (int i = 0; i < TYPE_N_TEMPLATE_ARGUMENTS (type); ++i)
- symbol_set_symtab (TYPE_TEMPLATE_ARGUMENT (type, i), symtab);
+ TYPE_TEMPLATE_ARGUMENT (type, i)->set_symtab (symtab);
}
}
}
if (fe == NULL)
complaint (_("file index out of range"));
else
- symbol_set_symtab (sym, fe->symtab);
+ sym->set_symtab (fe->symtab);
}
switch (die->tag)
symtab_and_line sal;
if (sym->line () != 0)
{
- sal.symtab = symbol_symtab (sym);
+ sal.symtab = sym->symtab ();
sal.line = sym->line ();
}
else
if (!symbol->is_objfile_owned ())
return SCM_BOOL_F;
- return stscm_scm_from_symtab (symbol_symtab (symbol));
+ return stscm_scm_from_symtab (symbol->symtab ());
}
/* (symbol-name <gdb:symbol>) -> string */
/* The name. */
block_name->set_domain (VAR_DOMAIN);
block_name->set_aclass_index (LOC_BLOCK);
- symbol_set_symtab (block_name, filetab);
+ block_name->set_symtab (filetab);
block_name->set_type (lookup_function_type (block_type));
block_name->set_value_block (new_block);
for (const auto &sym : ls->labels.label_symbols)
{
struct program_space *pspace
- = symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace;
+ = sym.symbol->symtab ()->compunit ()->objfile ()->pspace;
if (symbol_to_sal (&sal, state->funfirstline, sym.symbol)
&& maybe_add_address (state->addr_set, pspace, sal.pc))
for (const auto &sym : ls->function_symbols)
{
program_space *pspace
- = symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace;
+ = sym.symbol->symtab ()->compunit ()->objfile ()->pspace;
set_current_program_space (pspace);
/* Don't skip to the first line of the function if we
{
uintptr_t uia, uib;
- uia = (uintptr_t) symbol_symtab (a.symbol)->compunit ()->objfile ()->pspace;
- uib = (uintptr_t) symbol_symtab (b.symbol)->compunit ()->objfile ()->pspace;
+ uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace;
+ uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace;
if (uia < uib)
return true;
/* Program spaces that are executing startup should have
been filtered out earlier. */
- pspace = symbol_symtab (sym)->compunit ()->objfile ()->pspace;
+ pspace = sym->symtab ()->compunit ()->objfile ()->pspace;
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
t = check_typedef (sym->type ());
sure not to miss the last batch. */
if (ix == sym_classes->size () - 1
|| (pspace
- != (symbol_symtab (sym_classes->at (ix + 1).symbol)
+ != (sym_classes->at (ix + 1).symbol->symtab ()
->compunit ()->objfile ()->pspace)))
{
/* If we did not find a direct implementation anywhere in
{
fn_sym = elt.symbol;
set_current_program_space
- (symbol_symtab (fn_sym)->compunit ()->objfile ()->pspace);
+ (fn_sym->symtab ()->compunit ()->objfile ()->pspace);
block = fn_sym->value_block ();
find_label_symbols_in_block (block, name, fn_sym, completion_mode,
if (sym->aclass () == LOC_LABEL && sym->value_address () != 0)
{
*result = {};
- result->symtab = symbol_symtab (sym);
+ result->symtab = sym->symtab ();
result->symbol = sym;
result->line = sym->line ();
result->pc = sym->value_address ();
{
/* We know its line number. */
*result = {};
- result->symtab = symbol_symtab (sym);
+ result->symtab = sym->symtab ();
result->symbol = sym;
result->line = sym->line ();
result->pc = sym->value_address ();
static void
add_symbol (struct symbol *s, struct symtab *symtab, struct block *b)
{
- symbol_set_symtab (s, symtab);
+ s->set_symtab (symtab);
mdict_add_symbol (BLOCK_MULTIDICT (b), s);
}
/* As long as we have debug symbols... */
while (i < symbols.size () && symbols[i].msymbol.minsym == nullptr)
{
- symtab *symtab = symbol_symtab (symbols[i].symbol);
+ symtab *symtab = symbols[i].symbol->symtab ();
ui_out_emit_tuple symtab_tuple_emitter (uiout, nullptr);
uiout->field_string ("filename",
/* As long as we have debug symbols from this symtab... */
for (; (i < symbols.size ()
&& symbols[i].msymbol.minsym == nullptr
- && symbol_symtab (symbols[i].symbol) == symtab);
+ && symbols[i].symbol->symtab () == symtab);
++i)
{
symbol_search &s = symbols[i];
/* The symbol for the first result, and the symtab in which it resides. */
const symbol *first_result_symbol = iter->second.symbol;
- symtab *first_symbtab = symbol_symtab (first_result_symbol);
+ symtab *first_symbtab = first_result_symbol->symtab ();
/* Formatted output. */
ui_out_emit_tuple current_file (uiout, nullptr);
we change module, or we change symtab. */
for (; (iter != end
&& first_module_symbol == iter->first.symbol
- && first_symbtab == symbol_symtab (iter->second.symbol));
+ && first_symbtab == iter->second.symbol->symtab ());
++iter)
output_debug_symbol (uiout, kind, iter->second.symbol,
iter->second.block);
if (!symbol->is_objfile_owned ())
Py_RETURN_NONE;
- return symtab_to_symtab_object (symbol_symtab (symbol));
+ return symtab_to_symtab_object (symbol->symtab ());
}
static PyObject *
obj->symbol = symbol;
obj->prev = NULL;
if (symbol->is_objfile_owned ()
- && symbol_symtab (symbol) != NULL)
+ && symbol->symtab () != NULL)
{
struct objfile *objfile = symbol->objfile ();
sym_obj->prev->next = sym_obj->next;
else if (sym_obj->symbol != NULL
&& sym_obj->symbol->is_objfile_owned ()
- && symbol_symtab (sym_obj->symbol) != NULL)
+ && sym_obj->symbol->symtab () != NULL)
{
set_objfile_data (sym_obj->symbol->objfile (),
sympy_objfile_data_key, sym_obj->next);
if (p.msymbol.minsym == NULL)
{
- struct symtab *symtab = symbol_symtab (p.symbol);
+ struct symtab *symtab = p.symbol->symtab ();
const char *fullname = symtab_to_fullname (symtab);
symbol_name = fullname;
if (sym == NULL)
goto out;
- symtab = symbol_symtab (sym);
+ symtab = sym->symtab ();
for (const btrace_insn &insn : bfun->insn)
{
return;
uiout->field_string ("file",
- symtab_to_filename_for_display (symbol_symtab (sym)),
+ symtab_to_filename_for_display (sym->symtab ()),
file_name_style.style ());
btrace_compute_src_line_range (bfun, &begin, &end);
if (sal.symtab == NULL)
/* We couldn't find the location of `main', possibly due to missing
line number info, fall back to line 1 in the corresponding file. */
- loc->set (symbol_symtab (bsym.symbol), 1);
+ loc->set (bsym.symbol->symtab (), 1);
else
loc->set (sal.symtab, std::max (sal.line - (lines_to_list - 1), 1));
return;
/* We either have an OBJFILE, or we can get at it from the sym's
symtab. Anything else is a bug. */
- gdb_assert (objfile || symbol_symtab (sym));
+ gdb_assert (objfile || sym->symtab ());
if (objfile == NULL)
objfile = sym->objfile ();
have proven the CU (Compilation Unit) supports it. sal->SYMTAB does not
have to be set by the caller so we use SYM instead. */
if (sym != NULL
- && symbol_symtab (sym)->compunit ()->locations_valid ())
+ && sym->symtab ()->compunit ()->locations_valid ())
force_skip = 0;
saved_pc = pc;
is aligned. */
if (!force_skip && sym && start_sal.symtab == NULL)
{
- pc = skip_prologue_using_lineinfo (pc, symbol_symtab (sym));
+ pc = skip_prologue_using_lineinfo (pc, sym->symtab ());
/* Recalculate the line number. */
start_sal = find_pc_sect_line (pc, section, 0);
}
&& BLOCK_FUNCTION (function_block)->line () != 0)
{
sal->line = BLOCK_FUNCTION (function_block)->line ();
- sal->symtab = symbol_symtab (BLOCK_FUNCTION (function_block));
+ sal->symtab = BLOCK_FUNCTION (function_block)->symtab ();
}
}
{
int c;
- c = FILENAME_CMP (symbol_symtab (sym_a.symbol)->filename,
- symbol_symtab (sym_b.symbol)->filename);
+ c = FILENAME_CMP (sym_a.symbol->symtab ()->filename,
+ sym_b.symbol->symtab ()->filename);
if (c != 0)
return c;
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- struct symtab *real_symtab = symbol_symtab (sym);
+ struct symtab *real_symtab = sym->symtab ();
QUIT;
int block, const char *last)
{
scoped_switch_to_sym_language_if_auto l (sym);
- struct symtab *s = symbol_symtab (sym);
+ struct symtab *s = sym->symtab ();
if (last != NULL)
{
p.block,
last_filename);
last_filename
- = symtab_to_filename_for_display (symbol_symtab (p.symbol));
+ = symtab_to_filename_for_display (p.symbol->symtab ());
}
}
}
{
if (p.msymbol.minsym == NULL)
{
- struct symtab *symtab = symbol_symtab (p.symbol);
+ struct symtab *symtab = p.symbol->symtab ();
const char *fullname = symtab_to_fullname (symtab);
string = string_printf ("%s:'%s'", fullname,
/* See symtab.h. */
struct symtab *
-symbol_symtab (const struct symbol *symbol)
+symbol::symtab () const
{
- gdb_assert (symbol->is_objfile_owned ());
- return symbol->owner.symtab;
+ gdb_assert (is_objfile_owned ());
+ return owner.symtab;
}
/* See symtab.h. */
void
-symbol_set_symtab (struct symbol *symbol, struct symtab *symtab)
+symbol::set_symtab (struct symtab *symtab)
{
- gdb_assert (symbol->is_objfile_owned ());
- symbol->owner.symtab = symtab;
+ gdb_assert (is_objfile_owned ());
+ owner.symtab = symtab;
}
/* See symtab.h. */
print_symbol_info (FUNCTIONS_DOMAIN, q.symbol, q.block,
last_filename);
last_filename
- = symtab_to_filename_for_display (symbol_symtab (q.symbol));
+ = symtab_to_filename_for_display (q.symbol->symtab ());
}
}
struct gdbarch *arch () const;
+ /* Return the symtab of this symbol. It is an error to call this if
+ is_objfile_owned is false, which only happens for
+ architecture-provided types. */
+
+ struct symtab *symtab () const;
+
+ /* Set the symtab of this symbol to SYMTAB. It is an error to call
+ this if is_objfile_owned is false, which only happens for
+ architecture-provided types. */
+
+ void set_symtab (struct symtab *symtab);
+
/* Data type of value */
struct type *m_type = nullptr;
extern int register_symbol_register_impl (enum address_class,
const struct symbol_register_ops *);
-/* Return the SYMTAB of SYMBOL.
- It is an error to call this if symbol.is_objfile_owned is false, which
- only happens for architecture-provided types. */
-
-extern struct symtab *symbol_symtab (const struct symbol *symbol);
-
-/* Set the symtab of SYMBOL to SYMTAB.
- It is an error to call this if symbol.is_objfile_owned is false, which
- only happens for architecture-provided types. */
-
-extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab);
-
/* An instance of this type is used to represent a C++ template
function. A symbol is really of this type iff
symbol::is_cplus_template_function is true. */