mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
* dwarf2read.c (dw2_symtab_iter_next): Check value of cu_index
before using it. (dw2_expand_symtabs_matching): Fix symbol kind validity check. Move test of cu_index closer to use. Print complaint if cu_index is bad.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2013-06-18 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* dwarf2read.c (dw2_symtab_iter_next): Check value of cu_index
|
||||||
|
before using it.
|
||||||
|
(dw2_expand_symtabs_matching): Fix symbol kind validity check.
|
||||||
|
Move test of cu_index closer to use. Print complaint if cu_index
|
||||||
|
is bad.
|
||||||
|
|
||||||
2013-06-18 Joel Brobecker <brobecker@adacore.com>
|
2013-06-18 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* machoread.c (oso_vector): Delete this global.
|
* machoread.c (oso_vector): Delete this global.
|
||||||
|
@ -3199,7 +3199,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
|
|||||||
offset_type cu_index_and_attrs =
|
offset_type cu_index_and_attrs =
|
||||||
MAYBE_SWAP (iter->vec[iter->next + 1]);
|
MAYBE_SWAP (iter->vec[iter->next + 1]);
|
||||||
offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
|
offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
|
||||||
struct dwarf2_per_cu_data *per_cu = dw2_get_cu (cu_index);
|
struct dwarf2_per_cu_data *per_cu;
|
||||||
int want_static = iter->block_index != GLOBAL_BLOCK;
|
int want_static = iter->block_index != GLOBAL_BLOCK;
|
||||||
/* This value is only valid for index versions >= 7. */
|
/* This value is only valid for index versions >= 7. */
|
||||||
int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
|
int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
|
||||||
@ -3213,6 +3213,18 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
|
|||||||
(iter->index->version >= 7
|
(iter->index->version >= 7
|
||||||
&& symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
|
&& symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
|
||||||
|
|
||||||
|
/* Don't crash on bad data. */
|
||||||
|
if (cu_index >= (dwarf2_per_objfile->n_comp_units
|
||||||
|
+ dwarf2_per_objfile->n_type_units))
|
||||||
|
{
|
||||||
|
complaint (&symfile_complaints,
|
||||||
|
_(".gdb_index entry has bad CU index"
|
||||||
|
" [in module %s]"), dwarf2_per_objfile->objfile->name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
per_cu = dw2_get_cu (cu_index);
|
||||||
|
|
||||||
/* Skip if already read in. */
|
/* Skip if already read in. */
|
||||||
if (per_cu->v.quick->symtab)
|
if (per_cu->v.quick->symtab)
|
||||||
continue;
|
continue;
|
||||||
@ -3630,15 +3642,16 @@ dw2_expand_symtabs_matching
|
|||||||
gdb_index_symbol_kind symbol_kind =
|
gdb_index_symbol_kind symbol_kind =
|
||||||
GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
|
GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
|
||||||
int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
|
int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
|
||||||
|
/* Only check the symbol attributes if they're present.
|
||||||
|
Indices prior to version 7 don't record them,
|
||||||
|
and indices >= 7 may elide them for certain symbols
|
||||||
|
(gold does this). */
|
||||||
|
int attrs_valid =
|
||||||
|
(index->version >= 7
|
||||||
|
&& symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
|
||||||
|
|
||||||
/* Don't crash on bad data. */
|
/* Only check the symbol's kind if it has one. */
|
||||||
if (cu_index >= (dwarf2_per_objfile->n_comp_units
|
if (attrs_valid)
|
||||||
+ dwarf2_per_objfile->n_type_units))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Only check the symbol's kind if it has one.
|
|
||||||
Indices prior to version 7 don't record it. */
|
|
||||||
if (index->version >= 7)
|
|
||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
@ -3659,6 +3672,16 @@ dw2_expand_symtabs_matching
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't crash on bad data. */
|
||||||
|
if (cu_index >= (dwarf2_per_objfile->n_comp_units
|
||||||
|
+ dwarf2_per_objfile->n_type_units))
|
||||||
|
{
|
||||||
|
complaint (&symfile_complaints,
|
||||||
|
_(".gdb_index entry has bad CU index"
|
||||||
|
" [in module %s]"), objfile->name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
per_cu = dw2_get_cu (cu_index);
|
per_cu = dw2_get_cu (cu_index);
|
||||||
if (file_matcher == NULL || per_cu->v.quick->mark)
|
if (file_matcher == NULL || per_cu->v.quick->mark)
|
||||||
dw2_instantiate_symtab (per_cu);
|
dw2_instantiate_symtab (per_cu);
|
||||||
|
Reference in New Issue
Block a user