This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[1/5] RFC fix derivation.exp regressions


This fixes some derivation.exp regressions with "dwz -m":

    gdb.cp/derivation.exp: p (A::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: p (D::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: p (E::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: p (F::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: p (Z::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: p (ZZ::value_type) 0: PASS => FAIL
    gdb.cp/derivation.exp: ptype A::value_type: PASS => FAIL
    gdb.cp/derivation.exp: ptype D::value_type: PASS => FAIL
    gdb.cp/derivation.exp: ptype E::value_type: PASS => FAIL
    gdb.cp/derivation.exp: ptype F::value_type: PASS => FAIL
    gdb.cp/derivation.exp: ptype Z::value_type: PASS => FAIL
    gdb.cp/derivation.exp: ptype ZZ::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis A::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis D::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis E::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis F::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis Z::value_type: PASS => FAIL
    gdb.cp/derivation.exp: whatis ZZ::value_type: PASS => FAIL

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
16.

Tom

	* 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.
---
 gdb/dwarf2read.c |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index d26e7c8..d021f98 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4889,6 +4889,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
@@ -4907,16 +4922,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;
 
@@ -5031,8 +5044,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
@@ -5042,9 +5058,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 ();
@@ -5537,7 +5555,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);
@@ -5757,7 +5775,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);
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]