From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 588AF3858D1E; Wed, 20 Apr 2022 16:28:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 588AF3858D1E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Replace symbol_symtab with symbol::symtab X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: bcd6845e2b66adb58d36eb1d9b8fbf71900b517d X-Git-Newrev: 4206d69e96ac401cf2975f37bf4e4d3a3c838313 Message-Id: <20220420162826.588AF3858D1E@sourceware.org> Date: Wed, 20 Apr 2022 16:28:26 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2022 16:28:26 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4206d69e96ac= 401cf2975f37bf4e4d3a3c838313 commit 4206d69e96ac401cf2975f37bf4e4d3a3c838313 Author: Tom Tromey Date: Sun Apr 17 20:00:59 2022 -0600 Replace symbol_symtab with symbol::symtab =20 This turns symbol_symtab into a method on symbol. It also replaces symbol_set_symtab with a method. Diff: --- gdb/ada-lang.c | 6 +++--- gdb/btrace.c | 6 +++--- gdb/buildsym.c | 12 ++++++------ gdb/compile/compile-c-symbols.c | 2 +- gdb/compile/compile-cplus-symbols.c | 2 +- gdb/compile/compile-cplus-types.c | 4 ++-- gdb/compile/compile-object-load.c | 2 +- gdb/dwarf2/read.c | 12 ++++++------ gdb/frame.c | 2 +- gdb/guile/scm-symbol.c | 2 +- gdb/jit.c | 2 +- gdb/linespec.c | 18 +++++++++--------- gdb/mdebugread.c | 2 +- gdb/mi/mi-symbol-cmds.c | 8 ++++---- gdb/python/py-symbol.c | 6 +++--- gdb/python/python.c | 2 +- gdb/record-btrace.c | 4 ++-- gdb/source.c | 2 +- gdb/symtab.c | 34 +++++++++++++++++----------------- gdb/symtab.h | 24 ++++++++++++------------ 20 files changed, 76 insertions(+), 76 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 96494538a60..bb9a16f8fe0 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3681,7 +3681,7 @@ See set/show multiple-symbol.")); struct symtab *symtab =3D NULL; =20 if (syms[i].symbol->is_objfile_owned ()) - symtab =3D symbol_symtab (syms[i].symbol); + symtab =3D syms[i].symbol->symtab (); =20 if (syms[i].symbol->line () !=3D 0 && symtab !=3D NULL) { @@ -4712,9 +4712,9 @@ cache_symbol (const char *name, domain_enum domain, s= truct symbol *sym, 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) !=3D block - && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector = (), + && BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (), STATIC_BLOCK) !=3D block) return; =20 diff --git a/gdb/btrace.c b/gdb/btrace.c index b195b59a7c3..c4f0d4911ab 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -102,7 +102,7 @@ ftrace_print_filename (const struct btrace_function *bf= un) sym =3D bfun->sym; =20 if (sym !=3D NULL) - filename =3D symtab_to_filename_for_display (symbol_symtab (sym)); + filename =3D symtab_to_filename_for_display (sym->symtab ()); else filename =3D ""; =20 @@ -210,8 +210,8 @@ ftrace_function_switched (const struct btrace_function = *bfun, return 1; =20 /* Check the location of those functions, as well. */ - bfname =3D symtab_to_fullname (symbol_symtab (sym)); - fname =3D symtab_to_fullname (symbol_symtab (fun)); + bfname =3D symtab_to_fullname (sym->symtab ()); + fname =3D symtab_to_fullname (fun->symtab ()); if (filename_cmp (fname, bfname) !=3D 0) return 1; } diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 628903d674f..927074b7669 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1006,15 +1006,15 @@ buildsym_compunit::end_compunit_symtab_with_blockve= ctor /* Inlined functions may have symbols not in the global or static symbol lists. */ if (BLOCK_FUNCTION (block) !=3D NULL) - if (symbol_symtab (BLOCK_FUNCTION (block)) =3D=3D NULL) - symbol_set_symtab (BLOCK_FUNCTION (block), symtab); + if (BLOCK_FUNCTION (block)->symtab () =3D=3D NULL) + BLOCK_FUNCTION (block)->set_symtab (symtab); =20 /* 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) =3D=3D NULL) - symbol_set_symtab (sym, symtab); + if (sym->symtab () =3D=3D NULL) + sym->set_symtab (symtab); } } =20 @@ -1114,8 +1114,8 @@ set_missing_symtab (struct pending *pending_list, { for (i =3D 0; i < pending->nsyms; ++i) { - if (symbol_symtab (pending->symbol[i]) =3D=3D NULL) - symbol_set_symtab (pending->symbol[i], cu->primary_filetab ()); + if (pending->symbol[i]->symtab () =3D=3D NULL) + pending->symbol[i]->set_symtab (cu->primary_filetab ()); } } } diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbol= s.c index 642c0be5db3..d49ecdab92f 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -57,7 +57,7 @@ convert_one_symbol (compile_c_instance *context, int is_local) { gcc_type sym_type; - const char *filename =3D symbol_symtab (sym.symbol)->filename; + const char *filename =3D sym.symbol->symtab ()->filename; unsigned short line =3D sym.symbol->line (); =20 context->error_symbol_once (sym.symbol); diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplu= s-symbols.c index 7ad9ea91132..95d43507c30 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -48,7 +48,7 @@ convert_one_symbol (compile_cplus_instance *instance, { /* Squash compiler warning. */ gcc_type sym_type =3D 0; - const char *filename =3D symbol_symtab (sym.symbol)->filename; + const char *filename =3D sym.symbol->symtab ()->filename; unsigned short line =3D sym.symbol->line (); =20 instance->error_symbol_once (sym.symbol); diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-= types.c index cea30304aa2..ab65e47f49d 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -625,7 +625,7 @@ compile_cplus_convert_struct_or_union_members we can do but ignore this member. */ continue; } - const char *filename =3D symbol_symtab (sym.symbol)->filename; + const char *filename =3D sym.symbol->symtab ()->filename; unsigned int line =3D sym.symbol->line (); =20 physaddr =3D sym.symbol->value_address (); @@ -764,7 +764,7 @@ compile_cplus_convert_struct_or_union_methods (compile_= cplus_instance *instance, continue; } =20 - const char *filename =3D symbol_symtab (sym.symbol)->filename; + const char *filename =3D sym.symbol->symtab ()->filename; unsigned int line =3D sym.symbol->line (); CORE_ADDR address =3D BLOCK_START (sym.symbol->value_block ()); const char *kind; diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object= -load.c index 7da02c07f9b..2303381b49a 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -421,7 +421,7 @@ get_out_value_type (struct symbol *func_sym, struct obj= file *objfile, lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION, symbol_name_match_type::SEARCH_NAME); =20 - bv =3D symbol_symtab (func_sym)->compunit ()->blockvector (); + bv =3D func_sym->symtab ()->compunit ()->blockvector (); nblocks =3D BLOCKVECTOR_NBLOCKS (bv); =20 gdb_ptr_type_sym =3D NULL; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index b7b372fcd73..bb72e0e4791 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7810,9 +7810,9 @@ fixup_go_packaging (struct dwarf2_cu *cu) struct objfile *objfile =3D cu->per_objfile->objfile; if (strcmp (package_name.get (), this_package_name.get ()) !=3D 0) complaint (_("Symtab %s has objects from two different Go packages: = %s and %s"), - (symbol_symtab (sym) !=3D NULL + (sym->symtab () !=3D NULL ? symtab_to_filename_for_display - (symbol_symtab (sym)) + (sym->symtab ()) : objfile_name (objfile)), this_package_name.get (), package_name.get ()); } @@ -12081,7 +12081,7 @@ read_func_scope (struct die_info *die, struct dwarf= 2_cu *cu) 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 ()); } =20 /* In C++, we can have functions nested inside functions (e.g., when @@ -14977,7 +14977,7 @@ process_structure_scope (struct die_info *die, stru= ct dwarf2_cu *cu) { struct symtab *symtab; if (sym !=3D nullptr) - symtab =3D symbol_symtab (sym); + symtab =3D sym->symtab (); else if (cu->line_header !=3D nullptr) { /* Any related symtab will do. */ @@ -15001,7 +15001,7 @@ process_structure_scope (struct die_info *die, stru= ct dwarf2_cu *cu) other parts of gdb assume that symbols do, and this is reasonably true. */ for (int i =3D 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); } } } @@ -20667,7 +20667,7 @@ new_symbol (struct die_info *die, struct type *type= , struct dwarf2_cu *cu, if (fe =3D=3D NULL) complaint (_("file index out of range")); else - symbol_set_symtab (sym, fe->symtab); + sym->set_symtab (fe->symtab); } =20 switch (die->tag) diff --git a/gdb/frame.c b/gdb/frame.c index 2e574a2f009..5e3c02e2029 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2701,7 +2701,7 @@ find_frame_sal (frame_info *frame) symtab_and_line sal; if (sym->line () !=3D 0) { - sal.symtab =3D symbol_symtab (sym); + sal.symtab =3D sym->symtab (); sal.line =3D sym->line (); } else diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 9e89b0458af..55eac3cfff6 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -364,7 +364,7 @@ gdbscm_symbol_symtab (SCM self) =20 if (!symbol->is_objfile_owned ()) return SCM_BOOL_F; - return stscm_scm_from_symtab (symbol_symtab (symbol)); + return stscm_scm_from_symtab (symbol->symtab ()); } =20 /* (symbol-name ) -> string */ diff --git a/gdb/jit.c b/gdb/jit.c index ae679a1f043..f7e25e494d4 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -589,7 +589,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfil= e *objfile) /* 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); =20 diff --git a/gdb/linespec.c b/gdb/linespec.c index ba89bd09b56..61ad69dd882 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2188,7 +2188,7 @@ convert_linespec_to_sals (struct linespec_state *stat= e, linespec *ls) for (const auto &sym : ls->labels.label_symbols) { struct program_space *pspace - =3D symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace; + =3D sym.symbol->symtab ()->compunit ()->objfile ()->pspace; =20 if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) && maybe_add_address (state->addr_set, pspace, sal.pc)) @@ -2210,7 +2210,7 @@ convert_linespec_to_sals (struct linespec_state *stat= e, linespec *ls) for (const auto &sym : ls->function_symbols) { program_space *pspace - =3D symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace; + =3D sym.symbol->symtab ()->compunit ()->objfile ()->pspace; set_current_program_space (pspace); =20 /* Don't skip to the first line of the function if we @@ -3483,8 +3483,8 @@ compare_symbols (const block_symbol &a, const block_s= ymbol &b) { uintptr_t uia, uib; =20 - uia =3D (uintptr_t) symbol_symtab (a.symbol)->compunit ()->objfile ()->p= space; - uib =3D (uintptr_t) symbol_symtab (b.symbol)->compunit ()->objfile ()->p= space; + uia =3D (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace; + uib =3D (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace; =20 if (uia < uib) return true; @@ -3608,7 +3608,7 @@ find_method (struct linespec_state *self, =20 /* Program spaces that are executing startup should have been filtered out earlier. */ - pspace =3D symbol_symtab (sym)->compunit ()->objfile ()->pspace; + pspace =3D sym->symtab ()->compunit ()->objfile ()->pspace; gdb_assert (!pspace->executing_startup); set_current_program_space (pspace); t =3D check_typedef (sym->type ()); @@ -3619,7 +3619,7 @@ find_method (struct linespec_state *self, sure not to miss the last batch. */ if (ix =3D=3D sym_classes->size () - 1 || (pspace - !=3D (symbol_symtab (sym_classes->at (ix + 1).symbol) + !=3D (sym_classes->at (ix + 1).symbol->symtab () ->compunit ()->objfile ()->pspace))) { /* If we did not find a direct implementation anywhere in @@ -3985,7 +3985,7 @@ find_label_symbols (struct linespec_state *self, { fn_sym =3D elt.symbol; set_current_program_space - (symbol_symtab (fn_sym)->compunit ()->objfile ()->pspace); + (fn_sym->symtab ()->compunit ()->objfile ()->pspace); block =3D fn_sym->value_block (); =20 find_label_symbols_in_block (block, name, fn_sym, completion_mode, @@ -4380,7 +4380,7 @@ symbol_to_sal (struct symtab_and_line *result, if (sym->aclass () =3D=3D LOC_LABEL && sym->value_address () !=3D 0) { *result =3D {}; - result->symtab =3D symbol_symtab (sym); + result->symtab =3D sym->symtab (); result->symbol =3D sym; result->line =3D sym->line (); result->pc =3D sym->value_address (); @@ -4396,7 +4396,7 @@ symbol_to_sal (struct symtab_and_line *result, { /* We know its line number. */ *result =3D {}; - result->symtab =3D symbol_symtab (sym); + result->symtab =3D sym->symtab (); result->symbol =3D sym; result->line =3D sym->line (); result->pc =3D sym->value_address (); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 6dcac13d2c5..7083beb01ed 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4486,7 +4486,7 @@ mylookup_symbol (const char *name, const struct block= *block, 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); } =20 diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 60321f76796..56e9c3f3ce0 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -132,7 +132,7 @@ mi_symbol_info (enum search_domain kind, const char *na= me_regexp, /* As long as we have debug symbols... */ while (i < symbols.size () && symbols[i].msymbol.minsym =3D=3D nullp= tr) { - symtab *symtab =3D symbol_symtab (symbols[i].symbol); + symtab *symtab =3D symbols[i].symbol->symtab (); ui_out_emit_tuple symtab_tuple_emitter (uiout, nullptr); =20 uiout->field_string ("filename", @@ -144,7 +144,7 @@ mi_symbol_info (enum search_domain kind, const char *na= me_regexp, /* As long as we have debug symbols from this symtab... */ for (; (i < symbols.size () && symbols[i].msymbol.minsym =3D=3D nullptr - && symbol_symtab (symbols[i].symbol) =3D=3D symtab); + && symbols[i].symbol->symtab () =3D=3D symtab); ++i) { symbol_search &s =3D symbols[i]; @@ -256,7 +256,7 @@ output_module_symbols_in_single_module_and_file =20 /* The symbol for the first result, and the symtab in which it resides. = */ const symbol *first_result_symbol =3D iter->second.symbol; - symtab *first_symbtab =3D symbol_symtab (first_result_symbol); + symtab *first_symbtab =3D first_result_symbol->symtab (); =20 /* Formatted output. */ ui_out_emit_tuple current_file (uiout, nullptr); @@ -269,7 +269,7 @@ output_module_symbols_in_single_module_and_file we change module, or we change symtab. */ for (; (iter !=3D end && first_module_symbol =3D=3D iter->first.symbol - && first_symbtab =3D=3D symbol_symtab (iter->second.symbol)); + && first_symbtab =3D=3D iter->second.symbol->symtab ()); ++iter) output_debug_symbol (uiout, kind, iter->second.symbol, iter->second.block); diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 5d475504fe6..414a310da64 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -91,7 +91,7 @@ sympy_get_symtab (PyObject *self, void *closure) if (!symbol->is_objfile_owned ()) Py_RETURN_NONE; =20 - return symtab_to_symtab_object (symbol_symtab (symbol)); + return symtab_to_symtab_object (symbol->symtab ()); } =20 static PyObject * @@ -303,7 +303,7 @@ set_symbol (symbol_object *obj, struct symbol *symbol) obj->symbol =3D symbol; obj->prev =3D NULL; if (symbol->is_objfile_owned () - && symbol_symtab (symbol) !=3D NULL) + && symbol->symtab () !=3D NULL) { struct objfile *objfile =3D symbol->objfile (); =20 @@ -349,7 +349,7 @@ sympy_dealloc (PyObject *obj) sym_obj->prev->next =3D sym_obj->next; else if (sym_obj->symbol !=3D NULL && sym_obj->symbol->is_objfile_owned () - && symbol_symtab (sym_obj->symbol) !=3D NULL) + && sym_obj->symbol->symtab () !=3D NULL) { set_objfile_data (sym_obj->symbol->objfile (), sympy_objfile_data_key, sym_obj->next); diff --git a/gdb/python/python.c b/gdb/python/python.c index 7a9c8c1b66e..11aaa7ae778 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -831,7 +831,7 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject = *kw) =20 if (p.msymbol.minsym =3D=3D NULL) { - struct symtab *symtab =3D symbol_symtab (p.symbol); + struct symtab *symtab =3D p.symbol->symtab (); const char *fullname =3D symtab_to_fullname (symtab); =20 symbol_name =3D fullname; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 1d5f839385c..373d82b8b99 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1067,7 +1067,7 @@ btrace_compute_src_line_range (const struct btrace_fu= nction *bfun, if (sym =3D=3D NULL) goto out; =20 - symtab =3D symbol_symtab (sym); + symtab =3D sym->symtab (); =20 for (const btrace_insn &insn : bfun->insn) { @@ -1100,7 +1100,7 @@ btrace_call_history_src_line (struct ui_out *uiout, return; =20 uiout->field_string ("file", - symtab_to_filename_for_display (symbol_symtab (sym)), + symtab_to_filename_for_display (sym->symtab ()), file_name_style.style ()); =20 btrace_compute_src_line_range (bfun, &begin, &end); diff --git a/gdb/source.c b/gdb/source.c index 9d9ff4bbc3e..8691113c729 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -329,7 +329,7 @@ select_source_symtab (struct symtab *s) if (sal.symtab =3D=3D 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; diff --git a/gdb/symtab.c b/gdb/symtab.c index d5d3877d90e..6926d1559b2 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1803,7 +1803,7 @@ fixup_symbol_section (struct symbol *sym, struct objf= ile *objfile) =20 /* 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 ()); =20 if (objfile =3D=3D NULL) objfile =3D sym->objfile (); @@ -3940,7 +3940,7 @@ skip_prologue_sal (struct symtab_and_line *sal) 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 !=3D NULL - && symbol_symtab (sym)->compunit ()->locations_valid ()) + && sym->symtab ()->compunit ()->locations_valid ()) force_skip =3D 0; =20 saved_pc =3D pc; @@ -4020,7 +4020,7 @@ skip_prologue_sal (struct symtab_and_line *sal) is aligned. */ if (!force_skip && sym && start_sal.symtab =3D=3D NULL) { - pc =3D skip_prologue_using_lineinfo (pc, symbol_symtab (sym)); + pc =3D skip_prologue_using_lineinfo (pc, sym->symtab ()); /* Recalculate the line number. */ start_sal =3D find_pc_sect_line (pc, section, 0); } @@ -4052,7 +4052,7 @@ skip_prologue_sal (struct symtab_and_line *sal) && BLOCK_FUNCTION (function_block)->line () !=3D 0) { sal->line =3D BLOCK_FUNCTION (function_block)->line (); - sal->symtab =3D symbol_symtab (BLOCK_FUNCTION (function_block)); + sal->symtab =3D BLOCK_FUNCTION (function_block)->symtab (); } } =20 @@ -4692,8 +4692,8 @@ symbol_search::compare_search_syms (const symbol_sear= ch &sym_a, { int c; =20 - c =3D FILENAME_CMP (symbol_symtab (sym_a.symbol)->filename, - symbol_symtab (sym_b.symbol)->filename); + c =3D FILENAME_CMP (sym_a.symbol->symtab ()->filename, + sym_b.symbol->symtab ()->filename); if (c !=3D 0) return c; =20 @@ -4873,7 +4873,7 @@ global_symbol_searcher::add_matching_symbols =20 ALL_BLOCK_SYMBOLS (b, iter, sym) { - struct symtab *real_symtab =3D symbol_symtab (sym); + struct symtab *real_symtab =3D sym->symtab (); =20 QUIT; =20 @@ -5146,7 +5146,7 @@ print_symbol_info (enum search_domain kind, int block, const char *last) { scoped_switch_to_sym_language_if_auto l (sym); - struct symtab *s =3D symbol_symtab (sym); + struct symtab *s =3D sym->symtab (); =20 if (last !=3D NULL) { @@ -5266,7 +5266,7 @@ symtab_symbol_info (bool quiet, bool exclude_minsyms, p.block, last_filename); last_filename - =3D symtab_to_filename_for_display (symbol_symtab (p.symbol)); + =3D symtab_to_filename_for_display (p.symbol->symtab ()); } } } @@ -5486,7 +5486,7 @@ rbreak_command (const char *regexp, int from_tty) { if (p.msymbol.minsym =3D=3D NULL) { - struct symtab *symtab =3D symbol_symtab (p.symbol); + struct symtab *symtab =3D p.symbol->symtab (); const char *fullname =3D symtab_to_fullname (symtab); =20 string =3D string_printf ("%s:'%s'", fullname, @@ -6612,19 +6612,19 @@ symbol::arch () const /* See symtab.h. */ =20 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; } =20 /* See symtab.h. */ =20 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 =3D symtab; + gdb_assert (is_objfile_owned ()); + owner.symtab =3D symtab; } =20 /* See symtab.h. */ @@ -6870,7 +6870,7 @@ info_module_subcommand (bool quiet, const char *modul= e_regexp, print_symbol_info (FUNCTIONS_DOMAIN, q.symbol, q.block, last_filename); last_filename - =3D symtab_to_filename_for_display (symbol_symtab (q.symbol)); + =3D symtab_to_filename_for_display (q.symbol->symtab ()); } } =20 diff --git a/gdb/symtab.h b/gdb/symtab.h index a773fccf50f..40283350cbe 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1386,6 +1386,18 @@ struct symbol : public general_symbol_info, public a= llocate_on_obstack =20 struct gdbarch *arch () const; =20 + /* 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 */ =20 struct type *m_type =3D nullptr; @@ -1502,18 +1514,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 *); =20 -/* 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 *symta= b); - /* 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. */