From: Tom Tromey Date: Mon, 18 Apr 2022 01:44:20 +0000 (-0600) Subject: Replace symbol_objfile with symbol::objfile X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e19b2d94653dd4a7523a9e9b62020a63dac39439;p=binutils-gdb.git Replace symbol_objfile with symbol::objfile This turns symbol_objfile into a method on symbol. --- diff --git a/gdb/block.c b/gdb/block.c index 3fe096db583..530d2339cc6 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 a17311f74e5..cfe96cbe589 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 ec21c82532b..4f109f560b9 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 68fa35cf94c..e53c8602322 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 dbe19865d4e..48ea28fb243 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 84eb6e5d79b..c7f339a7a94 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 f4f64b669bc..0e139e09c41 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 bf9eba89c5f..d07158a5ec6 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 12c97bf63bb..5d475504fe6 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 18741e4cab5..dee11fdf57d 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 43a64edab34..7188169f660 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 433c36618e2..f6720bb07d8 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 e84cabf8f14..27e84d9f6b3 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); }