Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Make DW_TAG_enumerator's consistent, regardless of containing scope
@ 2011-10-07 21:27 Sterling Augustine
  2011-10-07 23:43 ` Keith Seitz
  2011-10-10 22:21 ` Sterling Augustine
  0 siblings, 2 replies; 8+ messages in thread
From: Sterling Augustine @ 2011-10-07 21:27 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]

This patch fixes the issue described in
http://sourceware.org/ml/gdb/2011-09/msg00119.html. To recap, consider
the testcase below. Dividing the namespace definition into two
compilation units and their order on the command-line is essential to
see the problem.

enum0_main.cc:

namespace foo { }

int main() { return 0; }

enum0.cc:

namespace foo {
enum B {  B_B };

enum B b = B_B;
};

saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace
saugustine@sterling$ gdb ./enum-namespace
GNU gdb (GDB) 7.3.50.20111007-cvs
...
(gdb) p foo::B_B
No symbol "B_B" in namespace "foo".
(gdb) p foo::B::B_B
`foo::B' is not defined as an aggregate type.

GDB puts this definition into the partial symbol table as foo::B::B_B,
but it should be foo::B_B.

After partial symbols have been converted to full symbols, the
enum-type is not be included as part of the enumerator's scope.

The enclosed patch fixes the situation dropping the enum-type name for
all enumerators. The original code was commented that it should do
that, but didn't work because it was looking at the enumerator die's
parent die, rather than the enumerator die itself.

The file split in the test case is required to avoid reading all of
namespace foo's symbols in the intermediate symbol lookup.

OK to commit?

Sterling

2011-10-07  Sterling Augustine  <saugustine@google.com>

	* dwarf2read.c (partial_die_parent_scope): Rearrange conditional logic.

[-- Attachment #2: enumerator-patch --]
[-- Type: application/octet-stream, Size: 1030 bytes --]

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.561
diff -d -u -r1.561 dwarf2read.c
--- dwarf2read.c	13 Sep 2011 21:44:27 -0000	1.561
+++ dwarf2read.c	7 Oct 2011 17:51:52 -0000
@@ -3878,7 +3878,10 @@
       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
@@ -3893,9 +3896,6 @@
 					 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

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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-07 21:27 Make DW_TAG_enumerator's consistent, regardless of containing scope Sterling Augustine
@ 2011-10-07 23:43 ` Keith Seitz
  2011-10-08  0:46   ` Sterling Augustine
  2011-10-10 22:21 ` Sterling Augustine
  1 sibling, 1 reply; 8+ messages in thread
From: Keith Seitz @ 2011-10-07 23:43 UTC (permalink / raw)
  To: Sterling Augustine; +Cc: gdb-patches

On 10/07/2011 02:26 PM, Sterling Augustine wrote:
> saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace
> saugustine@sterling$ gdb ./enum-namespace
> GNU gdb (GDB) 7.3.50.20111007-cvs
> ...
> (gdb) p foo::B_B
> No symbol "B_B" in namespace "foo".
> (gdb) p foo::B::B_B
> `foo::B' is not defined as an aggregate type.

First things first: this is going to need a test case.

I've tried to reproduce this, but I cannot seem to replicate using your 
instructions:

$ cat > enum0_main.cc << EOF
 > namespace foo { }
 > int main () { return 0; }
 > EOF
$ cat > enum0.cc << EOF
 > namespace foo {
 >   enum B {  B_B };
 >   enum B b = B_B;
 > };
 > EOF
$ g++ -g enum0*.cc -o enum; popd
$ ./gdb -v
GNU gdb (GDB) 7.3.50.20111005-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/keiths/tmp/enum...done.
(gdb) p foo::B_B
$1 = foo::B_B

Although this appears to work, your patch looks correct to me. If I 
inspect the partial die names and the physnames, they do differ 
(foo::B::B_B vs foo::B_B), and clearly foo::B::B_B is incorrect, since 
enum B_B is of the unscoped variety.

I would also not expect to see any child dies for DW_TAG_enumerator, so 
I agree that testing parent_die->tag == DW_TAG_enumerator doesn't make 
sense.

IMO, I would recommend that a maintainer accept this patch (with a test 
case).

Aside: If support is added for scoped enumerations, this will need 
modifying -- the original behavior is correct in that case (but still 
not for unscoped enums). dwarf2_compute_name will also need fixing. :-)]

Keith


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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-07 23:43 ` Keith Seitz
@ 2011-10-08  0:46   ` Sterling Augustine
  0 siblings, 0 replies; 8+ messages in thread
From: Sterling Augustine @ 2011-10-08  0:46 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

On Fri, Oct 7, 2011 at 4:42 PM, Keith Seitz <keiths@redhat.com> wrote:
> On 10/07/2011 02:26 PM, Sterling Augustine wrote:
>>
>> saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace
>> saugustine@sterling$ gdb ./enum-namespace
>> GNU gdb (GDB) 7.3.50.20111007-cvs
>> ...
>> (gdb) p foo::B_B
>> No symbol "B_B" in namespace "foo".
>> (gdb) p foo::B::B_B
>> `foo::B' is not defined as an aggregate type.
>
> First things first: this is going to need a test case.

I'll write one this weekend.

> I've tried to reproduce this, but I cannot seem to replicate using your
> instructions:
....

> $ g++ -g enum0*.cc -o enum; popd

Try it without the wildcard. The shell can glob enum0.cc before
enum0_main.cc, but the test-case needs enum0_main.cc first on gcc's
command line.

The order matters because when the namespace foo gets looked up in the
partial symbol table, GDB builds the full-symbol table, and the full
symbol table has it right. If gdb finds enum0.cc's copy of the
namespace foo die first, then when it converts that CU's psymtab to a
full symtab, the enum's correct name will be created and you won't see
the problem.

However, if gdb find's enum0_main.cc's namespace foo die first, then
the conversion to the full psymtab won't create one for the enum.

This hints to me--but I'm not sure--that some kind of special handling
for namespace dies would be appropriate, because they can appear in
multiple CU's. But that is beyond the present issue.

This

Sterling


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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-07 21:27 Make DW_TAG_enumerator's consistent, regardless of containing scope Sterling Augustine
  2011-10-07 23:43 ` Keith Seitz
@ 2011-10-10 22:21 ` Sterling Augustine
  2011-10-11 17:07   ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Sterling Augustine @ 2011-10-10 22:21 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

On Fri, Oct 7, 2011 at 4:42 PM, Keith Seitz <keiths@redhat.com> wrote:
> On 10/07/2011 02:26 PM, Sterling Augustine wrote:
>>
>> saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace
>> saugustine@sterling$ gdb ./enum-namespace
>> GNU gdb (GDB) 7.3.50.20111007-cvs
>> ...
>> (gdb) p foo::B_B
>> No symbol "B_B" in namespace "foo".
>> (gdb) p foo::B::B_B
>> `foo::B' is not defined as an aggregate type.
>
> First things first: this is going to need a test case.

Enclosed please find the same patch, only this time with a test case.

> I've tried to reproduce this, but I cannot seem to replicate using your
> instructions:
>

To recap: be sure to compile it like so:

g++ namespace-enum-main.cc namespace-enum.cc -g

The order of the source files matters.

OK to commit?

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: 5156 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	10 Oct 2011 21:33:09 -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	10 Oct 2011 21:33:14 -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	10 Oct 2011 21:33:14 -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	10 Oct 2011 21:33:14 -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	10 Oct 2011 21:33:14 -0000
@@ -0,0 +1,49 @@
+# 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 ${objdir}/${subdir}/${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
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${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"
+

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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-10 22:21 ` Sterling Augustine
@ 2011-10-11 17:07   ` Tom Tromey
  2011-10-11 18:27     ` Sterling Augustine
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2011-10-11 17:07 UTC (permalink / raw)
  To: Sterling Augustine; +Cc: gdb-patches

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

Sterling> +if [get_compiler_info ${binfile} "c++"] {
Sterling> +    return -1
Sterling> +}

Does this really do anything?
(I don't know.)

Sterling> +gdb_exit
Sterling> +gdb_start
Sterling> +gdb_reinitialize_dir $srcdir/$subdir
Sterling> +gdb_load ${binfile}

This stanza can be replaced by clean_restart.

Tom


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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-11 17:07   ` Tom Tromey
@ 2011-10-11 18:27     ` Sterling Augustine
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Sterling Augustine @ 2011-10-11 18:27 UTC (permalink / raw)
  To: gdb-patches

[-- 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"
+

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

* Re: Make DW_TAG_enumerator's consistent, regardless of containing scope
  2011-10-11 18:27     ` Sterling Augustine
@ 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
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2011-10-11 19:04 UTC (permalink / raw)
  To: Sterling Augustine; +Cc: gdb-patches

>>>>> "Sterling" == Sterling Augustine <saugustine@google.com> writes:

Sterling> Updated patch attached.

This is ok, thanks.

Tom


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

* [obv] Fix gdb.cp/namespace-enum.exp compilation  [Re: Make DW_TAG_enumerator's consistent, regardless of containing scope]
  2011-10-11 18:27     ` Sterling Augustine
  2011-10-11 19:04       ` Tom Tromey
@ 2011-10-12  9:21       ` Jan Kratochvil
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Kratochvil @ 2011-10-12  9:21 UTC (permalink / raw)
  To: Sterling Augustine; +Cc: gdb-patches

On Tue, 11 Oct 2011 20:27:33 +0200, Sterling Augustine wrote:
> 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.

+Running gdb/testsuite/gdb.cp/namespace-enum.exp ...
+ERROR: (gdb/testsuite.unix.-m32/gdb.cp/namespace-enum) No such file or directory
+UNRESOLVED: gdb.cp/namespace-enum.exp: print foo::B::B_B
+FAIL: gdb.cp/namespace-enum.exp: print foo::B_B
+FAIL: gdb.cp/namespace-enum.exp: print A_A

There is a bit problem in the current testsuite framework some functions expect
the subdirectory prefix and some do not.

Checked in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-10/msg00098.html

--- src/gdb/testsuite/ChangeLog	2011/10/11 19:19:08	1.2893
+++ src/gdb/testsuite/ChangeLog	2011/10/12 09:19:41	1.2894
@@ -1,3 +1,9 @@
+2011-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.cp/namespace-enum.exp (executable): New variable.
+	(binfile): Use ${objdir}/${subdir}/ prefix.
+	Use ${executable} for clean_restart.
+
 2011-10-11  Sterling Augustine  <saugustine@google.com>
 
 	* gdb.cp/Makefile.in: Add namespace-enum test.
--- src/gdb/testsuite/gdb.cp/namespace-enum.exp	2011/10/11 19:19:08	1.1
+++ src/gdb/testsuite/gdb.cp/namespace-enum.exp	2011/10/12 09:19:42	1.2
@@ -18,7 +18,8 @@
 set objfile0 ${testfile}.o
 set srcfile1 ${testfile}-main.cc
 set objfile1 ${testfile}-main.o
-set binfile ${testfile}
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
 
 if  { [gdb_compile "$srcdir/$subdir/$srcfile0" "$objdir/$subdir/$objfile0" object {debug c++}] != "" } {
      untested namespace-enum.exp
@@ -35,7 +36,7 @@
      return -1
 }
 
-clean_restart ${binfile}
+clean_restart ${executable}
 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"


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

end of thread, other threads:[~2011-10-12  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 21:27 Make DW_TAG_enumerator's consistent, regardless of containing scope 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
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

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