From: Sterling Augustine <saugustine@google.com>
To: gdb-patches@sourceware.org
Subject: Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
Date: Tue, 11 Oct 2011 18:27:00 -0000 [thread overview]
Message-ID: <CAEG7qUxxHU2hXKCeNiSMceQfNSQhRdtzxxi+D6DV_hpf3w3GWA@mail.gmail.com> (raw)
In-Reply-To: <m34nzfa25y.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]
On Tue, Oct 11, 2011 at 10:06 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Sterling" == Sterling Augustine <saugustine@google.com> writes:
>
> Thanks.
>
> Sterling> 2011-10-07 Sterling Augustine <saugustine@google.com>
> Sterling> * dwarf2read.c (partial_die_parent_scope): Rearrange conditional logic.
>
> I think this line needs to wrap.
Done.
> Sterling> +if [get_compiler_info ${binfile} "c++"] {
> Sterling> + return -1
> Sterling> +}
>
> Does this really do anything?
> (I don't know.)
My dejagnu-fu is very weak, but this test is copied from rtti.exp,
which includes it. The test works just fine without these lines on my
machine, but perhaps that isn't the best indicator, so done.
> This stanza can be replaced by clean_restart.
Done.
Updated patch attached.
Sterling
gdb/ChangeLog
2011-10-07 Sterling Augustine <saugustine@google.com>
* dwarf2read.c (partial_die_parent_scope): Rearrange conditional
logic.
gdb/testsuite/gdb.cp/ChangeLog
2011-10-10 Sterling Augustine <saugustine@google.com>
* gdb.cp/Makefile.in: Add namespace-enum test.
* gdb.cp/namespace-enum.exp: New file.
* gdb.cp/namespace-enum.c: New file.
* gdb.cp/namespace-enum-main.c: New file.
[-- Attachment #2: enumerator-patch --]
[-- Type: application/octet-stream, Size: 5019 bytes --]
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.568
diff -u -p -r1.568 dwarf2read.c
--- dwarf2read.c 9 Oct 2011 19:34:18 -0000 1.568
+++ dwarf2read.c 11 Oct 2011 18:24:49 -0000
@@ -3897,7 +3897,10 @@ partial_die_parent_scope (struct partial
return NULL;
}
- if (parent->tag == DW_TAG_namespace
+ if (pdi->tag == DW_TAG_enumerator)
+ /* Enumerators should not get the name of the enumeration as a prefix. */
+ parent->scope = grandparent_scope;
+ else if (parent->tag == DW_TAG_namespace
|| parent->tag == DW_TAG_module
|| parent->tag == DW_TAG_structure_type
|| parent->tag == DW_TAG_class_type
@@ -3912,9 +3915,6 @@ partial_die_parent_scope (struct partial
grandparent_scope,
parent->name, 0, cu);
}
- else if (parent->tag == DW_TAG_enumerator)
- /* Enumerators should not get the name of the enumeration as a prefix. */
- parent->scope = grandparent_scope;
else
{
/* FIXME drow/2004-04-01: What should we be doing with
Index: testsuite/gdb.cp/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/Makefile.in,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile.in
--- testsuite/gdb.cp/Makefile.in 22 Feb 2011 20:52:46 -0000 1.13
+++ testsuite/gdb.cp/Makefile.in 11 Oct 2011 18:24:51 -0000
@@ -7,9 +7,9 @@ EXECUTABLES = abstract-origin ambiguous
exception expand-sals extern-c formatted-ref fpointer gdb1355 \
gdb2384 hang infcall-dlopen inherit koenig local m-data m-static \
mb-ctor mb-inline mb-templates member-ptr method misc namespace \
- namespace-nested-import nextoverthrow noparam nsdecl nsimport \
- nsnested nsnoimports nsrecurs nsstress nsusing operator oranking \
- overload overload-const ovldbreak pass-by-ref pr-1023 pr-1210 \
+ namespace-enum namespace-nested-import nextoverthrow noparam nsdecl \
+ nsimport nsnested nsnoimports nsrecurs nsstress nsusing operator \
+ oranking overload overload-const ovldbreak pass-by-ref pr-1023 pr-1210 \
pr-574 pr10728 pr12028 pr9631 printmethod psmang ptype-cv-cp \
re-set-overloaded ref-typ ref-typ2 rtti shadow smartp temargs \
templates try_catch typedef-operator userdef virtbase virtfunc \
Index: testsuite/gdb.cp/namespace-enum-main.cc
===================================================================
RCS file: testsuite/gdb.cp/namespace-enum-main.cc
diff -N testsuite/gdb.cp/namespace-enum-main.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.cp/namespace-enum-main.cc 11 Oct 2011 18:24:51 -0000
@@ -0,0 +1,5 @@
+namespace foo {
+int aglobal = 0;
+}
+
+int main() {return 0;}
Index: testsuite/gdb.cp/namespace-enum.cc
===================================================================
RCS file: testsuite/gdb.cp/namespace-enum.cc
diff -N testsuite/gdb.cp/namespace-enum.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.cp/namespace-enum.cc 11 Oct 2011 18:24:51 -0000
@@ -0,0 +1,8 @@
+enum A { A_A };
+enum A a = A_A;
+
+namespace foo
+{
+enum B { B_B };
+enum B b = B_B;
+};
Index: testsuite/gdb.cp/namespace-enum.exp
===================================================================
RCS file: testsuite/gdb.cp/namespace-enum.exp
diff -N testsuite/gdb.cp/namespace-enum.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.cp/namespace-enum.exp 11 Oct 2011 18:24:51 -0000
@@ -0,0 +1,42 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile namespace-enum
+set srcfile0 ${testfile}.cc
+set objfile0 ${testfile}.o
+set srcfile1 ${testfile}-main.cc
+set objfile1 ${testfile}-main.o
+set binfile ${testfile}
+
+if { [gdb_compile "$srcdir/$subdir/$srcfile0" "$objdir/$subdir/$objfile0" object {debug c++}] != "" } {
+ untested namespace-enum.exp
+ return -1
+}
+
+if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
+ untested namespace-enum.exp
+ return -1
+}
+
+if { [gdb_compile "$objdir/$subdir/$objfile0 $objdir/$subdir/$objfile1" "${binfile}" executable {debug c++}] != "" } {
+ untested namespace-enum.exp
+ return -1
+}
+
+clean_restart ${binfile}
+gdb_test "print foo::B::B_B" "`foo::B' is not defined as an aggregate type."
+gdb_test "print foo::B_B" "foo::B_B"
+gdb_test "print A_A" "A_A"
+
next prev parent reply other threads:[~2011-10-11 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 21:27 Sterling Augustine
2011-10-07 23:43 ` Keith Seitz
2011-10-08 0:46 ` Sterling Augustine
2011-10-10 22:21 ` Sterling Augustine
2011-10-11 17:07 ` Tom Tromey
2011-10-11 18:27 ` Sterling Augustine [this message]
2011-10-11 19:04 ` Tom Tromey
2011-10-12 9:21 ` [obv] Fix gdb.cp/namespace-enum.exp compilation [Re: Make DW_TAG_enumerator's consistent, regardless of containing scope] Jan Kratochvil
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=CAEG7qUxxHU2hXKCeNiSMceQfNSQhRdtzxxi+D6DV_hpf3w3GWA@mail.gmail.com \
--to=saugustine@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