gdb: remove BLOCKVECTOR_BLOCK and BLOCKVECTOR_NBLOCKS macros
Replace with calls to blockvector::blocks, and the appropriate method call on the returned array_view. Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
This commit is contained in:
parent
6395b62847
commit
63d609debb
25 changed files with 194 additions and 161 deletions
|
@ -1369,8 +1369,7 @@ block_lookup (const struct block *context, const char *raw_name)
|
||||||
symtab = NULL;
|
symtab = NULL;
|
||||||
|
|
||||||
if (symtab != NULL)
|
if (symtab != NULL)
|
||||||
result = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
result = symtab->compunit ()->blockvector ()->static_block ();
|
||||||
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)
|
||||||
|
|
|
@ -4711,12 +4711,13 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
|
||||||
for that symbol depends on the context. To determine whether
|
for that symbol depends on the context. To determine whether
|
||||||
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 != nullptr)
|
||||||
&& BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
|
{
|
||||||
GLOBAL_BLOCK) != block
|
const blockvector &bv = *sym->symtab ()->compunit ()->blockvector ();
|
||||||
&& BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
|
|
||||||
STATIC_BLOCK) != block)
|
if (bv.global_block () != block && bv.static_block () != block)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
h = msymbol_hash (name) % HASH_SIZE;
|
h = msymbol_hash (name) % HASH_SIZE;
|
||||||
e = XOBNEW (&sym_cache->cache_space, cache_entry);
|
e = XOBNEW (&sym_cache->cache_space, cache_entry);
|
||||||
|
@ -5563,7 +5564,7 @@ map_matching_symbols (struct objfile *objfile,
|
||||||
for (compunit_symtab *symtab : objfile->compunits ())
|
for (compunit_symtab *symtab : objfile->compunits ())
|
||||||
{
|
{
|
||||||
const struct block *block
|
const struct block *block
|
||||||
= BLOCKVECTOR_BLOCK (symtab->blockvector (), block_kind);
|
= symtab->blockvector ()->block (block_kind);
|
||||||
if (!iterate_over_symbols_terminated (block, lookup_name,
|
if (!iterate_over_symbols_terminated (block, lookup_name,
|
||||||
domain, data))
|
domain, data))
|
||||||
break;
|
break;
|
||||||
|
@ -5592,7 +5593,7 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
|
||||||
for (compunit_symtab *cu : objfile->compunits ())
|
for (compunit_symtab *cu : objfile->compunits ())
|
||||||
{
|
{
|
||||||
const struct block *global_block
|
const struct block *global_block
|
||||||
= BLOCKVECTOR_BLOCK (cu->blockvector (), GLOBAL_BLOCK);
|
= cu->blockvector ()->global_block ();
|
||||||
|
|
||||||
if (ada_add_block_renamings (result, global_block, lookup_name,
|
if (ada_add_block_renamings (result, global_block, lookup_name,
|
||||||
domain))
|
domain))
|
||||||
|
@ -13099,7 +13100,7 @@ ada_add_global_exceptions (compiled_regex *preg,
|
||||||
|
|
||||||
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
||||||
{
|
{
|
||||||
const struct block *b = BLOCKVECTOR_BLOCK (bv, i);
|
const struct block *b = bv->block (i);
|
||||||
struct block_iterator iter;
|
struct block_iterator iter;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
|
@ -13687,7 +13688,7 @@ public:
|
||||||
for (compunit_symtab *s : objfile->compunits ())
|
for (compunit_symtab *s : objfile->compunits ())
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
b = BLOCKVECTOR_BLOCK (s->blockvector (), GLOBAL_BLOCK);
|
b = s->blockvector ()->global_block ();
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||||
{
|
{
|
||||||
if (completion_skip_symbol (mode, sym))
|
if (completion_skip_symbol (mode, sym))
|
||||||
|
@ -13706,7 +13707,7 @@ public:
|
||||||
for (compunit_symtab *s : objfile->compunits ())
|
for (compunit_symtab *s : objfile->compunits ())
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
b = BLOCKVECTOR_BLOCK (s->blockvector (), STATIC_BLOCK);
|
b = s->blockvector ()->static_block ();
|
||||||
/* Don't do this block twice. */
|
/* Don't do this block twice. */
|
||||||
if (b == surrounding_static_block)
|
if (b == surrounding_static_block)
|
||||||
continue;
|
continue;
|
||||||
|
|
14
gdb/block.c
14
gdb/block.c
|
@ -147,14 +147,14 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
|
||||||
They both have the same START,END values.
|
They both have the same START,END values.
|
||||||
Historically this code would choose STATIC_BLOCK over GLOBAL_BLOCK but the
|
Historically this code would choose STATIC_BLOCK over GLOBAL_BLOCK but the
|
||||||
fact that this choice was made was subtle, now we make it explicit. */
|
fact that this choice was made was subtle, now we make it explicit. */
|
||||||
gdb_assert (BLOCKVECTOR_NBLOCKS (bl) >= 2);
|
gdb_assert (bl->blocks ().size () >= 2);
|
||||||
bot = STATIC_BLOCK;
|
bot = STATIC_BLOCK;
|
||||||
top = BLOCKVECTOR_NBLOCKS (bl);
|
top = bl->blocks ().size ();
|
||||||
|
|
||||||
while (top - bot > 1)
|
while (top - bot > 1)
|
||||||
{
|
{
|
||||||
half = (top - bot + 1) >> 1;
|
half = (top - bot + 1) >> 1;
|
||||||
b = BLOCKVECTOR_BLOCK (bl, bot + half);
|
b = bl->block (bot + half);
|
||||||
if (b->start () <= pc)
|
if (b->start () <= pc)
|
||||||
bot += half;
|
bot += half;
|
||||||
else
|
else
|
||||||
|
@ -165,7 +165,7 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
|
||||||
|
|
||||||
while (bot >= STATIC_BLOCK)
|
while (bot >= STATIC_BLOCK)
|
||||||
{
|
{
|
||||||
b = BLOCKVECTOR_BLOCK (bl, bot);
|
b = bl->block (bot);
|
||||||
if (!(b->start () <= pc))
|
if (!(b->start () <= pc))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (b->end () > pc)
|
if (b->end () > pc)
|
||||||
|
@ -543,8 +543,7 @@ block_iterator_step (struct block_iterator *iterator, int first)
|
||||||
if (cust == NULL)
|
if (cust == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
block = BLOCKVECTOR_BLOCK (cust->blockvector (),
|
block = cust->blockvector ()->block (iterator->which);
|
||||||
iterator->which);
|
|
||||||
sym = mdict_iterator_first (block->multidict (),
|
sym = mdict_iterator_first (block->multidict (),
|
||||||
&iterator->mdict_iter);
|
&iterator->mdict_iter);
|
||||||
}
|
}
|
||||||
|
@ -612,8 +611,7 @@ block_iter_match_step (struct block_iterator *iterator,
|
||||||
if (cust == NULL)
|
if (cust == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
block = BLOCKVECTOR_BLOCK (cust->blockvector (),
|
block = cust->blockvector ()->block (iterator->which);
|
||||||
iterator->which);
|
|
||||||
sym = mdict_iter_match_first (block->multidict (), name,
|
sym = mdict_iter_match_first (block->multidict (), name,
|
||||||
&iterator->mdict_iter);
|
&iterator->mdict_iter);
|
||||||
}
|
}
|
||||||
|
|
63
gdb/block.h
63
gdb/block.h
|
@ -244,18 +244,71 @@ struct global_block
|
||||||
|
|
||||||
struct blockvector
|
struct blockvector
|
||||||
{
|
{
|
||||||
/* Number of blocks in the list. */
|
/* Return a view on the blocks of this blockvector. */
|
||||||
int nblocks;
|
gdb::array_view<struct block *> blocks ()
|
||||||
|
{
|
||||||
|
return gdb::array_view<struct block *> (m_blocks, m_num_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Const version of the above. */
|
||||||
|
gdb::array_view<const struct block *const> blocks () const
|
||||||
|
{
|
||||||
|
const struct block **blocks = (const struct block **) m_blocks;
|
||||||
|
return gdb::array_view<const struct block *const> (blocks, m_num_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the block at index I. */
|
||||||
|
struct block *block (size_t i)
|
||||||
|
{ return this->blocks ()[i]; }
|
||||||
|
|
||||||
|
/* Const version of the above. */
|
||||||
|
const struct block *block (size_t i) const
|
||||||
|
{ return this->blocks ()[i]; }
|
||||||
|
|
||||||
|
/* Set the block at index I. */
|
||||||
|
void set_block (int i, struct block *block)
|
||||||
|
{ m_blocks[i] = block; }
|
||||||
|
|
||||||
|
/* Set the number of blocks of this blockvector.
|
||||||
|
|
||||||
|
The storage of blocks is done using a flexible array member, so the number
|
||||||
|
of blocks set here must agree with what was effectively allocated. */
|
||||||
|
void set_num_blocks (int num_blocks)
|
||||||
|
{ m_num_blocks = num_blocks; }
|
||||||
|
|
||||||
|
/* Return the number of blocks in this blockvector. */
|
||||||
|
int num_blocks () const
|
||||||
|
{ return m_num_blocks; }
|
||||||
|
|
||||||
|
/* Return the global block of this blockvector. */
|
||||||
|
struct block *global_block ()
|
||||||
|
{ return this->block (GLOBAL_BLOCK); }
|
||||||
|
|
||||||
|
/* Const version of the above. */
|
||||||
|
const struct block *global_block () const
|
||||||
|
{ return this->block (GLOBAL_BLOCK); }
|
||||||
|
|
||||||
|
/* Return the static block of this blockvector. */
|
||||||
|
struct block *static_block ()
|
||||||
|
{ return this->block (STATIC_BLOCK); }
|
||||||
|
|
||||||
|
/* Const version of the above. */
|
||||||
|
const struct block *static_block () const
|
||||||
|
{ return this->block (STATIC_BLOCK); }
|
||||||
|
|
||||||
/* An address map mapping addresses to blocks in this blockvector.
|
/* An address map mapping addresses to blocks in this blockvector.
|
||||||
This pointer is zero if the blocks' start and end addresses are
|
This pointer is zero if the blocks' start and end addresses are
|
||||||
enough. */
|
enough. */
|
||||||
struct addrmap *map;
|
struct addrmap *map;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Number of blocks in the list. */
|
||||||
|
int m_num_blocks;
|
||||||
|
|
||||||
/* The blocks themselves. */
|
/* The blocks themselves. */
|
||||||
struct block *block[1];
|
struct block *m_blocks[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
|
|
||||||
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
|
|
||||||
#define BLOCKVECTOR_MAP(blocklist) ((blocklist)->map)
|
#define BLOCKVECTOR_MAP(blocklist) ((blocklist)->map)
|
||||||
|
|
||||||
/* Return the objfile of BLOCK, which must be non-NULL. */
|
/* Return the objfile of BLOCK, which must be non-NULL. */
|
||||||
|
|
|
@ -448,11 +448,9 @@ buildsym_compunit::make_blockvector ()
|
||||||
each block into the list after its subblocks in order to make
|
each block into the list after its subblocks in order to make
|
||||||
sure this is true. */
|
sure this is true. */
|
||||||
|
|
||||||
BLOCKVECTOR_NBLOCKS (blockvector) = i;
|
blockvector->set_num_blocks (i);
|
||||||
for (next = m_pending_blocks; next; next = next->next)
|
for (next = m_pending_blocks; next; next = next->next)
|
||||||
{
|
blockvector->set_block (--i, next->block);
|
||||||
BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
|
|
||||||
}
|
|
||||||
|
|
||||||
free_pending_blocks ();
|
free_pending_blocks ();
|
||||||
|
|
||||||
|
@ -470,15 +468,15 @@ buildsym_compunit::make_blockvector ()
|
||||||
Note: Remember that the first two blocks are the global and static
|
Note: Remember that the first two blocks are the global and static
|
||||||
blocks. We could special case that fact and begin checking at block 2.
|
blocks. We could special case that fact and begin checking at block 2.
|
||||||
To avoid making that assumption we do not. */
|
To avoid making that assumption we do not. */
|
||||||
if (BLOCKVECTOR_NBLOCKS (blockvector) > 1)
|
if (blockvector->num_blocks () > 1)
|
||||||
{
|
{
|
||||||
for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
|
for (i = 1; i < blockvector->num_blocks (); i++)
|
||||||
{
|
{
|
||||||
if (BLOCKVECTOR_BLOCK(blockvector, i - 1)->start ()
|
if (blockvector->block (i - 1)->start ()
|
||||||
> BLOCKVECTOR_BLOCK(blockvector, i)->start ())
|
> blockvector->block (i)->start ())
|
||||||
{
|
{
|
||||||
CORE_ADDR start
|
CORE_ADDR start
|
||||||
= BLOCKVECTOR_BLOCK(blockvector, i)->start ();
|
= blockvector->block (i)->start ();
|
||||||
|
|
||||||
complaint (_("block at %s out of order"),
|
complaint (_("block at %s out of order"),
|
||||||
hex_string ((LONGEST) start));
|
hex_string ((LONGEST) start));
|
||||||
|
@ -983,7 +981,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
|
||||||
|
|
||||||
cu->set_blockvector (blockvector);
|
cu->set_blockvector (blockvector);
|
||||||
{
|
{
|
||||||
struct block *b = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
struct block *b = blockvector->global_block ();
|
||||||
|
|
||||||
set_block_compunit_symtab (b, cu);
|
set_block_compunit_symtab (b, cu);
|
||||||
}
|
}
|
||||||
|
@ -999,9 +997,9 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
|
||||||
/* The main source file's symtab. */
|
/* The main source file's symtab. */
|
||||||
struct symtab *symtab = cu->primary_filetab ();
|
struct symtab *symtab = cu->primary_filetab ();
|
||||||
|
|
||||||
for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
|
for (block_i = 0; block_i < blockvector->num_blocks (); block_i++)
|
||||||
{
|
{
|
||||||
struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
|
struct block *block = blockvector->block (block_i);
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct mdict_iterator miter;
|
struct mdict_iterator miter;
|
||||||
|
|
||||||
|
@ -1130,7 +1128,7 @@ void
|
||||||
buildsym_compunit::augment_type_symtab ()
|
buildsym_compunit::augment_type_symtab ()
|
||||||
{
|
{
|
||||||
struct compunit_symtab *cust = m_compunit_symtab;
|
struct compunit_symtab *cust = m_compunit_symtab;
|
||||||
const struct blockvector *blockvector = cust->blockvector ();
|
struct blockvector *blockvector = cust->blockvector ();
|
||||||
|
|
||||||
if (!m_context_stack.empty ())
|
if (!m_context_stack.empty ())
|
||||||
complaint (_("Context stack not empty in augment_type_symtab"));
|
complaint (_("Context stack not empty in augment_type_symtab"));
|
||||||
|
@ -1143,7 +1141,7 @@ buildsym_compunit::augment_type_symtab ()
|
||||||
|
|
||||||
if (m_file_symbols != NULL)
|
if (m_file_symbols != NULL)
|
||||||
{
|
{
|
||||||
struct block *block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
struct block *block = blockvector->static_block ();
|
||||||
|
|
||||||
/* First mark any symbols without a specified symtab as belonging
|
/* First mark any symbols without a specified symtab as belonging
|
||||||
to the primary symtab. */
|
to the primary symtab. */
|
||||||
|
@ -1154,7 +1152,7 @@ buildsym_compunit::augment_type_symtab ()
|
||||||
|
|
||||||
if (m_global_symbols != NULL)
|
if (m_global_symbols != NULL)
|
||||||
{
|
{
|
||||||
struct block *block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
struct block *block = blockvector->global_block ();
|
||||||
|
|
||||||
/* First mark any symbols without a specified symtab as belonging
|
/* First mark any symbols without a specified symtab as belonging
|
||||||
to the primary symtab. */
|
to the primary symtab. */
|
||||||
|
|
|
@ -3110,8 +3110,8 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
if (symtab)
|
if (symtab)
|
||||||
{
|
{
|
||||||
yylval.bval
|
yylval.bval
|
||||||
= BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
= symtab->compunit ()->blockvector ()->static_block ();
|
||||||
STATIC_BLOCK);
|
|
||||||
return FILENAME;
|
return FILENAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1476,12 +1476,11 @@ patch_type (struct type *type, struct type *real_type)
|
||||||
static void
|
static void
|
||||||
patch_opaque_types (struct symtab *s)
|
patch_opaque_types (struct symtab *s)
|
||||||
{
|
{
|
||||||
const struct block *b;
|
|
||||||
struct block_iterator iter;
|
struct block_iterator iter;
|
||||||
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->compunit ()->blockvector (), STATIC_BLOCK);
|
const struct block *b = 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.
|
||||||
|
|
|
@ -422,7 +422,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
|
||||||
symbol_name_match_type::SEARCH_NAME);
|
symbol_name_match_type::SEARCH_NAME);
|
||||||
|
|
||||||
bv = func_sym->symtab ()->compunit ()->blockvector ();
|
bv = func_sym->symtab ()->compunit ()->blockvector ();
|
||||||
nblocks = BLOCKVECTOR_NBLOCKS (bv);
|
nblocks = bv->num_blocks ();
|
||||||
|
|
||||||
gdb_ptr_type_sym = NULL;
|
gdb_ptr_type_sym = NULL;
|
||||||
for (block_loop = 0; block_loop < nblocks; block_loop++)
|
for (block_loop = 0; block_loop < nblocks; block_loop++)
|
||||||
|
@ -430,7 +430,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
|
||||||
struct symbol *function = NULL;
|
struct symbol *function = NULL;
|
||||||
const struct block *function_block;
|
const struct block *function_block;
|
||||||
|
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_loop);
|
block = bv->block (block_loop);
|
||||||
if (block->function () != NULL)
|
if (block->function () != NULL)
|
||||||
continue;
|
continue;
|
||||||
gdb_val_sym = block_lookup_symbol (block,
|
gdb_val_sym = block_lookup_symbol (block,
|
||||||
|
@ -441,8 +441,8 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
function_block = block;
|
function_block = block;
|
||||||
while (function_block != BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)
|
while (function_block != bv->static_block ()
|
||||||
&& function_block != BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
|
&& function_block != bv->global_block ())
|
||||||
{
|
{
|
||||||
function_block = function_block->superblock ();
|
function_block = function_block->superblock ();
|
||||||
function = function_block->function ();
|
function = function_block->function ();
|
||||||
|
@ -450,8 +450,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (function != NULL
|
if (function != NULL
|
||||||
&& (function_block->superblock ()
|
&& function_block->superblock () == bv->static_block ()
|
||||||
== BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))
|
|
||||||
&& symbol_matches_search_name (function, func_matcher))
|
&& symbol_matches_search_name (function, func_matcher))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,8 +484,8 @@ 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->compunit ()->blockvector (),
|
block = cursal.symtab->compunit ()->blockvector ()->static_block ();
|
||||||
STATIC_BLOCK);
|
|
||||||
if (block != NULL)
|
if (block != NULL)
|
||||||
*pc = block->entry_pc ();
|
*pc = block->entry_pc ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1440,7 +1440,7 @@ static void
|
||||||
add_symbol_overload_list_qualified (const char *func_name,
|
add_symbol_overload_list_qualified (const char *func_name,
|
||||||
std::vector<symbol *> *overload_list)
|
std::vector<symbol *> *overload_list)
|
||||||
{
|
{
|
||||||
const struct block *b, *surrounding_static_block = 0;
|
const struct block *surrounding_static_block = 0;
|
||||||
|
|
||||||
/* Look through the partial symtabs for all symbols which begin by
|
/* Look through the partial symtabs for all symbols which begin by
|
||||||
matching FUNC_NAME. Make sure we read that symbol table in. */
|
matching FUNC_NAME. Make sure we read that symbol table in. */
|
||||||
|
@ -1451,7 +1451,9 @@ add_symbol_overload_list_qualified (const char *func_name,
|
||||||
/* Search upwards from currently selected frame (so that we can
|
/* Search upwards from currently selected frame (so that we can
|
||||||
complete on local vars. */
|
complete on local vars. */
|
||||||
|
|
||||||
for (b = get_selected_block (0); b != NULL; b = b->superblock ())
|
for (const block *b = get_selected_block (0);
|
||||||
|
b != nullptr;
|
||||||
|
b = b->superblock ())
|
||||||
add_symbol_overload_list_block (func_name, b, overload_list);
|
add_symbol_overload_list_block (func_name, b, overload_list);
|
||||||
|
|
||||||
surrounding_static_block = block_static_block (get_selected_block (0));
|
surrounding_static_block = block_static_block (get_selected_block (0));
|
||||||
|
@ -1464,7 +1466,7 @@ add_symbol_overload_list_qualified (const char *func_name,
|
||||||
for (compunit_symtab *cust : objfile->compunits ())
|
for (compunit_symtab *cust : objfile->compunits ())
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
b = BLOCKVECTOR_BLOCK (cust->blockvector (), GLOBAL_BLOCK);
|
const block *b = cust->blockvector ()->global_block ();
|
||||||
add_symbol_overload_list_block (func_name, b, overload_list);
|
add_symbol_overload_list_block (func_name, b, overload_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1474,10 +1476,12 @@ add_symbol_overload_list_qualified (const char *func_name,
|
||||||
for (compunit_symtab *cust : objfile->compunits ())
|
for (compunit_symtab *cust : objfile->compunits ())
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
b = BLOCKVECTOR_BLOCK (cust->blockvector (), STATIC_BLOCK);
|
const block *b = cust->blockvector ()->static_block ();
|
||||||
|
|
||||||
/* Don't do this block twice. */
|
/* Don't do this block twice. */
|
||||||
if (b == surrounding_static_block)
|
if (b == surrounding_static_block)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
add_symbol_overload_list_block (func_name, b, overload_list);
|
add_symbol_overload_list_block (func_name, b, overload_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,10 +361,9 @@ gdbscm_symtab_global_block (SCM self)
|
||||||
= stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
= stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
||||||
const struct symtab *symtab = st_smob->symtab;
|
const struct symtab *symtab = st_smob->symtab;
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
const struct block *block;
|
|
||||||
|
|
||||||
blockvector = symtab->compunit ()->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
const struct block *block = blockvector->global_block ();
|
||||||
|
|
||||||
return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
|
return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
|
||||||
}
|
}
|
||||||
|
@ -379,10 +378,9 @@ gdbscm_symtab_static_block (SCM self)
|
||||||
= stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
= stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
|
||||||
const struct symtab *symtab = st_smob->symtab;
|
const struct symtab *symtab = st_smob->symtab;
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
const struct block *block;
|
|
||||||
|
|
||||||
blockvector = symtab->compunit ()->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
const struct block *block = blockvector->static_block ();
|
||||||
|
|
||||||
return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
|
return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,7 +565,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||||
BLOCKVECTOR_MAP (bv) = NULL;
|
BLOCKVECTOR_MAP (bv) = NULL;
|
||||||
begin = stab->blocks.front ().begin;
|
begin = stab->blocks.front ().begin;
|
||||||
end = stab->blocks.front ().end;
|
end = stab->blocks.front ().end;
|
||||||
BLOCKVECTOR_NBLOCKS (bv) = actual_nblocks;
|
bv->set_num_blocks (actual_nblocks);
|
||||||
|
|
||||||
/* First run over all the gdb_block objects, creating a real block
|
/* First run over all the gdb_block objects, creating a real block
|
||||||
object for each. Simultaneously, keep setting the real_block
|
object for each. Simultaneously, keep setting the real_block
|
||||||
|
@ -598,7 +598,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||||
|
|
||||||
new_block->set_function (block_name);
|
new_block->set_function (block_name);
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK (bv, block_idx) = new_block;
|
bv->set_block (block_idx, new_block);
|
||||||
if (begin > new_block->start ())
|
if (begin > new_block->start ())
|
||||||
begin = new_block->start ();
|
begin = new_block->start ();
|
||||||
if (end < new_block->end ())
|
if (end < new_block->end ())
|
||||||
|
@ -626,7 +626,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||||
new_block->set_start (begin);
|
new_block->set_start (begin);
|
||||||
new_block->set_end (end);
|
new_block->set_end (end);
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK (bv, i) = new_block;
|
bv->set_block (i, new_block);
|
||||||
|
|
||||||
if (i == GLOBAL_BLOCK)
|
if (i == GLOBAL_BLOCK)
|
||||||
set_block_compunit_symtab (new_block, cust);
|
set_block_compunit_symtab (new_block, cust);
|
||||||
|
@ -647,8 +647,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* And if not, we set a default parent block. */
|
/* And if not, we set a default parent block. */
|
||||||
gdb_block_iter.real_block->set_superblock
|
gdb_block_iter.real_block->set_superblock (bv->static_block ());
|
||||||
(BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1190,9 +1190,9 @@ iterate_over_all_matching_symtabs
|
||||||
int i;
|
int i;
|
||||||
const blockvector *bv = symtab->compunit ()->blockvector ();
|
const blockvector *bv = symtab->compunit ()->blockvector ();
|
||||||
|
|
||||||
for (i = FIRST_LOCAL_BLOCK; i < BLOCKVECTOR_NBLOCKS (bv); i++)
|
for (i = FIRST_LOCAL_BLOCK; i < bv->num_blocks (); i++)
|
||||||
{
|
{
|
||||||
block = BLOCKVECTOR_BLOCK (bv, i);
|
block = bv->block (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)
|
||||||
|
@ -1231,8 +1231,7 @@ iterate_over_file_blocks
|
||||||
{
|
{
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
|
|
||||||
for (block = BLOCKVECTOR_BLOCK (symtab->compunit ()->blockvector (),
|
for (block = symtab->compunit ()->blockvector ()->static_block ();
|
||||||
STATIC_BLOCK);
|
|
||||||
block != NULL;
|
block != NULL;
|
||||||
block = block->superblock ())
|
block = block->superblock ())
|
||||||
current_language->iterate_over_symbols (block, name, domain, callback);
|
current_language->iterate_over_symbols (block, name, domain, callback);
|
||||||
|
|
|
@ -943,7 +943,7 @@ count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr,
|
||||||
for (compunit_symtab *cu : o->compunits ())
|
for (compunit_symtab *cu : o->compunits ())
|
||||||
{
|
{
|
||||||
++nr_compunit_symtabs;
|
++nr_compunit_symtabs;
|
||||||
nr_blocks += BLOCKVECTOR_NBLOCKS (cu->blockvector ());
|
nr_blocks += cu->blockvector ()->num_blocks ();
|
||||||
nr_symtabs += std::distance (cu->filetabs ().begin (),
|
nr_symtabs += std::distance (cu->filetabs ().begin (),
|
||||||
cu->filetabs ().end ());
|
cu->filetabs ().end ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,8 +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->compunit ()->blockvector (),
|
b = top_stack->cur_st->compunit ()->blockvector ()->global_block ();
|
||||||
GLOBAL_BLOCK);
|
|
||||||
s = new_symbol (name);
|
s = new_symbol (name);
|
||||||
s->set_value_address (sh->value);
|
s->set_value_address (sh->value);
|
||||||
add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
|
add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
|
||||||
|
@ -770,19 +769,19 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
b = top_stack->cur_block;
|
b = top_stack->cur_block;
|
||||||
if (sh->st == stProc)
|
if (sh->st == stProc)
|
||||||
{
|
{
|
||||||
const struct blockvector *bv
|
struct blockvector *bv
|
||||||
= top_stack->cur_st->compunit ()->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
|
||||||
global). */
|
global). */
|
||||||
if (b == BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))
|
if (b == bv->static_block ())
|
||||||
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
b = bv->global_block ();
|
||||||
/* Irix 5 sometimes has duplicate names for the same
|
/* Irix 5 sometimes has duplicate names for the same
|
||||||
function. We want to add such names up at the global
|
function. We want to add such names up at the global
|
||||||
level, not as a nested function. */
|
level, not as a nested function. */
|
||||||
else if (sh->value == top_stack->procadr)
|
else if (sh->value == top_stack->procadr)
|
||||||
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
b = bv->global_block ();
|
||||||
}
|
}
|
||||||
add_symbol (s, top_stack->cur_st, b);
|
add_symbol (s, top_stack->cur_st, b);
|
||||||
|
|
||||||
|
@ -1144,12 +1143,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
top_stack->blocktype == stStaticProc))
|
top_stack->blocktype == stStaticProc))
|
||||||
{
|
{
|
||||||
/* Finished with procedure */
|
/* Finished with procedure */
|
||||||
const struct blockvector *bv
|
struct blockvector *bv
|
||||||
= top_stack->cur_st->compunit ()->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;
|
||||||
int i;
|
|
||||||
|
|
||||||
top_stack->cur_block->set_end
|
top_stack->cur_block->set_end
|
||||||
(top_stack->cur_block->end () + sh->value); /* size */
|
(top_stack->cur_block->end () + sh->value); /* size */
|
||||||
|
@ -1168,10 +1166,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
|
|
||||||
/* f77 emits proc-level with address bounds==[0,0],
|
/* f77 emits proc-level with address bounds==[0,0],
|
||||||
So look for such child blocks, and patch them. */
|
So look for such child blocks, and patch them. */
|
||||||
for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i++)
|
for (block *b_bad : bv->blocks ())
|
||||||
{
|
{
|
||||||
struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i);
|
|
||||||
|
|
||||||
if (b_bad->superblock () == cblock
|
if (b_bad->superblock () == cblock
|
||||||
&& b_bad->start () == top_stack->procadr
|
&& b_bad->start () == top_stack->procadr
|
||||||
&& b_bad->end () == top_stack->procadr)
|
&& b_bad->end () == top_stack->procadr)
|
||||||
|
@ -1967,8 +1963,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
|
||||||
#else
|
#else
|
||||||
s = mylookup_symbol
|
s = mylookup_symbol
|
||||||
(sh_name,
|
(sh_name,
|
||||||
BLOCKVECTOR_BLOCK (search_symtab->blockvector (),
|
search_symtab->blockvector ()->static_block (),
|
||||||
STATIC_BLOCK),
|
|
||||||
VAR_DOMAIN,
|
VAR_DOMAIN,
|
||||||
LOC_BLOCK);
|
LOC_BLOCK);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4099,8 +4094,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
|
||||||
|
|
||||||
push_parse_stack ();
|
push_parse_stack ();
|
||||||
top_stack->cur_st = cust->primary_filetab ();
|
top_stack->cur_st = cust->primary_filetab ();
|
||||||
top_stack->cur_block
|
top_stack->cur_block = cust->blockvector ()->static_block ();
|
||||||
= BLOCKVECTOR_BLOCK (cust->blockvector (), STATIC_BLOCK);
|
|
||||||
top_stack->cur_block->set_start (pst->text_low (objfile));
|
top_stack->cur_block->set_start (pst->text_low (objfile));
|
||||||
top_stack->cur_block->set_end (0);
|
top_stack->cur_block->set_end (0);
|
||||||
top_stack->blocktype = stFile;
|
top_stack->blocktype = stFile;
|
||||||
|
@ -4189,8 +4183,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->compunit ()->blockvector (),
|
= top_stack->cur_st->compunit ()->blockvector ()->global_block ();
|
||||||
GLOBAL_BLOCK);
|
|
||||||
top_stack->blocktype = stFile;
|
top_stack->blocktype = stFile;
|
||||||
|
|
||||||
ext_ptr = PST_PRIVATE (pst)->extern_tab;
|
ext_ptr = PST_PRIVATE (pst)->extern_tab;
|
||||||
|
@ -4504,12 +4497,13 @@ add_block (struct block *b, struct symtab *s)
|
||||||
|
|
||||||
bv = (struct blockvector *) xrealloc ((void *) bv,
|
bv = (struct blockvector *) xrealloc ((void *) bv,
|
||||||
(sizeof (struct blockvector)
|
(sizeof (struct blockvector)
|
||||||
+ BLOCKVECTOR_NBLOCKS (bv)
|
+ bv->num_blocks ()
|
||||||
* sizeof (bv->block)));
|
* sizeof (struct block)));
|
||||||
if (bv != s->compunit ()->blockvector ())
|
if (bv != s->compunit ()->blockvector ())
|
||||||
s->compunit ()->set_blockvector (bv);
|
s->compunit ()->set_blockvector (bv);
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)++) = b;
|
bv->set_block (bv->num_blocks (), b);
|
||||||
|
bv->set_num_blocks (bv->num_blocks () + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
|
/* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
|
||||||
|
@ -4573,13 +4567,13 @@ sort_blocks (struct symtab *s)
|
||||||
struct blockvector *bv
|
struct blockvector *bv
|
||||||
= (struct blockvector *) s->compunit ()->blockvector ();
|
= (struct blockvector *) s->compunit ()->blockvector ();
|
||||||
|
|
||||||
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
|
if (bv->num_blocks () <= FIRST_LOCAL_BLOCK)
|
||||||
{
|
{
|
||||||
/* Cosmetic */
|
/* Cosmetic */
|
||||||
if (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end () == 0)
|
if (bv->global_block ()->end () == 0)
|
||||||
BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start (0);
|
bv->global_block ()->set_start (0);
|
||||||
if (BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->end () == 0)
|
if (bv->static_block ()->end () == 0)
|
||||||
BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start (0);
|
bv->static_block ()->set_start (0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -4588,29 +4582,27 @@ sort_blocks (struct symtab *s)
|
||||||
* are very different. It would be nice to find a reliable test
|
* are very different. It would be nice to find a reliable test
|
||||||
* to detect -O3 images in advance.
|
* to detect -O3 images in advance.
|
||||||
*/
|
*/
|
||||||
if (BLOCKVECTOR_NBLOCKS (bv) > FIRST_LOCAL_BLOCK + 1)
|
if (bv->num_blocks () > FIRST_LOCAL_BLOCK + 1)
|
||||||
std::sort (&BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK),
|
{
|
||||||
&BLOCKVECTOR_BLOCK (bv, BLOCKVECTOR_NBLOCKS (bv)),
|
gdb::array_view<block *> blocks_view = bv->blocks ();
|
||||||
block_is_less_than);
|
|
||||||
|
std::sort (blocks_view.begin () + FIRST_LOCAL_BLOCK,
|
||||||
|
blocks_view.end (), block_is_less_than);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CORE_ADDR high = 0;
|
CORE_ADDR high = 0;
|
||||||
int i, j = BLOCKVECTOR_NBLOCKS (bv);
|
int i, j = bv->num_blocks ();
|
||||||
|
|
||||||
for (i = FIRST_LOCAL_BLOCK; i < j; i++)
|
for (i = FIRST_LOCAL_BLOCK; i < j; i++)
|
||||||
if (high < BLOCKVECTOR_BLOCK(bv, i)->end ())
|
if (high < bv->block (i)->end ())
|
||||||
high = BLOCKVECTOR_BLOCK(bv, i)->end ();
|
high = bv->block (i)->end ();
|
||||||
BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_end (high);
|
bv->global_block ()->set_end (high);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start
|
bv->global_block ()->set_start (bv->block (FIRST_LOCAL_BLOCK)->start ());
|
||||||
(BLOCKVECTOR_BLOCK(bv, FIRST_LOCAL_BLOCK)->start ());
|
bv->static_block ()->set_start (bv->global_block ()->start ());
|
||||||
|
bv->static_block ()->set_end (bv->global_block ()->end ());
|
||||||
BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start
|
|
||||||
(BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->start ());
|
|
||||||
|
|
||||||
BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_end
|
|
||||||
(BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4635,10 +4627,9 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
|
||||||
|
|
||||||
/* All symtabs must have at least two blocks. */
|
/* All symtabs must have at least two blocks. */
|
||||||
bv = new_bvect (2);
|
bv = new_bvect (2);
|
||||||
BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
|
bv->set_block (GLOBAL_BLOCK, new_block (NON_FUNCTION_BLOCK, lang));
|
||||||
BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
|
bv->set_block (STATIC_BLOCK, new_block (NON_FUNCTION_BLOCK, lang));
|
||||||
BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_superblock
|
bv->static_block ()->set_superblock (bv->global_block ());
|
||||||
(BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
|
|
||||||
cust->set_blockvector (bv);
|
cust->set_blockvector (bv);
|
||||||
|
|
||||||
cust->set_debugformat ("ECOFF");
|
cust->set_debugformat ("ECOFF");
|
||||||
|
@ -4713,8 +4704,7 @@ new_bvect (int nblocks)
|
||||||
|
|
||||||
size = sizeof (struct blockvector) + nblocks * sizeof (struct block *);
|
size = sizeof (struct blockvector) + nblocks * sizeof (struct block *);
|
||||||
bv = (struct blockvector *) xzalloc (size);
|
bv = (struct blockvector *) xzalloc (size);
|
||||||
|
bv->set_num_blocks (nblocks);
|
||||||
BLOCKVECTOR_NBLOCKS (bv) = nblocks;
|
|
||||||
|
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,19 +664,17 @@ objfile_relocate1 (struct objfile *objfile,
|
||||||
|
|
||||||
for (compunit_symtab *cust : objfile->compunits ())
|
for (compunit_symtab *cust : objfile->compunits ())
|
||||||
{
|
{
|
||||||
const struct blockvector *bv = cust->blockvector ();
|
struct blockvector *bv = cust->blockvector ();
|
||||||
int block_line_section = cust->block_line_section ();
|
int block_line_section = cust->block_line_section ();
|
||||||
|
|
||||||
if (BLOCKVECTOR_MAP (bv))
|
if (BLOCKVECTOR_MAP (bv))
|
||||||
addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]);
|
addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]);
|
||||||
|
|
||||||
for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
for (block *b : bv->blocks ())
|
||||||
{
|
{
|
||||||
struct block *b;
|
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct mdict_iterator miter;
|
struct mdict_iterator miter;
|
||||||
|
|
||||||
b = BLOCKVECTOR_BLOCK (bv, i);
|
|
||||||
b->set_start (b->start () + delta[block_line_section]);
|
b->set_start (b->start () + delta[block_line_section]);
|
||||||
b->set_end (b->end () + delta[block_line_section]);
|
b->set_end (b->end () + delta[block_line_section]);
|
||||||
|
|
||||||
|
|
|
@ -619,9 +619,8 @@ 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->compunit ()->blockvector ()
|
||||||
(tem->compunit ()->blockvector (),
|
->static_block ());
|
||||||
STATIC_BLOCK);
|
|
||||||
else
|
else
|
||||||
error (_("No file or function \"%s\"."),
|
error (_("No file or function \"%s\"."),
|
||||||
copy.c_str ());
|
copy.c_str ());
|
||||||
|
|
|
@ -463,10 +463,11 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||||
if (!expression_context_block)
|
if (!expression_context_block)
|
||||||
{
|
{
|
||||||
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->compunit ()->blockvector (),
|
= cursal.symtab->compunit ()->blockvector ()->static_block ();
|
||||||
STATIC_BLOCK);
|
|
||||||
if (expression_context_block)
|
if (expression_context_block)
|
||||||
expression_context_pc = expression_context_block->entry_pc ();
|
expression_context_pc = expression_context_block->entry_pc ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1798,7 +1798,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
|
||||||
if (cust == NULL)
|
if (cust == NULL)
|
||||||
continue;
|
continue;
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
|
b = bv->static_block ();
|
||||||
for (partial_symbol *psym : ps->static_psymbols)
|
for (partial_symbol *psym : ps->static_psymbols)
|
||||||
{
|
{
|
||||||
/* Skip symbols for inlined functions without address. These may
|
/* Skip symbols for inlined functions without address. These may
|
||||||
|
@ -1819,7 +1819,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
|
||||||
gdb_printf (" psymtab\n");
|
gdb_printf (" psymtab\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
b = bv->global_block ();
|
||||||
for (partial_symbol *psym : ps->global_psymbols)
|
for (partial_symbol *psym : ps->global_psymbols)
|
||||||
{
|
{
|
||||||
sym = block_lookup_symbol (b, psym->ginfo.search_name (),
|
sym = block_lookup_symbol (b, psym->ginfo.search_name (),
|
||||||
|
|
|
@ -569,10 +569,9 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
for (compunit_symtab *cust : objfile->compunits ())
|
for (compunit_symtab *cust : objfile->compunits ())
|
||||||
{
|
{
|
||||||
const struct blockvector *bv;
|
const struct blockvector *bv;
|
||||||
const struct block *block;
|
|
||||||
|
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
|
const struct block *block = bv->static_block ();
|
||||||
|
|
||||||
if (block != nullptr)
|
if (block != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,13 +176,13 @@ static PyObject *
|
||||||
stpy_global_block (PyObject *self, PyObject *args)
|
stpy_global_block (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
struct symtab *symtab = NULL;
|
struct symtab *symtab = NULL;
|
||||||
const struct block *block = NULL;
|
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
|
|
||||||
STPY_REQUIRE_VALID (self, symtab);
|
STPY_REQUIRE_VALID (self, symtab);
|
||||||
|
|
||||||
blockvector = symtab->compunit ()->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
const struct block *block = blockvector->global_block ();
|
||||||
|
|
||||||
return block_to_block_object (block, symtab->compunit ()->objfile ());
|
return block_to_block_object (block, symtab->compunit ()->objfile ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,13 +192,13 @@ static PyObject *
|
||||||
stpy_static_block (PyObject *self, PyObject *args)
|
stpy_static_block (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
struct symtab *symtab = NULL;
|
struct symtab *symtab = NULL;
|
||||||
const struct block *block = NULL;
|
|
||||||
const struct blockvector *blockvector;
|
const struct blockvector *blockvector;
|
||||||
|
|
||||||
STPY_REQUIRE_VALID (self, symtab);
|
STPY_REQUIRE_VALID (self, symtab);
|
||||||
|
|
||||||
blockvector = symtab->compunit ()->blockvector ();
|
blockvector = symtab->compunit ()->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
const struct block *block = blockvector->static_block ();
|
||||||
|
|
||||||
return block_to_block_object (block, symtab->compunit ()->objfile ());
|
return block_to_block_object (block, symtab->compunit ()->objfile ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym, *with_opaque = NULL;
|
struct symbol *sym, *with_opaque = NULL;
|
||||||
const struct blockvector *bv = stab->blockvector ();
|
const struct blockvector *bv = stab->blockvector ();
|
||||||
const struct block *block = BLOCKVECTOR_BLOCK (bv, kind);
|
const struct block *block = bv->block (kind);
|
||||||
|
|
||||||
sym = block_find_symbol (block, name, domain,
|
sym = block_find_symbol (block, name, domain,
|
||||||
block_find_non_opaque_type_preferred,
|
block_find_non_opaque_type_preferred,
|
||||||
|
|
|
@ -236,13 +236,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||||
{
|
{
|
||||||
struct objfile *objfile = symtab->compunit ()->objfile ();
|
struct objfile *objfile = symtab->compunit ()->objfile ();
|
||||||
struct gdbarch *gdbarch = objfile->arch ();
|
struct gdbarch *gdbarch = objfile->arch ();
|
||||||
int i;
|
|
||||||
struct mdict_iterator miter;
|
struct mdict_iterator miter;
|
||||||
int len;
|
|
||||||
struct linetable *l;
|
struct linetable *l;
|
||||||
const struct blockvector *bv;
|
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
const struct block *b;
|
|
||||||
int depth;
|
int depth;
|
||||||
|
|
||||||
gdb_printf (outfile, "\nSymtab for file %s at %s\n",
|
gdb_printf (outfile, "\nSymtab for file %s at %s\n",
|
||||||
|
@ -263,8 +259,8 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||||
if (l)
|
if (l)
|
||||||
{
|
{
|
||||||
gdb_printf (outfile, "\nLine table:\n\n");
|
gdb_printf (outfile, "\nLine table:\n\n");
|
||||||
len = l->nitems;
|
int len = l->nitems;
|
||||||
for (i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
gdb_printf (outfile, " line %d at ", l->item[i].line);
|
gdb_printf (outfile, " line %d at ", l->item[i].line);
|
||||||
gdb_puts (paddress (gdbarch, l->item[i].pc), outfile);
|
gdb_puts (paddress (gdbarch, l->item[i].pc), outfile);
|
||||||
|
@ -278,11 +274,10 @@ 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->compunit ()->blockvector ();
|
const blockvector *bv = symtab->compunit ()->blockvector ();
|
||||||
len = BLOCKVECTOR_NBLOCKS (bv);
|
for (int i = 0; i < bv->num_blocks (); i++)
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
{
|
||||||
b = BLOCKVECTOR_BLOCK (bv, i);
|
const block *b = bv->block (i);
|
||||||
depth = block_depth (b) * 2;
|
depth = block_depth (b) * 2;
|
||||||
gdb_printf (outfile, "%*sblock #%03d, object at %s",
|
gdb_printf (outfile, "%*sblock #%03d, object at %s",
|
||||||
depth, "", i,
|
depth, "", i,
|
||||||
|
@ -351,7 +346,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
||||||
gdb_printf (outfile, "Compunit user: %s\n", addr);
|
gdb_printf (outfile, "Compunit user: %s\n", addr);
|
||||||
}
|
}
|
||||||
if (cust->includes != nullptr)
|
if (cust->includes != nullptr)
|
||||||
for (i = 0; ; ++i)
|
for (int i = 0; ; ++i)
|
||||||
{
|
{
|
||||||
struct compunit_symtab *include = cust->includes[i];
|
struct compunit_symtab *include = cust->includes[i];
|
||||||
if (include == nullptr)
|
if (include == nullptr)
|
||||||
|
|
23
gdb/symtab.c
23
gdb/symtab.c
|
@ -2327,7 +2327,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
|
||||||
struct block_symbol result;
|
struct block_symbol result;
|
||||||
|
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = bv->block (block_index);
|
||||||
result.symbol = block_lookup_symbol_primary (block, name, domain);
|
result.symbol = block_lookup_symbol_primary (block, name, domain);
|
||||||
result.block = block;
|
result.block = block;
|
||||||
if (result.symbol == NULL)
|
if (result.symbol == NULL)
|
||||||
|
@ -2460,7 +2460,7 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = bv->block (block_index);
|
||||||
result.symbol = block_lookup_symbol (block, name,
|
result.symbol = block_lookup_symbol (block, name,
|
||||||
symbol_name_match_type::FULL, domain);
|
symbol_name_match_type::FULL, domain);
|
||||||
if (result.symbol == NULL)
|
if (result.symbol == NULL)
|
||||||
|
@ -2810,7 +2810,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = bv->block (block_index);
|
||||||
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
|
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
|
||||||
block_find_non_opaque_type, NULL);
|
block_find_non_opaque_type, NULL);
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
|
@ -2835,7 +2835,7 @@ basic_lookup_transparent_type_1 (struct objfile *objfile,
|
||||||
for (compunit_symtab *cust : objfile->compunits ())
|
for (compunit_symtab *cust : objfile->compunits ())
|
||||||
{
|
{
|
||||||
bv = cust->blockvector ();
|
bv = cust->blockvector ();
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = bv->block (block_index);
|
||||||
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
|
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
|
||||||
block_find_non_opaque_type, NULL);
|
block_find_non_opaque_type, NULL);
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
|
@ -2980,8 +2980,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
|
||||||
for (compunit_symtab *cust : obj_file->compunits ())
|
for (compunit_symtab *cust : obj_file->compunits ())
|
||||||
{
|
{
|
||||||
const struct blockvector *bv = cust->blockvector ();
|
const struct blockvector *bv = cust->blockvector ();
|
||||||
const struct block *global_block
|
const struct block *global_block = bv->global_block ();
|
||||||
= BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
|
|
||||||
CORE_ADDR start = global_block->start ();
|
CORE_ADDR start = global_block->start ();
|
||||||
CORE_ADDR end = global_block->end ();
|
CORE_ADDR end = global_block->end ();
|
||||||
bool in_range_p = start <= pc && pc < end;
|
bool in_range_p = start <= pc && pc < end;
|
||||||
|
@ -3030,7 +3029,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
|
||||||
b_index <= STATIC_BLOCK && sym == NULL;
|
b_index <= STATIC_BLOCK && sym == NULL;
|
||||||
++b_index)
|
++b_index)
|
||||||
{
|
{
|
||||||
const struct block *b = BLOCKVECTOR_BLOCK (bv, b_index);
|
const struct block *b = bv->block (b_index);
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, obj_file);
|
fixup_symbol_section (sym, obj_file);
|
||||||
|
@ -3089,7 +3088,7 @@ find_symbol_at_address (CORE_ADDR address)
|
||||||
|
|
||||||
for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
|
for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
|
||||||
{
|
{
|
||||||
const struct block *b = BLOCKVECTOR_BLOCK (bv, i);
|
const struct block *b = bv->block (i);
|
||||||
struct block_iterator iter;
|
struct block_iterator iter;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
|
@ -3406,7 +3405,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
|
||||||
else if (alt)
|
else if (alt)
|
||||||
val.end = alt->pc;
|
val.end = alt->pc;
|
||||||
else
|
else
|
||||||
val.end = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)->end ();
|
val.end = bv->global_block ()->end ();
|
||||||
}
|
}
|
||||||
val.section = section;
|
val.section = section;
|
||||||
return val;
|
return val;
|
||||||
|
@ -4869,7 +4868,7 @@ global_symbol_searcher::add_matching_symbols
|
||||||
{
|
{
|
||||||
struct block_iterator iter;
|
struct block_iterator iter;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
const struct block *b = BLOCKVECTOR_BLOCK (bv, block);
|
const struct block *b = bv->block (block);
|
||||||
|
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||||
{
|
{
|
||||||
|
@ -5832,7 +5831,6 @@ add_symtab_completions (struct compunit_symtab *cust,
|
||||||
enum type_code code)
|
enum type_code code)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
const struct block *b;
|
|
||||||
struct block_iterator iter;
|
struct block_iterator iter;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -5842,7 +5840,8 @@ add_symtab_completions (struct compunit_symtab *cust,
|
||||||
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
b = BLOCKVECTOR_BLOCK (cust->blockvector (), i);
|
|
||||||
|
const struct block *b = cust->blockvector ()->block (i);
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||||
{
|
{
|
||||||
if (completion_skip_symbol (mode, sym))
|
if (completion_skip_symbol (mode, sym))
|
||||||
|
|
|
@ -1757,12 +1757,17 @@ struct compunit_symtab
|
||||||
m_dirname = dirname;
|
m_dirname = dirname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct blockvector *blockvector ()
|
||||||
|
{
|
||||||
|
return m_blockvector;
|
||||||
|
}
|
||||||
|
|
||||||
const struct blockvector *blockvector () const
|
const struct blockvector *blockvector () const
|
||||||
{
|
{
|
||||||
return m_blockvector;
|
return m_blockvector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_blockvector (const struct blockvector *blockvector)
|
void set_blockvector (struct blockvector *blockvector)
|
||||||
{
|
{
|
||||||
m_blockvector = blockvector;
|
m_blockvector = blockvector;
|
||||||
}
|
}
|
||||||
|
@ -1860,7 +1865,7 @@ struct compunit_symtab
|
||||||
|
|
||||||
/* List of all symbol scope blocks for this symtab. It is shared among
|
/* List of all symbol scope blocks for this symtab. It is shared among
|
||||||
all symtabs in a given compilation unit. */
|
all symtabs in a given compilation unit. */
|
||||||
const struct blockvector *m_blockvector;
|
struct blockvector *m_blockvector;
|
||||||
|
|
||||||
/* Section in objfile->section_offsets for the blockvector and
|
/* Section in objfile->section_offsets for the blockvector and
|
||||||
the linetable. Probably always SECT_OFF_TEXT. */
|
the linetable. Probably always SECT_OFF_TEXT. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue