Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix "Cannot find DIE" error with -gdwarf-4
@ 2009-11-09 21:31 Cary Coutant
  2009-11-09 21:35 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Cary Coutant @ 2009-11-09 21:31 UTC (permalink / raw)
  To: gdb-patches

This patch fixes a problem in read_import_statement, where we get a
"Cannot find DIE" error when trying to process a DW_AT_import
attribute that refers to a DIE in a different CU. When finding the
referenced DIE, the current code clobbers the CU parameter, but later
calls determine_prefix(die, cu), assuming that CU is still the CU that
contains DIE.

I found this problem using -gdwarf-4 and DW_FORM_sig8, but I don't
think this problem was introduced with the support for type units. The
same problem could have occurred given a compiler that splits debug
info into separate compilation units by include file, using
DW_FORM_ref_addr to refer to a DIE in a different CU.

OK for trunk?

-cary


        * dwarf2read.c (read_import_statement): Don't clobber original cu.


Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.331
diff -u -p -r1.331 dwarf2read.c
--- dwarf2read.c	5 Nov 2009 23:18:00 -0000	1.331
+++ dwarf2read.c	9 Nov 2009 21:15:57 -0000
@@ -3372,6 +3372,7 @@ read_import_statement (struct die_info *
 {
   struct attribute *import_attr;
   struct die_info *imported_die;
+  struct dwarf2_cu *imported_cu;
   const char *imported_name;
   const char *imported_name_prefix;
   const char *import_prefix;
@@ -3385,8 +3386,9 @@ read_import_statement (struct die_info *
       return;
     }

-  imported_die = follow_die_ref_or_sig (die, import_attr, &cu);
-  imported_name = dwarf2_name (imported_die, cu);
+  imported_cu = cu;
+  imported_die = follow_die_ref_or_sig (die, import_attr, &imported_cu);
+  imported_name = dwarf2_name (imported_die, imported_cu);
   if (imported_name == NULL)
     {
       /* GCC bug: https://bugzilla.redhat.com/show_bug.cgi?id=506524
@@ -3431,7 +3433,7 @@ read_import_statement (struct die_info *

   /* Figure out what the scope of the imported die is and prepend it
      to the name of the imported die.  */
-  imported_name_prefix = determine_prefix (imported_die, cu);
+  imported_name_prefix = determine_prefix (imported_die, imported_cu);

   if (strlen (imported_name_prefix) > 0)
     {


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Fix "Cannot find DIE" error with -gdwarf-4
  2009-11-09 21:31 [patch] Fix "Cannot find DIE" error with -gdwarf-4 Cary Coutant
@ 2009-11-09 21:35 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2009-11-09 21:35 UTC (permalink / raw)
  To: Cary Coutant; +Cc: gdb-patches

On Mon, Nov 09, 2009 at 01:31:32PM -0800, Cary Coutant wrote:
> This patch fixes a problem in read_import_statement, where we get a
> "Cannot find DIE" error when trying to process a DW_AT_import
> attribute that refers to a DIE in a different CU. When finding the
> referenced DIE, the current code clobbers the CU parameter, but later
> calls determine_prefix(die, cu), assuming that CU is still the CU that
> contains DIE.
> 
> I found this problem using -gdwarf-4 and DW_FORM_sig8, but I don't
> think this problem was introduced with the support for type units. The
> same problem could have occurred given a compiler that splits debug
> info into separate compilation units by include file, using
> DW_FORM_ref_addr to refer to a DIE in a different CU.
> 
> OK for trunk?

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-09 21:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-09 21:31 [patch] Fix "Cannot find DIE" error with -gdwarf-4 Cary Coutant
2009-11-09 21:35 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox