aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-04-17 19:44:20 -0600
committerTom Tromey <tom@tromey.com>2022-04-20 09:28:16 -0600
commite19b2d94653dd4a7523a9e9b62020a63dac39439 (patch)
tree19d21478ff945ffc1308932bac7bc9e9370f4fb2
parentf66b5363431ccf23debbdfacb63c09c2c57b6ada (diff)
downloadbinutils-e19b2d94653dd4a7523a9e9b62020a63dac39439.zip
binutils-e19b2d94653dd4a7523a9e9b62020a63dac39439.tar.gz
binutils-e19b2d94653dd4a7523a9e9b62020a63dac39439.tar.bz2
Replace symbol_objfile with symbol::objfile
This turns symbol_objfile into a method on symbol.
-rw-r--r--gdb/block.c2
-rw-r--r--gdb/expop.h2
-rw-r--r--gdb/findvar.c10
-rw-r--r--gdb/guile/scm-frame.c2
-rw-r--r--gdb/guile/scm-symbol.c2
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/printcmd.c2
-rw-r--r--gdb/python/py-frame.c2
-rw-r--r--gdb/python/py-symbol.c4
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.c14
-rw-r--r--gdb/symtab.h12
-rw-r--r--gdb/valops.c2
13 files changed, 29 insertions, 29 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 3fe096d..530d233 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -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 ();
diff --git a/gdb/expop.h b/gdb/expop.h
index a17311f..cfe96cb 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -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
diff --git a/gdb/findvar.c b/gdb/findvar.c
index ec21c82..4f109f5 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -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. */
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 68fa35c..e53c860 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -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;
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index dbe1986..48ea28f 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -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)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 84eb6e5..c7f339a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -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))
{
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f4f64b6..0e139e0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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);
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index bf9eba8..d07158a 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -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;
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 12c97bf..5d47550 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -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)
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 18741e4..dee11fd 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -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;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 43a64ed..7188169 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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. */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 433c366..f6720bb 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -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);
diff --git a/gdb/valops.c b/gdb/valops.c
index e84cabf..27e84d9 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -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);
}