gdb: remove symtab::blockvector
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. Change-Id: Ibd062cd7926112a60d52899dff9224591cbdeebf
This commit is contained in:
parent
e473032828
commit
44281e6c08
14 changed files with 33 additions and 36 deletions
|
@ -1369,7 +1369,8 @@ block_lookup (const struct block *context, const char *raw_name)
|
||||||
symtab = NULL;
|
symtab = NULL;
|
||||||
|
|
||||||
if (symtab != NULL)
|
if (symtab != NULL)
|
||||||
result = BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK);
|
result = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
||||||
|
STATIC_BLOCK);
|
||||||
else if (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK)
|
else if (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
|
|
|
@ -4709,9 +4709,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
|
the symbol is local or not, we check the block where we found it
|
||||||
against the global and static blocks of its associated symtab. */
|
against the global and static blocks of its associated symtab. */
|
||||||
if (sym
|
if (sym
|
||||||
&& BLOCKVECTOR_BLOCK (symbol_symtab (sym)->blockvector (),
|
&& BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector (),
|
||||||
GLOBAL_BLOCK) != block
|
GLOBAL_BLOCK) != block
|
||||||
&& BLOCKVECTOR_BLOCK (symbol_symtab (sym)->blockvector (),
|
&& BLOCKVECTOR_BLOCK (symbol_symtab (sym)->compunit ()->blockvector (),
|
||||||
STATIC_BLOCK) != block)
|
STATIC_BLOCK) != block)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -3109,8 +3109,9 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
symtab = lookup_symtab (copy.c_str ());
|
symtab = lookup_symtab (copy.c_str ());
|
||||||
if (symtab)
|
if (symtab)
|
||||||
{
|
{
|
||||||
yylval.bval = BLOCKVECTOR_BLOCK (symtab->blockvector (),
|
yylval.bval
|
||||||
STATIC_BLOCK);
|
= BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
||||||
|
STATIC_BLOCK);
|
||||||
return FILENAME;
|
return FILENAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1483,7 +1483,7 @@ patch_opaque_types (struct symtab *s)
|
||||||
struct symbol *real_sym;
|
struct symbol *real_sym;
|
||||||
|
|
||||||
/* Go through the per-file symbols only. */
|
/* Go through the per-file symbols only. */
|
||||||
b = BLOCKVECTOR_BLOCK (s->blockvector (), STATIC_BLOCK);
|
b = BLOCKVECTOR_BLOCK (s->compunit ()->blockvector (), STATIC_BLOCK);
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, real_sym)
|
ALL_BLOCK_SYMBOLS (b, iter, real_sym)
|
||||||
{
|
{
|
||||||
/* Find completed typedefs to use to fix opaque ones.
|
/* Find completed typedefs to use to fix opaque ones.
|
||||||
|
|
|
@ -421,7 +421,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
|
||||||
lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
|
lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
|
||||||
symbol_name_match_type::SEARCH_NAME);
|
symbol_name_match_type::SEARCH_NAME);
|
||||||
|
|
||||||
bv = func_sym->owner.symtab->blockvector ();
|
bv = func_sym->owner.symtab->compunit ()->blockvector ();
|
||||||
nblocks = BLOCKVECTOR_NBLOCKS (bv);
|
nblocks = BLOCKVECTOR_NBLOCKS (bv);
|
||||||
|
|
||||||
gdb_ptr_type_sym = NULL;
|
gdb_ptr_type_sym = NULL;
|
||||||
|
|
|
@ -484,7 +484,7 @@ get_expr_block_and_pc (CORE_ADDR *pc)
|
||||||
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
||||||
|
|
||||||
if (cursal.symtab)
|
if (cursal.symtab)
|
||||||
block = BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (),
|
block = BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (),
|
||||||
STATIC_BLOCK);
|
STATIC_BLOCK);
|
||||||
if (block != NULL)
|
if (block != NULL)
|
||||||
*pc = BLOCK_ENTRY_PC (block);
|
*pc = BLOCK_ENTRY_PC (block);
|
||||||
|
|
|
@ -363,7 +363,7 @@ gdbscm_symtab_global_block (SCM self)
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
|
|
||||||
blockvector = symtab->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
||||||
|
|
||||||
return bkscm_scm_from_block (block, symtab->objfile ());
|
return bkscm_scm_from_block (block, symtab->objfile ());
|
||||||
|
@ -381,7 +381,7 @@ gdbscm_symtab_static_block (SCM self)
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
|
|
||||||
blockvector = symtab->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
||||||
|
|
||||||
return bkscm_scm_from_block (block, symtab->objfile ());
|
return bkscm_scm_from_block (block, symtab->objfile ());
|
||||||
|
|
|
@ -1188,12 +1188,11 @@ iterate_over_all_matching_symtabs
|
||||||
{
|
{
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
int i;
|
int i;
|
||||||
|
const blockvector *bv = symtab->compunit ()->blockvector ();
|
||||||
|
|
||||||
for (i = FIRST_LOCAL_BLOCK;
|
for (i = FIRST_LOCAL_BLOCK; i < BLOCKVECTOR_NBLOCKS (bv); i++)
|
||||||
i < BLOCKVECTOR_NBLOCKS (symtab->blockvector ());
|
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
block = BLOCKVECTOR_BLOCK (symtab->blockvector (), i);
|
block = BLOCKVECTOR_BLOCK (bv, i);
|
||||||
state->language->iterate_over_symbols
|
state->language->iterate_over_symbols
|
||||||
(block, lookup_name, name_domain,
|
(block, lookup_name, name_domain,
|
||||||
[&] (block_symbol *bsym)
|
[&] (block_symbol *bsym)
|
||||||
|
@ -1232,7 +1231,8 @@ iterate_over_file_blocks
|
||||||
{
|
{
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
|
|
||||||
for (block = BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK);
|
for (block = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
||||||
|
STATIC_BLOCK);
|
||||||
block != NULL;
|
block != NULL;
|
||||||
block = BLOCK_SUPERBLOCK (block))
|
block = BLOCK_SUPERBLOCK (block))
|
||||||
current_language->iterate_over_symbols (block, name, domain, callback);
|
current_language->iterate_over_symbols (block, name, domain, callback);
|
||||||
|
|
|
@ -628,7 +628,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case stGlobal: /* External symbol, goes into global block. */
|
case stGlobal: /* External symbol, goes into global block. */
|
||||||
b = BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (),
|
b = BLOCKVECTOR_BLOCK (top_stack->cur_st->compunit ()->blockvector (),
|
||||||
GLOBAL_BLOCK);
|
GLOBAL_BLOCK);
|
||||||
s = new_symbol (name);
|
s = new_symbol (name);
|
||||||
SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value);
|
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)
|
if (sh->st == stProc)
|
||||||
{
|
{
|
||||||
const struct blockvector *bv
|
const struct blockvector *bv
|
||||||
= top_stack->cur_st->blockvector ();
|
= top_stack->cur_st->compunit ()->blockvector ();
|
||||||
|
|
||||||
/* The next test should normally be true, but provides a
|
/* The next test should normally be true, but provides a
|
||||||
hook for nested functions (which we don't want to make
|
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 */
|
/* Finished with procedure */
|
||||||
const struct blockvector *bv
|
const struct blockvector *bv
|
||||||
= top_stack->cur_st->blockvector ();
|
= top_stack->cur_st->compunit ()->blockvector ();
|
||||||
struct mdebug_extra_func_info *e;
|
struct mdebug_extra_func_info *e;
|
||||||
struct block *cblock = top_stack->cur_block;
|
struct block *cblock = top_stack->cur_block;
|
||||||
struct type *ftype = top_stack->cur_type;
|
struct type *ftype = top_stack->cur_type;
|
||||||
|
@ -4187,7 +4187,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
|
||||||
FIXME, Maybe quit once we have found the right number of ext's? */
|
FIXME, Maybe quit once we have found the right number of ext's? */
|
||||||
top_stack->cur_st = cust->primary_filetab ();
|
top_stack->cur_st = cust->primary_filetab ();
|
||||||
top_stack->cur_block
|
top_stack->cur_block
|
||||||
= BLOCKVECTOR_BLOCK (top_stack->cur_st->blockvector (),
|
= BLOCKVECTOR_BLOCK (top_stack->cur_st->compunit ()->blockvector (),
|
||||||
GLOBAL_BLOCK);
|
GLOBAL_BLOCK);
|
||||||
top_stack->blocktype = stFile;
|
top_stack->blocktype = stFile;
|
||||||
|
|
||||||
|
@ -4497,13 +4497,14 @@ add_block (struct block *b, struct symtab *s)
|
||||||
{
|
{
|
||||||
/* Cast away "const", but that's ok because we're building the
|
/* Cast away "const", but that's ok because we're building the
|
||||||
symtab and blockvector here. */
|
symtab and blockvector here. */
|
||||||
struct blockvector *bv = (struct blockvector *) s->blockvector ();
|
struct blockvector *bv
|
||||||
|
= (struct blockvector *) s->compunit ()->blockvector ();
|
||||||
|
|
||||||
bv = (struct blockvector *) xrealloc ((void *) bv,
|
bv = (struct blockvector *) xrealloc ((void *) bv,
|
||||||
(sizeof (struct blockvector)
|
(sizeof (struct blockvector)
|
||||||
+ BLOCKVECTOR_NBLOCKS (bv)
|
+ BLOCKVECTOR_NBLOCKS (bv)
|
||||||
* sizeof (bv->block)));
|
* sizeof (bv->block)));
|
||||||
if (bv != s->blockvector ())
|
if (bv != s->compunit ()->blockvector ())
|
||||||
s->compunit ()->set_blockvector (bv);
|
s->compunit ()->set_blockvector (bv);
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) = b;
|
BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) = b;
|
||||||
|
@ -4567,7 +4568,8 @@ sort_blocks (struct symtab *s)
|
||||||
{
|
{
|
||||||
/* We have to cast away const here, but this is ok because we're
|
/* We have to cast away const here, but this is ok because we're
|
||||||
constructing the blockvector in this code. */
|
constructing the blockvector in this code. */
|
||||||
struct blockvector *bv = (struct blockvector *) s->blockvector ();
|
struct blockvector *bv
|
||||||
|
= (struct blockvector *) s->compunit ()->blockvector ();
|
||||||
|
|
||||||
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
|
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -619,8 +619,9 @@ block : BLOCKNAME
|
||||||
struct symtab *tem =
|
struct symtab *tem =
|
||||||
lookup_symtab (copy.c_str ());
|
lookup_symtab (copy.c_str ());
|
||||||
if (tem)
|
if (tem)
|
||||||
$$ = BLOCKVECTOR_BLOCK (tem->blockvector (),
|
$$ = BLOCKVECTOR_BLOCK
|
||||||
STATIC_BLOCK);
|
(tem->compunit ()->blockvector (),
|
||||||
|
STATIC_BLOCK);
|
||||||
else
|
else
|
||||||
error (_("No file or function \"%s\"."),
|
error (_("No file or function \"%s\"."),
|
||||||
copy.c_str ());
|
copy.c_str ());
|
||||||
|
|
|
@ -465,7 +465,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||||
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
||||||
if (cursal.symtab)
|
if (cursal.symtab)
|
||||||
expression_context_block
|
expression_context_block
|
||||||
= BLOCKVECTOR_BLOCK (cursal.symtab->blockvector (),
|
= BLOCKVECTOR_BLOCK (cursal.symtab->compunit ()->blockvector (),
|
||||||
STATIC_BLOCK);
|
STATIC_BLOCK);
|
||||||
if (expression_context_block)
|
if (expression_context_block)
|
||||||
expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
|
expression_context_pc = BLOCK_ENTRY_PC (expression_context_block);
|
||||||
|
|
|
@ -181,7 +181,7 @@ stpy_global_block (PyObject *self, PyObject *args)
|
||||||
|
|
||||||
STPY_REQUIRE_VALID (self, symtab);
|
STPY_REQUIRE_VALID (self, symtab);
|
||||||
|
|
||||||
blockvector = symtab->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
||||||
return block_to_block_object (block, symtab->objfile ());
|
return block_to_block_object (block, symtab->objfile ());
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ stpy_static_block (PyObject *self, PyObject *args)
|
||||||
|
|
||||||
STPY_REQUIRE_VALID (self, symtab);
|
STPY_REQUIRE_VALID (self, symtab);
|
||||||
|
|
||||||
blockvector = symtab->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
||||||
return block_to_block_object (block, symtab->objfile ());
|
return block_to_block_object (block, symtab->objfile ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||||
if (is_main_symtab_of_compunit_symtab (symtab))
|
if (is_main_symtab_of_compunit_symtab (symtab))
|
||||||
{
|
{
|
||||||
gdb_printf (outfile, "\nBlockvector:\n\n");
|
gdb_printf (outfile, "\nBlockvector:\n\n");
|
||||||
bv = symtab->blockvector ();
|
bv = symtab->compunit ()->blockvector ();
|
||||||
len = BLOCKVECTOR_NBLOCKS (bv);
|
len = BLOCKVECTOR_NBLOCKS (bv);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1476,8 +1476,6 @@ struct symtab
|
||||||
m_language = language;
|
m_language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct blockvector *blockvector () const;
|
|
||||||
|
|
||||||
struct objfile *objfile () const;
|
struct objfile *objfile () const;
|
||||||
|
|
||||||
program_space *pspace () const;
|
program_space *pspace () const;
|
||||||
|
@ -1755,12 +1753,6 @@ struct compunit_symtab
|
||||||
|
|
||||||
using compunit_symtab_range = next_range<compunit_symtab>;
|
using compunit_symtab_range = next_range<compunit_symtab>;
|
||||||
|
|
||||||
inline const struct blockvector *
|
|
||||||
symtab::blockvector () const
|
|
||||||
{
|
|
||||||
return this->compunit ()->blockvector ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline struct objfile *
|
inline struct objfile *
|
||||||
symtab::objfile () const
|
symtab::objfile () const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue