From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 091C93858D1E; Thu, 28 Apr 2022 02:39:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 091C93858D1E 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 BLOCK_MULTIDICT macro X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: f135fe728e2d0a6168a8445a50a6d63547c4db2f X-Git-Newrev: 24d74bb5df30de096f0271d33ab4f17434cf2c49 Message-Id: <20220428023923.091C93858D1E@sourceware.org> Date: Thu, 28 Apr 2022 02:39:23 +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, 28 Apr 2022 02:39:23 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D24d74bb5df30= de096f0271d33ab4f17434cf2c49 commit 24d74bb5df30de096f0271d33ab4f17434cf2c49 Author: Simon Marchi Date: Fri Jan 28 16:18:09 2022 -0500 gdb: remove BLOCK_MULTIDICT macro =20 Replace with equivalent methods. =20 Change-Id: If9a239c511a664f2a59fecb6d1cd579881b23dc2 Diff: --- gdb/block.c | 12 ++++++------ gdb/block.h | 11 +++++++++-- gdb/buildsym.c | 24 ++++++++++++------------ gdb/jit.c | 8 ++++---- gdb/mdebugread.c | 6 +++--- gdb/objfiles.c | 2 +- gdb/symmisc.c | 4 ++-- 7 files changed, 37 insertions(+), 30 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 9c4ed260abb..5a6282bd1a9 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -545,7 +545,7 @@ block_iterator_step (struct block_iterator *iterator, i= nt first) =20 block =3D BLOCKVECTOR_BLOCK (cust->blockvector (), iterator->which); - sym =3D mdict_iterator_first (BLOCK_MULTIDICT (block), + sym =3D mdict_iterator_first (block->multidict (), &iterator->mdict_iter); } else @@ -571,7 +571,7 @@ block_iterator_first (const struct block *block, initialize_block_iterator (block, iterator); =20 if (iterator->which =3D=3D FIRST_LOCAL_BLOCK) - return mdict_iterator_first (block->multidict, &iterator->mdict_iter); + return mdict_iterator_first (block->multidict (), &iterator->mdict_ite= r); =20 return block_iterator_step (iterator, 1); } @@ -614,7 +614,7 @@ block_iter_match_step (struct block_iterator *iterator, =20 block =3D BLOCKVECTOR_BLOCK (cust->blockvector (), iterator->which); - sym =3D mdict_iter_match_first (BLOCK_MULTIDICT (block), name, + sym =3D mdict_iter_match_first (block->multidict (), name, &iterator->mdict_iter); } else @@ -641,7 +641,7 @@ block_iter_match_first (const struct block *block, initialize_block_iterator (block, iterator); =20 if (iterator->which =3D=3D FIRST_LOCAL_BLOCK) - return mdict_iter_match_first (block->multidict, name, + return mdict_iter_match_first (block->multidict (), name, &iterator->mdict_iter); =20 return block_iter_match_step (iterator, name, 1); @@ -779,8 +779,8 @@ block_lookup_symbol_primary (const struct block *block,= const char *name, || block->superblock ()->superblock () =3D=3D NULL); =20 other =3D NULL; - for (sym - =3D mdict_iter_match_first (block->multidict, lookup_name, &mdict_iter); + for (sym =3D mdict_iter_match_first (block->multidict (), lookup_name, + &mdict_iter); sym !=3D NULL; sym =3D mdict_iter_match_next (lookup_name, &mdict_iter)) { diff --git a/gdb/block.h b/gdb/block.h index a5f931e354e..d0ae2708095 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -122,6 +122,14 @@ struct block void set_superblock (const block *superblock) { m_superblock =3D superblock; } =20 + /* Return this block's multidict. */ + multidictionary *multidict () const + { return m_multidict; } + + /* Set this block's multidict. */ + void set_multidict (multidictionary *multidict) + { m_multidict =3D multidict; } + /* Addresses in the executable code that are in this block. */ =20 CORE_ADDR m_start; @@ -142,7 +150,7 @@ struct block =20 /* This is used to store the symbols in the block. */ =20 - struct multidictionary *multidict; + struct multidictionary *m_multidict; =20 /* Contains information about namespace-related info relevant to this bl= ock: using directives and the current namespace scope. */ @@ -170,7 +178,6 @@ struct global_block struct compunit_symtab *compunit_symtab; }; =20 -#define BLOCK_MULTIDICT(bl) (bl)->multidict #define BLOCK_NAMESPACE(bl) (bl)->namespace_info =20 /* Accessor for ranges field within block BL. */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 5c5fc207d6e..d0f00d49f91 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -217,20 +217,21 @@ buildsym_compunit::finish_block_internal =20 if (symbol) { - BLOCK_MULTIDICT (block) - =3D mdict_create_linear (&m_objfile->objfile_obstack, *listhead); + block->set_multidict + (mdict_create_linear (&m_objfile->objfile_obstack, *listhead)); } else { if (expandable) { - BLOCK_MULTIDICT (block) =3D mdict_create_hashed_expandable (m_language); - mdict_add_pending (BLOCK_MULTIDICT (block), *listhead); + block->set_multidict + (mdict_create_hashed_expandable (m_language)); + mdict_add_pending (block->multidict (), *listhead); } else { - BLOCK_MULTIDICT (block) =3D - mdict_create_hashed (&m_objfile->objfile_obstack, *listhead); + block->set_multidict + (mdict_create_hashed (&m_objfile->objfile_obstack, *listhead)); } } =20 @@ -256,7 +257,7 @@ buildsym_compunit::finish_block_internal =20 /* Here we want to directly access the dictionary, because we haven't fully initialized the block yet. */ - ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym) + ALL_DICT_SYMBOLS (block->multidict (), miter, sym) { if (sym->is_argument ()) nparams++; @@ -271,7 +272,7 @@ buildsym_compunit::finish_block_internal iparams =3D 0; /* Here we want to directly access the dictionary, because we haven't fully initialized the block yet. */ - ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym) + ALL_DICT_SYMBOLS (block->multidict (), miter, sym) { if (iparams =3D=3D nparams) break; @@ -1013,7 +1014,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvect= or /* 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) + ALL_DICT_SYMBOLS (block->multidict (), miter, sym) if (sym->symtab () =3D=3D NULL) sym->set_symtab (symtab); } @@ -1148,7 +1149,7 @@ buildsym_compunit::augment_type_symtab () to the primary symtab. */ set_missing_symtab (m_file_symbols, cust); =20 - mdict_add_pending (BLOCK_MULTIDICT (block), m_file_symbols); + mdict_add_pending (block->multidict (), m_file_symbols); } =20 if (m_global_symbols !=3D NULL) @@ -1159,8 +1160,7 @@ buildsym_compunit::augment_type_symtab () to the primary symtab. */ set_missing_symtab (m_global_symbols, cust); =20 - mdict_add_pending (BLOCK_MULTIDICT (block), - m_global_symbols); + mdict_add_pending (block->multidict (), m_global_symbols); } } =20 diff --git a/gdb/jit.c b/gdb/jit.c index 1283d2edc50..4ff180d4873 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -580,8 +580,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfil= e *objfile) TARGET_CHAR_BIT, "void"); =20 - BLOCK_MULTIDICT (new_block) - =3D mdict_create_linear (&objfile->objfile_obstack, NULL); + new_block->set_multidict + (mdict_create_linear (&objfile->objfile_obstack, NULL)); /* The address range. */ new_block->set_start (gdb_block_iter.begin); new_block->set_end (gdb_block_iter.end); @@ -618,8 +618,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfil= e *objfile) new_block =3D (i =3D=3D GLOBAL_BLOCK ? allocate_global_block (&objfile->objfile_obstack) : allocate_block (&objfile->objfile_obstack)); - BLOCK_MULTIDICT (new_block) - =3D mdict_create_linear (&objfile->objfile_obstack, NULL); + new_block->set_multidict + (mdict_create_linear (&objfile->objfile_obstack, NULL)); new_block->set_superblock (block_iter); block_iter =3D new_block; =20 diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ddf3cd58253..cd242967ab7 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4489,7 +4489,7 @@ static void add_symbol (struct symbol *s, struct symtab *symtab, struct block *b) { s->set_symtab (symtab); - mdict_add_symbol (BLOCK_MULTIDICT (b), s); + mdict_add_symbol (b->multidict (), s); } =20 /* Add a new block B to a symtab S. */ @@ -4733,9 +4733,9 @@ new_block (enum block_type type, enum language langua= ge) struct block *retval =3D XCNEW (struct block); =20 if (type =3D=3D FUNCTION_BLOCK) - BLOCK_MULTIDICT (retval) =3D mdict_create_linear_expandable (language); + retval->set_multidict (mdict_create_linear_expandable (language)); else - BLOCK_MULTIDICT (retval) =3D mdict_create_hashed_expandable (language); + retval->set_multidict (mdict_create_hashed_expandable (language)); =20 return retval; } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e664bcd2da9..a709d947da0 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -689,7 +689,7 @@ objfile_relocate1 (struct objfile *objfile, =20 /* We only want to iterate over the local symbols, not any symbols in included symtabs. */ - ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym) + ALL_DICT_SYMBOLS (b->multidict (), miter, sym) { relocate_one_symbol (sym, objfile, delta); } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index e49322c2a84..3699e82d0c4 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -294,7 +294,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *o= utfile) even if we're using a hashtable, but nothing else but this message wants it. */ gdb_printf (outfile, ", %d syms/buckets in ", - mdict_size (BLOCK_MULTIDICT (b))); + mdict_size (b->multidict ())); gdb_puts (paddress (gdbarch, b->start ()), outfile); gdb_printf (outfile, ".."); gdb_puts (paddress (gdbarch, b->end ()), outfile); @@ -312,7 +312,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *o= utfile) /* Now print each symbol in this block (in no particular order, if we're using a hashtable). Note that we only want this block, not any blocks from included symtabs. */ - ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym) + ALL_DICT_SYMBOLS (b->multidict (), miter, sym) { try {