mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
fix PR symtab/15028
This fixes some derivation.exp regressions with "dwz -m". The bug here is that the imported PU is given language_minimal. However, it ought to be C++. The "pretend language" machinery exists to solve this problem, but it wasn't handled in process_psymtab_comp_unit. So, this patch adds it there. Built and regtested, both normally and using "dwz -m", on x86-64 Fedora 18. PR symtab/15028: * dwarf2read.c (struct process_psymtab_comp_unit_data): New. (process_psymtab_comp_unit_reader): Use it. (process_psymtab_comp_unit): Update. Add "pretend_language" argument. (dwarf2_build_psymtabs_hard): Update. (scan_partial_symbols): Pass CU's language to process_psymtab_comp_unit.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2013-08-07 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
PR symtab/15028:
|
||||||
|
* dwarf2read.c (struct process_psymtab_comp_unit_data): New.
|
||||||
|
(process_psymtab_comp_unit_reader): Use it.
|
||||||
|
(process_psymtab_comp_unit): Update. Add "pretend_language"
|
||||||
|
argument.
|
||||||
|
(dwarf2_build_psymtabs_hard): Update.
|
||||||
|
(scan_partial_symbols): Pass CU's language to
|
||||||
|
process_psymtab_comp_unit.
|
||||||
|
|
||||||
2013-08-07 Tom Tromey <tromey@redhat.com>
|
2013-08-07 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* dwarf2read.c (dw2_get_primary_filename_reader): Remove.
|
* dwarf2read.c (dw2_get_primary_filename_reader): Remove.
|
||||||
|
@ -5623,6 +5623,21 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
|
|||||||
return pst;
|
return pst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The DATA object passed to process_psymtab_comp_unit_reader has this
|
||||||
|
type. */
|
||||||
|
|
||||||
|
struct process_psymtab_comp_unit_data
|
||||||
|
{
|
||||||
|
/* True if we are reading a DW_TAG_partial_unit. */
|
||||||
|
|
||||||
|
int want_partial_unit;
|
||||||
|
|
||||||
|
/* The "pretend" language that is used if the CU doesn't declare a
|
||||||
|
language. */
|
||||||
|
|
||||||
|
enum language pretend_language;
|
||||||
|
};
|
||||||
|
|
||||||
/* die_reader_func for process_psymtab_comp_unit. */
|
/* die_reader_func for process_psymtab_comp_unit. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -5641,16 +5656,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
|||||||
struct partial_symtab *pst;
|
struct partial_symtab *pst;
|
||||||
int has_pc_info;
|
int has_pc_info;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
int *want_partial_unit_ptr = data;
|
struct process_psymtab_comp_unit_data *info = data;
|
||||||
|
|
||||||
if (comp_unit_die->tag == DW_TAG_partial_unit
|
if (comp_unit_die->tag == DW_TAG_partial_unit && !info->want_partial_unit)
|
||||||
&& (want_partial_unit_ptr == NULL
|
|
||||||
|| !*want_partial_unit_ptr))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdb_assert (! per_cu->is_debug_types);
|
gdb_assert (! per_cu->is_debug_types);
|
||||||
|
|
||||||
prepare_one_comp_unit (cu, comp_unit_die, language_minimal);
|
prepare_one_comp_unit (cu, comp_unit_die, info->pretend_language);
|
||||||
|
|
||||||
cu->list_in_scope = &file_symbols;
|
cu->list_in_scope = &file_symbols;
|
||||||
|
|
||||||
@ -5765,8 +5778,11 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
|
process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
|
||||||
int want_partial_unit)
|
int want_partial_unit,
|
||||||
|
enum language pretend_language)
|
||||||
{
|
{
|
||||||
|
struct process_psymtab_comp_unit_data info;
|
||||||
|
|
||||||
/* If this compilation unit was already read in, free the
|
/* If this compilation unit was already read in, free the
|
||||||
cached copy in order to read it in again. This is
|
cached copy in order to read it in again. This is
|
||||||
necessary because we skipped some symbols when we first
|
necessary because we skipped some symbols when we first
|
||||||
@ -5776,9 +5792,11 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
|
|||||||
free_one_cached_comp_unit (this_cu);
|
free_one_cached_comp_unit (this_cu);
|
||||||
|
|
||||||
gdb_assert (! this_cu->is_debug_types);
|
gdb_assert (! this_cu->is_debug_types);
|
||||||
|
info.want_partial_unit = want_partial_unit;
|
||||||
|
info.pretend_language = pretend_language;
|
||||||
init_cutu_and_read_dies (this_cu, NULL, 0, 0,
|
init_cutu_and_read_dies (this_cu, NULL, 0, 0,
|
||||||
process_psymtab_comp_unit_reader,
|
process_psymtab_comp_unit_reader,
|
||||||
&want_partial_unit);
|
&info);
|
||||||
|
|
||||||
/* Age out any secondary CUs. */
|
/* Age out any secondary CUs. */
|
||||||
age_cached_comp_units ();
|
age_cached_comp_units ();
|
||||||
@ -5956,7 +5974,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
|
|||||||
{
|
{
|
||||||
struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
|
struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
|
||||||
|
|
||||||
process_psymtab_comp_unit (per_cu, 0);
|
process_psymtab_comp_unit (per_cu, 0, language_minimal);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_partial_user (objfile);
|
set_partial_user (objfile);
|
||||||
@ -6178,7 +6196,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
|
|||||||
|
|
||||||
/* Go read the partial unit, if needed. */
|
/* Go read the partial unit, if needed. */
|
||||||
if (per_cu->v.psymtab == NULL)
|
if (per_cu->v.psymtab == NULL)
|
||||||
process_psymtab_comp_unit (per_cu, 1);
|
process_psymtab_comp_unit (per_cu, 1, cu->language);
|
||||||
|
|
||||||
VEC_safe_push (dwarf2_per_cu_ptr,
|
VEC_safe_push (dwarf2_per_cu_ptr,
|
||||||
cu->per_cu->imported_symtabs, per_cu);
|
cu->per_cu->imported_symtabs, per_cu);
|
||||||
|
Reference in New Issue
Block a user