gdb: remove SYMTAB_BLOCKVECTOR macro
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 21 Nov 2021 02:32:41 +0000 (21:32 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Sun, 6 Feb 2022 21:03:46 +0000 (16:03 -0500)
Remove the macro, replace with an equivalent method.

Change-Id: Id6fe2a79c04bcd6c69ccaefb7a69bc06a476288c

14 files changed:
gdb/ada-exp.y
gdb/ada-lang.c
gdb/c-exp.y
gdb/coffread.c
gdb/compile/compile-object-load.c
gdb/compile/compile.c
gdb/guile/scm-symtab.c
gdb/linespec.c
gdb/mdebugread.c
gdb/p-exp.y
gdb/parse.c
gdb/python/py-symtab.c
gdb/symmisc.c
gdb/symtab.h

index 16ba336df4aa45b93c8368fa812e4b3e991978dd..0d5083f513bf058839b38e97b898c8ad65b9e5ba 100644 (file)
@@ -1302,7 +1302,7 @@ block_lookup (const struct block *context, const char *raw_name)
     symtab = NULL;
 
   if (symtab != NULL)
-    result = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK);
+    result = BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK);
   else if (syms.empty () || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK)
     {
       if (context == NULL)
index 2bb64ae03bde1395701c6deefac6669aef3e3eea..f3b8442b5508f21b1ebe6869a9a80dd3db1cfdcc 100644 (file)
@@ -4384,9 +4384,9 @@ cache_symbol (const char *name, domain_enum domain, struct 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 (SYMTAB_BLOCKVECTOR (symbol_symtab (sym)),
+      && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->blockvector (),
                            GLOBAL_BLOCK) != block
-      && BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symbol_symtab (sym)),
+      && BLOCKVECTOR_BLOCK (symbol_symtab (sym)->blockvector (),
                            STATIC_BLOCK) != block)
     return;
 
index 464ed44a2297c8e2ad164a11a8b604efe63907c1..4b58ce0410021dfa73838cb50f5872e321ea03ac 100644 (file)
@@ -3109,7 +3109,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
          symtab = lookup_symtab (copy.c_str ());
          if (symtab)
            {
-             yylval.bval = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab),
+             yylval.bval = BLOCKVECTOR_BLOCK (symtab->blockvector (),
                                               STATIC_BLOCK);
              return FILENAME;
            }
index f6bf973e9f75381a2dc0910a751bb5d560d25524..af0699bed2d55472b3086c0048af6613ea8284c3 100644 (file)
@@ -1483,7 +1483,7 @@ patch_opaque_types (struct symtab *s)
   struct symbol *real_sym;
 
   /* Go through the per-file symbols only.  */
-  b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
+  b = BLOCKVECTOR_BLOCK (s->blockvector (), STATIC_BLOCK);
   ALL_BLOCK_SYMBOLS (b, iter, real_sym)
     {
       /* Find completed typedefs to use to fix opaque ones.
index 336e8d3d4351e08059ecbb840863fd06aef684d0..692e9906fd7d2a577cad12bc89f3292a823be5c5 100644 (file)
@@ -421,7 +421,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
   lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
                                 symbol_name_match_type::SEARCH_NAME);
 
-  bv = SYMTAB_BLOCKVECTOR (func_sym->owner.symtab);
+  bv = func_sym->owner.symtab->blockvector ();
   nblocks = BLOCKVECTOR_NBLOCKS (bv);
 
   gdb_ptr_type_sym = NULL;
index 7bd6ac817b8f3b503d87190f26bfb6b4cf2b3353..5ab4e48f30619b6daa0a4c243b2f31c204232fc0 100644 (file)
@@ -484,7 +484,7 @@ get_expr_block_and_pc (CORE_ADDR *pc)
       struct symtab_and_line cursal = get_current_source_symtab_and_line ();
 
       if (cursal.symtab)
-       block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (cursal.symtab),
+       block = BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (),
                                   STATIC_BLOCK);
       if (block != NULL)
        *pc = BLOCK_ENTRY_PC (block);
index 40410f7b9fbd6ba90dba654ad9b6a2120cce59f3..e2a90e580166469cc4a4b0c89ef6e058493e2f8c 100644 (file)
@@ -363,7 +363,7 @@ gdbscm_symtab_global_block (SCM self)
   const struct blockvector *blockvector;
   const struct block *block;
 
-  blockvector = SYMTAB_BLOCKVECTOR (symtab);
+  blockvector = symtab->blockvector ();
   block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
 
   return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
@@ -381,7 +381,7 @@ gdbscm_symtab_static_block (SCM self)
   const struct blockvector *blockvector;
   const struct block *block;
 
-  blockvector = SYMTAB_BLOCKVECTOR (symtab);
+  blockvector = symtab->blockvector ();
   block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
 
   return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
index acbcc0916cc57e6bf4f23be10111761b6dcf5d0e..31e3b36d3aa911377a42202ea26fbd0fd6660925 100644 (file)
@@ -1190,10 +1190,10 @@ iterate_over_all_matching_symtabs
                  int i;
 
                  for (i = FIRST_LOCAL_BLOCK;
-                      i < BLOCKVECTOR_NBLOCKS (SYMTAB_BLOCKVECTOR (symtab));
+                      i < BLOCKVECTOR_NBLOCKS (symtab->blockvector ());
                       i++)
                    {
-                     block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), i);
+                     block = BLOCKVECTOR_BLOCK (symtab->blockvector (), i);
                      state->language->iterate_over_symbols
                        (block, lookup_name, name_domain,
                         [&] (block_symbol *bsym)
@@ -1232,7 +1232,7 @@ iterate_over_file_blocks
 {
   const struct block *block;
 
-  for (block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK);
+  for (block = BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK);
        block != NULL;
        block = BLOCK_SUPERBLOCK (block))
     current_language->iterate_over_symbols (block, name, domain, callback);
index 192fafa5d02ab5ff61d002fff620a4cbf049811d..b98ac8fe7996acbaa1b54d4a429c02264140e3b2 100644 (file)
@@ -628,7 +628,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       break;
 
     case stGlobal:             /* External symbol, goes into global block.  */
-      b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
+      b = BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (),
                             GLOBAL_BLOCK);
       s = 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 == stProc)
        {
          const struct blockvector *bv
-           = SYMTAB_BLOCKVECTOR (top_stack->cur_st);
+           = top_stack->cur_st->blockvector ();
 
          /* 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
-           = SYMTAB_BLOCKVECTOR (top_stack->cur_st);
+           = top_stack->cur_st->blockvector ();
          struct mdebug_extra_func_info *e;
          struct block *cblock = top_stack->cur_block;
          struct type *ftype = top_stack->cur_type;
@@ -4186,7 +4186,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
         FIXME, Maybe quit once we have found the right number of ext's?  */
       top_stack->cur_st = cust->primary_filetab ();
       top_stack->cur_block
-       = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
+       = BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (),
                             GLOBAL_BLOCK);
       top_stack->blocktype = stFile;
 
