The result of symtab expansion is always a primary symtab.
gdb/ChangeLog: * dwarf2read.c (dw2_instantiate_symtab): Add assert. (dw2_lookup_symbol): Remove unnecessary test for primary symbol table. * psymtab.c (lookup_symbol_aux_psymtabs): Ditto. (psymtab_to_symtab): Add comment and assert. (map_matching_symbols_psymtab): Remove unnecessary test for non-primary symtab.
This commit is contained in:
parent
6937bb54a9
commit
f194fefb5e
3 changed files with 31 additions and 16 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2014-11-18 Doug Evans <xdje42@gmail.com>
|
||||||
|
|
||||||
|
The result of symtab expansion is always a primary symtab.
|
||||||
|
* dwarf2read.c (dw2_instantiate_symtab): Add assert.
|
||||||
|
(dw2_lookup_symbol): Remove unnecessary test for primary symbol table.
|
||||||
|
* psymtab.c (lookup_symbol_aux_psymtabs): Ditto.
|
||||||
|
(psymtab_to_symtab): Add comment and assert.
|
||||||
|
(map_matching_symbols_psymtab): Remove unnecessary test for
|
||||||
|
non-primary symtab.
|
||||||
|
|
||||||
2014-11-15 Doug Evans <xdje42@gmail.com>
|
2014-11-15 Doug Evans <xdje42@gmail.com>
|
||||||
|
|
||||||
PR symtab/17559
|
PR symtab/17559
|
||||||
|
|
|
@ -2660,6 +2660,10 @@ dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
|
||||||
process_cu_includes ();
|
process_cu_includes ();
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The result of symtab expansion is always the primary symtab. */
|
||||||
|
gdb_assert (per_cu->v.quick->symtab->primary);
|
||||||
|
|
||||||
return per_cu->v.quick->symtab;
|
return per_cu->v.quick->symtab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3611,17 +3615,13 @@ dw2_lookup_symbol (struct objfile *objfile, int block_index,
|
||||||
{
|
{
|
||||||
struct symbol *sym = NULL;
|
struct symbol *sym = NULL;
|
||||||
struct symtab *stab = dw2_instantiate_symtab (per_cu);
|
struct symtab *stab = dw2_instantiate_symtab (per_cu);
|
||||||
|
const struct blockvector *bv = BLOCKVECTOR (stab);
|
||||||
|
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
|
||||||
|
|
||||||
/* Some caution must be observed with overloaded functions
|
/* Some caution must be observed with overloaded functions
|
||||||
and methods, since the index will not contain any overload
|
and methods, since the index will not contain any overload
|
||||||
information (but NAME might contain it). */
|
information (but NAME might contain it). */
|
||||||
if (stab->primary)
|
sym = block_lookup_symbol (block, name, domain);
|
||||||
{
|
|
||||||
const struct blockvector *bv = BLOCKVECTOR (stab);
|
|
||||||
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
|
|
||||||
|
|
||||||
sym = block_lookup_symbol (block, name, domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -510,17 +510,16 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
|
||||||
{
|
{
|
||||||
struct symbol *sym = NULL;
|
struct symbol *sym = NULL;
|
||||||
struct symtab *stab = psymtab_to_symtab (objfile, ps);
|
struct symtab *stab = psymtab_to_symtab (objfile, ps);
|
||||||
|
/* Note: While psymtab_to_symtab can return NULL if the partial symtab
|
||||||
|
is empty, we can assume it won't here because lookup_partial_symbol
|
||||||
|
succeeded. */
|
||||||
|
const struct blockvector *bv = BLOCKVECTOR (stab);
|
||||||
|
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
|
||||||
|
|
||||||
/* Some caution must be observed with overloaded functions
|
/* Some caution must be observed with overloaded functions
|
||||||
and methods, since the psymtab will not contain any overload
|
and methods, since the psymtab will not contain any overload
|
||||||
information (but NAME might contain it). */
|
information (but NAME might contain it). */
|
||||||
if (stab->primary)
|
sym = block_lookup_symbol (block, name, domain);
|
||||||
{
|
|
||||||
const struct blockvector *bv = BLOCKVECTOR (stab);
|
|
||||||
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
|
|
||||||
|
|
||||||
sym = block_lookup_symbol (block, name, domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
||||||
{
|
{
|
||||||
|
@ -756,7 +755,10 @@ lookup_partial_symbol (struct objfile *objfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the symbol table that corresponds to a partial_symtab.
|
/* Get the symbol table that corresponds to a partial_symtab.
|
||||||
This is fast after the first time you do it. */
|
This is fast after the first time you do it.
|
||||||
|
The result will be NULL if the primary symtab has no symbols,
|
||||||
|
which can happen. Otherwise the result is the primary symtab
|
||||||
|
that contains PST. */
|
||||||
|
|
||||||
static struct symtab *
|
static struct symtab *
|
||||||
psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||||
|
@ -779,6 +781,9 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pst->symtab != NULL)
|
||||||
|
gdb_assert (pst->symtab->primary);
|
||||||
|
|
||||||
return pst->symtab;
|
return pst->symtab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,7 +1264,7 @@ map_matching_symbols_psymtab (struct objfile *objfile,
|
||||||
struct symtab *s = psymtab_to_symtab (objfile, ps);
|
struct symtab *s = psymtab_to_symtab (objfile, ps);
|
||||||
struct block *block;
|
struct block *block;
|
||||||
|
|
||||||
if (s == NULL || !s->primary)
|
if (s == NULL)
|
||||||
continue;
|
continue;
|
||||||
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind);
|
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind);
|
||||||
if (map_block (name, namespace, objfile, block,
|
if (map_block (name, namespace, objfile, block,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue