summaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-07 20:10:36 +0000
committerTom Tromey <tromey@redhat.com>2013-08-07 20:10:36 +0000
commitba14c8238e57241250d768d3472533293c55de8d (patch)
treeb788da88de22770a520b8a6513e1635ae097ae86 /gdb/dwarf2read.c
parentbef6190733f4acefedd78b1b4435fa66cb5035b5 (diff)
downloadgdb-ba14c8238e57241250d768d3472533293c55de8d.tar.gz
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 13cd12fb341..9e19e78fda1 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5623,6 +5623,21 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
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. */
static void
@@ -5641,16 +5656,14 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
struct partial_symtab *pst;
int has_pc_info;
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
- && (want_partial_unit_ptr == NULL
- || !*want_partial_unit_ptr))
+ if (comp_unit_die->tag == DW_TAG_partial_unit && !info->want_partial_unit)
return;
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;
@@ -5765,8 +5778,11 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
static void
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
cached copy in order to read it in again. This is
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);
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,
process_psymtab_comp_unit_reader,
- &want_partial_unit);
+ &info);
/* Age out any secondary CUs. */
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);
- process_psymtab_comp_unit (per_cu, 0);
+ process_psymtab_comp_unit (per_cu, 0, language_minimal);
}
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. */
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,
cu->per_cu->imported_symtabs, per_cu);