@@ -4496,13 +4496,13 @@ 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 = (struct blockvector *) SYMTAB_BLOCKVECTOR (s);
+  struct blockvector *bv = (struct blockvector *) s->blockvector ();
 
   bv = (struct blockvector *) xrealloc ((void *) bv,
                                        (sizeof (struct blockvector)
                                         + BLOCKVECTOR_NBLOCKS (bv)
                                         * sizeof (bv->block)));
-  if (bv != SYMTAB_BLOCKVECTOR (s))
+  if (bv != s->blockvector ())
     s->compunit ()->set_blockvector (bv);
 
   BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) = b;
@@ -4566,7 +4566,7 @@ 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 = (struct blockvector *) SYMTAB_BLOCKVECTOR (s);
+  struct blockvector *bv = (struct blockvector *) s->blockvector ();
 
   if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
     {
index 62b0a3be5a9a61e9a6d9c3f27cb343efcbcc2a3c..10738d073f6ec61e61039c4c4b76d2e648ca4801 100644 (file)
@@ -619,7 +619,7 @@ block       :       BLOCKNAME
                              struct symtab *tem =
                                  lookup_symtab (copy.c_str ());
                              if (tem)
-                               $$ = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (tem),
+                               $$ = BLOCKVECTOR_BLOCK (tem->blockvector (),
                                                        STATIC_BLOCK);
                              else
                                error (_("No file or function \"%s\"."),
index a6595e3da069cf162d8114f49de2351b78c4ac0d..23f0e66bf275fe5699cfc5a673735e369a732e89 100644 (file)
@@ -462,7 +462,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
       struct symtab_and_line cursal = get_current_source_symtab_and_line ();
       if (cursal.symtab)
        expression_context_block
-         = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (cursal.symtab),
+         = BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (),
                               STATIC_BLOCK);
       if (expression_context_block)
        expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
index b5d102c1b7f1e85e2ced82606ea06a7d8b4f5bcc..33657f1e6e435249f1ddcb3adc6cb0ca7c0eba8a 100644 (file)
@@ -181,7 +181,7 @@ stpy_global_block (PyObject *self, PyObject *args)
 
   STPY_REQUIRE_VALID (self, symtab);
 
-  blockvector = SYMTAB_BLOCKVECTOR (symtab);
+  blockvector = symtab->blockvector ();
   block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
   return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
 }
@@ -197,7 +197,7 @@ stpy_static_block (PyObject *self, PyObject *args)
 
   STPY_REQUIRE_VALID (self, symtab);
 
-  blockvector = SYMTAB_BLOCKVECTOR (symtab);
+  blockvector = symtab->blockvector ();
   block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
   return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
 }
index 24b2915a3acc03107b236210061b9208b3c0875a..3f5f840fbe7fdd895b8b44a308b6abdacdc86bdc 100644 (file)
@@ -278,7 +278,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
   if (is_main_symtab_of_compunit_symtab (symtab))
     {
       fprintf_filtered (outfile, "\nBlockvector:\n\n");
-      bv = SYMTAB_BLOCKVECTOR (symtab);
+      bv = symtab->blockvector ();
       len = BLOCKVECTOR_NBLOCKS (bv);
       for (i = 0; i < len; i++)
        {
index 28309695bca361890f23ba872020b1d0d537b6d0..1935113336a8977ba9b6a91dc03184eb6451a430 100644 (file)
@@ -1403,6 +1403,8 @@ struct symtab
     m_language = language;
   }
 
+  const struct blockvector *blockvector () const;
+
   /* Unordered chain of all filetabs in the compunit,  with the exception
      that the "main" source file is the first entry in the list.  */
 
@@ -1435,8 +1437,6 @@ struct symtab
 
 using symtab_range = next_range<symtab>;
 
-#define SYMTAB_BLOCKVECTOR(symtab) \
-  (symtab->compunit ()->blockvector ())
 #define SYMTAB_OBJFILE(symtab) \
   (symtab->compunit ()->objfile ())
 #define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
@@ -1683,6 +1683,12 @@ struct compunit_symtab
 
 using compunit_symtab_range = next_range<compunit_symtab>;
 
+inline const struct blockvector *
+symtab::blockvector () const
+{
+  return this->compunit ()->blockvector ();
+}
+
 /* Return the language of CUST.  */
 
 extern enum language compunit_language (const struct compunit_symtab *cust);