From: Cary Coutant <ccoutant@google.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix "Cannot find DIE" error with -gdwarf-4
Date: Mon, 09 Nov 2009 21:31:00 -0000 [thread overview]
Message-ID: <c17be2b30911091331x6b3d25c9g363ac3907a36710a@mail.gmail.com> (raw)
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)
{
next reply other threads:[~2009-11-09 21:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 21:31 Cary Coutant [this message]
2009-11-09 21:35 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c17be2b30911091331x6b3d25c9g363ac3907a36710a@mail.gmail.com \
--to=ccoutant@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox