From: Tom Tromey <tromey@redhat.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [1/4] RFC: skip DIEs which only declare an enum
Date: Mon, 18 Jul 2011 20:14:00 -0000 [thread overview]
Message-ID: <m38vrv78ih.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3oc0r7cs1.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon, 18 Jul 2011 10:51:26 -0600")
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> I am going withdraw this patch and look at other ways to fix this
Tom> problem.
Here is what I came up with.
It seems to me that the bad case is exactly when we are reading a
.debug_types CU and the enum type we are reading is not the signatured
type. In this case, the enum type is needed for other types in the CU,
but doesn't need a symbol, as presumably there is some other
.debug_types CU that has the true definition.
So, this patch implements just this exception. I rebased on it on patch
#2, so the series ordering is different now.
Built and regtested by the buildbot.
In the absence of comments I plan to commit this in a couple of days.
Tom
2011-07-18 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (process_enumeration_scope): Do not call new_symbol
in some declaration-only cases.
From 79fc44c91390d14bcf0f98f7e19d9b8888952595 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Mon, 18 Jul 2011 11:54:45 -0600
Subject: [PATCH 2/2] fix enum declaration regression
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2read.c | 26 ++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4c8a732..e6cc94a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1204,6 +1204,11 @@ static struct die_info *follow_die_sig (struct die_info *,
struct attribute *,
struct dwarf2_cu **);
+static struct signatured_type *lookup_signatured_type_at_offset
+ (struct objfile *objfile,
+ struct dwarf2_section_info *section,
+ unsigned int offset);
+
static void read_signatured_type_at_offset (struct objfile *objfile,
struct dwarf2_section_info *sect,
unsigned int offset);
@@ -7714,6 +7719,27 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
TYPE_UNSIGNED (this_type) = 1;
}
+ /* If we are reading an enum from a .debug_types unit, and the enum
+ is a declaration, and the enum is not the signatured type in the
+ unit, then we do not want to add a symbol for it. Adding a
+ symbol would in some cases obscure the true definition of the
+ enum, giving users an incomplete type when the definition is
+ actually available. Note that we do not want to do this for all
+ enums which are just declarations, because C++0x allows forward
+ enum declarations. */
+ if (cu->per_cu->debug_type_section
+ && die_is_declaration (die, cu))
+ {
+ struct signatured_type *type_sig;
+
+ type_sig
+ = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
+ cu->per_cu->debug_type_section,
+ cu->per_cu->offset);
+ if (type_sig->type_offset != die->offset)
+ return;
+ }
+
new_symbol (die, this_type, cu);
}
--
1.7.6
next prev parent reply other threads:[~2011-07-18 18:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-15 18:08 Tom Tromey
2011-07-15 18:50 ` Daniel Jacobowitz
2011-07-18 18:02 ` Tom Tromey
2011-07-18 20:14 ` Tom Tromey [this message]
2011-07-20 15:19 ` Tom Tromey
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=m38vrv78ih.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=drow@false.org \
--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