From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 9DD7D3858D28; Thu, 7 Apr 2022 17:08:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DD7D3858D28 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove symtab::blockvector X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: e4730328287f755eb313c3762d83d389462cde15 X-Git-Newrev: 44281e6c08cae11d4e116d87ea34ad391d58ae91 Message-Id: <20220407170813.9DD7D3858D28@sourceware.org> Date: Thu, 7 Apr 2022 17:08:13 +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: Thu, 07 Apr 2022 17:08:13 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D44281e6c08ca= e11d4e116d87ea34ad391d58ae91 commit 44281e6c08cae11d4e116d87ea34ad391d58ae91 Author: Simon Marchi Date: Wed Apr 6 10:42:03 2022 -0400 gdb: remove symtab::blockvector =20 symtab::blockvector is a wrapper around compunit_symtab::blockvector. It is a bit misleadnig, as it gives the impression that a symtab has a blockvector. Remove it, change all users to fetch the blockvector through the compunit instead. =20 Change-Id: Ibd062cd7926112a60d52899dff9224591cbdeebf Diff: --- gdb/ada-exp.y | 3 ++- gdb/ada-lang.c | 4 ++-- gdb/c-exp.y | 5 +++-- gdb/coffread.c | 2 +- gdb/compile/compile-object-load.c | 2 +- gdb/compile/compile.c | 2 +- gdb/guile/scm-symtab.c | 4 ++-- gdb/linespec.c | 10 +++++----- gdb/mdebugread.c | 16 +++++++++------- gdb/p-exp.y | 5 +++-- gdb/parse.c | 2 +- gdb/python/py-symtab.c | 4 ++-- gdb/symmisc.c | 2 +- gdb/symtab.h | 8 -------- 14 files changed, 33 insertions(+), 36 deletions(-) diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 5099e40f677..a2755d7501e 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1369,7 +1369,8 @@ block_lookup (const struct block *context, const char= *raw_name) symtab =3D NULL; =20 if (symtab !=3D NULL) - result =3D BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK); + result =3D BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (), + STATIC_BLOCK); else if (syms.empty () || syms[0].symbol->aclass () !=3D LOC_BLOCK) { if (context =3D=3D NULL) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f80ec5b1e04..3a1624e9d26 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4709,9 +4709,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)->blockvector (), + && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector = (), GLOBAL_BLOCK) !=3D block - && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->blockvector (), + && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector = (), STATIC_BLOCK) !=3D block) return; =20 diff --git a/gdb/c-exp.y b/gdb/c-exp.y index de29d2f70e2..4ed661e587b 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -3109,8 +3109,9 @@ classify_name (struct parser_state *par_state, const = struct block *block, symtab =3D lookup_symtab (copy.c_str ()); if (symtab) { - yylval.bval =3D BLOCKVECTOR_BLOCK (symtab->blockvector (), - STATIC_BLOCK); + yylval.bval + =3D BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (), + STATIC_BLOCK); return FILENAME; } } diff --git a/gdb/coffread.c b/gdb/coffread.c index 1de2a79a0d9..253ba9c095f 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1483,7 +1483,7 @@ patch_opaque_types (struct symtab *s) struct symbol *real_sym; =20 /* Go through the per-file symbols only. */ - b =3D BLOCKVECTOR_BLOCK (s->blockvector (), STATIC_BLOCK); + b =3D BLOCKVECTOR_BLOCK (s->compunit ()->blockvector (), STATIC_BLOCK); ALL_BLOCK_SYMBOLS (b, iter, real_sym) { /* Find completed typedefs to use to fix opaque ones. diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object= -load.c index b62a841d82a..7364a4ae8b2 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 func_sym->owner.symtab->blockvector (); + bv =3D func_sym->owner.symtab->compunit ()->blockvector (); nblocks =3D BLOCKVECTOR_NBLOCKS (bv); =20 gdb_ptr_type_sym =3D NULL; diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 7983d1df1b5..2a1f0f1bd6b 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -484,7 +484,7 @@ get_expr_block_and_pc (CORE_ADDR *pc) struct symtab_and_line cursal =3D get_current_source_symtab_and_line= (); =20 if (cursal.symtab) - block =3D BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (), + block =3D BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (), STATIC_BLOCK); if (block !=3D NULL) *pc =3D BLOCK_ENTRY_PC (block); diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c index d1a5056aac8..386ccf56956 100644 --- a/gdb/guile/scm-symtab.c +++ b/gdb/guile/scm-symtab.c @@ -363,7 +363,7 @@ gdbscm_symtab_global_block (SCM self) const struct blockvector *blockvector; const struct block *block; =20 - blockvector =3D symtab->blockvector (); + blockvector =3D symtab->compunit ()->blockvector (); block =3D BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK); =20 return bkscm_scm_from_block (block, symtab->objfile ()); @@ -381,7 +381,7 @@ gdbscm_symtab_static_block (SCM self) const struct blockvector *blockvector; const struct block *block; =20 - blockvector =3D symtab->blockvector (); + blockvector =3D symtab->compunit ()->blockvector (); block =3D BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK); =20 return bkscm_scm_from_block (block, symtab->objfile ()); diff --git a/gdb/linespec.c b/gdb/linespec.c index 4d41f74ab2f..5a6b620b33b 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1188,12 +1188,11 @@ iterate_over_all_matching_symtabs { const struct block *block; int i; + const blockvector *bv =3D symtab->compunit ()->blockvector (); =20 - for (i =3D FIRST_LOCAL_BLOCK; - i < BLOCKVECTOR_NBLOCKS (symtab->blockvector ()); - i++) + for (i =3D FIRST_LOCAL_BLOCK; i < BLOCKVECTOR_NBLOCKS (bv); i++) { - block =3D BLOCKVECTOR_BLOCK (symtab->blockvector (), i); + block =3D BLOCKVECTOR_BLOCK (bv, i); state->language->iterate_over_symbols (block, lookup_name, name_domain, [&] (block_symbol *bsym) @@ -1232,7 +1231,8 @@ iterate_over_file_blocks { const struct block *block; =20 - for (block =3D BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK); + for (block =3D BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (), + STATIC_BLOCK); block !=3D NULL; block =3D BLOCK_SUPERBLOCK (block)) current_language->iterate_over_symbols (block, name, domain, callback); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index eae80648e4c..67630b79332 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -628,7 +628,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh= , int bigend, break; =20 case stGlobal: /* External symbol, goes into global block. */ - b =3D BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (), + b =3D BLOCKVECTOR_BLOCK (top_stack->cur_st->compunit ()->blockvector= (), GLOBAL_BLOCK); s =3D new_symbol (name); SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); @@ -771,7 +771,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh= , int bigend, if (sh->st =3D=3D stProc) { const struct blockvector *bv - =3D top_stack->cur_st->blockvector (); + =3D top_stack->cur_st->compunit ()->blockvector (); =20 /* The next test should normally be true, but provides a hook for nested functions (which we don't want to make @@ -1144,7 +1144,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_= sh, int bigend, { /* Finished with procedure */ const struct blockvector *bv - =3D top_stack->cur_st->blockvector (); + =3D top_stack->cur_st->compunit ()->blockvector (); struct mdebug_extra_func_info *e; struct block *cblock =3D top_stack->cur_block; struct type *ftype =3D top_stack->cur_type; @@ -4187,7 +4187,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct ob= jfile *objfile) FIXME, Maybe quit once we have found the right number of ext's? */ top_stack->cur_st =3D cust->primary_filetab (); top_stack->cur_block - =3D BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (), + =3D BLOCKVECTOR_BLOCK (top_stack->cur_st->compunit ()->blockvector (), GLOBAL_BLOCK); top_stack->blocktype =3D stFile; =20 @@ -4497,13 +4497,14 @@ add_block (struct block *b, struct symtab *s) { /* Cast away "const", but that's ok because we're building the symtab and blockvector here. */ - struct blockvector *bv =3D (struct blockvector *) s->blockvector (); + struct blockvector *bv + =3D (struct blockvector *) s->compunit ()->blockvector (); =20 bv =3D (struct blockvector *) xrealloc ((void *) bv, (sizeof (struct blockvector) + BLOCKVECTOR_NBLOCKS (bv) * sizeof (bv->block))); - if (bv !=3D s->blockvector ()) + if (bv !=3D s->compunit ()->blockvector ()) s->compunit ()->set_blockvector (bv); =20 BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) =3D b; @@ -4567,7 +4568,8 @@ sort_blocks (struct symtab *s) { /* We have to cast away const here, but this is ok because we're constructing the blockvector in this code. */ - struct blockvector *bv =3D (struct blockvector *) s->blockvector (); + struct blockvector *bv + =3D (struct blockvector *) s->compunit ()->blockvector (); =20 if (BLOCKVECTOR_NBLOCKS (bv) <=3D FIRST_LOCAL_BLOCK) { diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 024a335453a..adceff28636 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -619,8 +619,9 @@ block : BLOCKNAME struct symtab *tem =3D lookup_symtab (copy.c_str ()); if (tem) - $$ =3D BLOCKVECTOR_BLOCK (tem->blockvector (), - STATIC_BLOCK); + $$ =3D BLOCKVECTOR_BLOCK + (tem->compunit ()->blockvector (), + STATIC_BLOCK); else error (_("No file or function \"%s\"."), copy.c_str ()); diff --git a/gdb/parse.c b/gdb/parse.c index 7637e5799f7..6d1b3d9d923 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -465,7 +465,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR= pc, struct symtab_and_line cursal =3D get_current_source_symtab_and_line= (); if (cursal.symtab) expression_context_block - =3D BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (), + =3D BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (), STATIC_BLOCK); if (expression_context_block) expression_context_pc =3D BLOCK_ENTRY_PC (expression_context_block); diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index bfda599dddd..7ce4292c325 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -181,7 +181,7 @@ stpy_global_block (PyObject *self, PyObject *args) =20 STPY_REQUIRE_VALID (self, symtab); =20 - blockvector =3D symtab->blockvector (); + blockvector =3D symtab->compunit ()->blockvector (); block =3D BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK); return block_to_block_object (block, symtab->objfile ()); } @@ -197,7 +197,7 @@ stpy_static_block (PyObject *self, PyObject *args) =20 STPY_REQUIRE_VALID (self, symtab); =20 - blockvector =3D symtab->blockvector (); + blockvector =3D symtab->compunit ()->blockvector (); block =3D BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK); return block_to_block_object (block, symtab->objfile ()); } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 5d8d641fa27..1843eb87d05 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -278,7 +278,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *o= utfile) if (is_main_symtab_of_compunit_symtab (symtab)) { gdb_printf (outfile, "\nBlockvector:\n\n"); - bv =3D symtab->blockvector (); + bv =3D symtab->compunit ()->blockvector (); len =3D BLOCKVECTOR_NBLOCKS (bv); for (i =3D 0; i < len; i++) { diff --git a/gdb/symtab.h b/gdb/symtab.h index 567c0fcce7c..8852590857e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1476,8 +1476,6 @@ struct symtab m_language =3D language; } =20 - const struct blockvector *blockvector () const; - struct objfile *objfile () const; =20 program_space *pspace () const; @@ -1755,12 +1753,6 @@ struct compunit_symtab =20 using compunit_symtab_range =3D next_range; =20 -inline const struct blockvector * -symtab::blockvector () const -{ - return this->compunit ()->blockvector (); -} - inline struct objfile * symtab::objfile () const {