Replace symbol_objfile with symbol::objfile

This turns symbol_objfile into a method on symbol.
This commit is contained in:
Tom Tromey
2022-04-17 19:44:20 -06:00
parent f66b536343
commit e19b2d9465
13 changed files with 29 additions and 29 deletions

View File

@ -48,7 +48,7 @@ block_objfile (const struct block *block)
const struct global_block *global_block;
if (BLOCK_FUNCTION (block) != NULL)
return symbol_objfile (BLOCK_FUNCTION (block));
return BLOCK_FUNCTION (block)->objfile ();
global_block = (struct global_block *) block_global_block (block);
return global_block->compunit_symtab->objfile ();

View File

@ -225,7 +225,7 @@ check_objfile (struct type *type, struct objfile *objfile)
static inline bool
check_objfile (struct symbol *sym, struct objfile *objfile)
{
return check_objfile (symbol_objfile (sym), objfile);
return check_objfile (sym->objfile (), objfile);
}
static inline bool

View File

@ -636,7 +636,7 @@ language_defn::read_var_value (struct symbol *var,
v = allocate_value (type);
if (overlay_debugging)
{
struct objfile *var_objfile = symbol_objfile (var);
struct objfile *var_objfile = var->objfile ();
addr = symbol_overlayed_address (var->value_address (),
var->obj_section (var_objfile));
store_typed_address (value_contents_raw (v).data (), type, addr);
@ -663,7 +663,7 @@ language_defn::read_var_value (struct symbol *var,
if (overlay_debugging)
addr
= symbol_overlayed_address (var->value_address (),
var->obj_section (symbol_objfile (var)));
var->obj_section (var->objfile ()));
else
addr = var->value_address ();
break;
@ -705,7 +705,7 @@ language_defn::read_var_value (struct symbol *var,
if (overlay_debugging)
addr = symbol_overlayed_address
(BLOCK_ENTRY_PC (var->value_block ()),
var->obj_section (symbol_objfile (var)));
var->obj_section (var->objfile ()));
else
addr = BLOCK_ENTRY_PC (var->value_block ());
break;
@ -755,7 +755,7 @@ language_defn::read_var_value (struct symbol *var,
gdbarch_iterate_over_objfiles_in_search_order
(symbol_arch (var),
minsym_lookup_iterator_cb, &lookup_data,
symbol_objfile (var));
var->objfile ());
msym = lookup_data.result.minsym;
/* If we can't find the minsym there's a problem in the symbol info.
@ -764,7 +764,7 @@ language_defn::read_var_value (struct symbol *var,
if (msym == NULL)
{
const char *flavour_name
= objfile_flavour_name (symbol_objfile (var));
= objfile_flavour_name (var->objfile ());
/* We can't get here unless we've opened the file, so flavour_name
can't be NULL. */

View File

@ -624,7 +624,7 @@ gdbscm_frame_block (SCM self)
if (block != NULL)
{
return bkscm_scm_from_block
(block, symbol_objfile (BLOCK_FUNCTION (fn_block)));
(block, BLOCK_FUNCTION (fn_block)->objfile ());
}
return SCM_BOOL_F;

View File

@ -103,7 +103,7 @@ syscm_get_symbol_map (struct symbol *symbol)
if (symbol->is_objfile_owned ())
{
struct objfile *objfile = symbol_objfile (symbol);
struct objfile *objfile = symbol->objfile ();
htab = (htab_t) objfile_data (objfile, syscm_objfile_data_key);
if (htab == NULL)

View File

@ -1086,7 +1086,7 @@ jump_command (const char *arg, int from_tty)
struct obj_section *section;
fixup_symbol_section (sfn, 0);
section = sfn->obj_section (symbol_objfile (sfn));
section = sfn->obj_section (sfn->objfile ());
if (section_is_overlay (section)
&& !section_is_mapped (section))
{

View File

@ -1681,7 +1681,7 @@ info_address_command (const char *exp, int from_tty)
gdb_printf ("\" is ");
val = sym->value_longest ();
if (sym->is_objfile_owned ())
section = sym->obj_section (symbol_objfile (sym));
section = sym->obj_section (sym->objfile ());
else
section = NULL;
gdbarch = symbol_arch (sym);

View File

@ -306,7 +306,7 @@ frapy_block (PyObject *self, PyObject *args)
if (block)
{
return block_to_block_object
(block, symbol_objfile (BLOCK_FUNCTION (fn_block)));
(block, BLOCK_FUNCTION (fn_block)->objfile ());
}
Py_RETURN_NONE;

View File

@ -305,7 +305,7 @@ set_symbol (symbol_object *obj, struct symbol *symbol)
if (symbol->is_objfile_owned ()
&& symbol_symtab (symbol) != NULL)
{
struct objfile *objfile = symbol_objfile (symbol);
struct objfile *objfile = symbol->objfile ();
obj->next = ((symbol_object *)
objfile_data (objfile, sympy_objfile_data_key));
@ -351,7 +351,7 @@ sympy_dealloc (PyObject *obj)
&& sym_obj->symbol->is_objfile_owned ()
&& symbol_symtab (sym_obj->symbol) != NULL)
{
set_objfile_data (symbol_objfile (sym_obj->symbol),
set_objfile_data (sym_obj->symbol->objfile (),
sympy_objfile_data_key, sym_obj->next);
}
if (sym_obj->next)

View File

@ -503,7 +503,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
struct obj_section *section;
if (symbol->is_objfile_owned ())
section = symbol->obj_section (symbol_objfile (symbol));
section = symbol->obj_section (symbol->objfile ());
else
section = NULL;

View File

@ -1806,7 +1806,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
gdb_assert (objfile || symbol_symtab (sym));
if (objfile == NULL)
objfile = symbol_objfile (sym);
objfile = sym->objfile ();
if (sym->obj_section (objfile) != nullptr)
return sym;
@ -3780,7 +3780,7 @@ find_function_start_sal (symbol *sym, bool funfirstline)
fixup_symbol_section (sym, NULL);
symtab_and_line sal
= find_function_start_sal_1 (BLOCK_ENTRY_PC (sym->value_block ()),
sym->obj_section (symbol_objfile (sym)),
sym->obj_section (sym->objfile ()),
funfirstline);
sal.symbol = sym;
return sal;
@ -3907,7 +3907,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
{
fixup_symbol_section (sym, NULL);
objfile = symbol_objfile (sym);
objfile = sym->objfile ();
pc = BLOCK_ENTRY_PC (sym->value_block ());
section = sym->obj_section (objfile);
name = sym->linkage_name ();
@ -5789,7 +5789,7 @@ find_gnu_ifunc (const symbol *sym)
lookup_name_info lookup_name (sym->search_name (),
symbol_name_match_type::SEARCH_NAME);
struct objfile *objfile = symbol_objfile (sym);
struct objfile *objfile = sym->objfile ();
CORE_ADDR address = BLOCK_ENTRY_PC (sym->value_block ());
minimal_symbol *ifunc = NULL;
@ -6593,10 +6593,10 @@ initialize_ordinary_address_classes (void)
/* See symtab.h. */
struct objfile *
symbol_objfile (const struct symbol *symbol)
symbol::objfile () const
{
gdb_assert (symbol->is_objfile_owned ());
return symbol->owner.symtab->compunit ()->objfile ();
gdb_assert (is_objfile_owned ());
return owner.symtab->compunit ()->objfile ();
}
/* See symtab.h. */

View File

@ -1376,6 +1376,12 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
m_artificial = artificial;
}
/* Return the OBJFILE of this symbol. It is an error to call this
if is_objfile_owned is false, which only happens for
architecture-provided types. */
struct objfile *objfile () const;
/* Data type of value */
struct type *m_type = nullptr;
@ -1492,12 +1498,6 @@ extern int register_symbol_block_impl (enum address_class aclass,
extern int register_symbol_register_impl (enum address_class,
const struct symbol_register_ops *);
/* Return the OBJFILE 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 objfile *symbol_objfile (const struct symbol *symbol);
/* Return the ARCH of SYMBOL. */
extern struct gdbarch *symbol_arch (const struct symbol *symbol);

View File

@ -127,7 +127,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
}
if (objf_p)
*objf_p = symbol_objfile (sym.symbol);
*objf_p = sym.symbol->objfile ();
return value_of_variable (sym.symbol, sym.block);
}