This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] make sure debug info is output in gdb.cp/namespace.exp


Currently, gdb.cp/namespace.exp has lots of failures with GCC 3.4.  I
have a patch awaiting approval that fixed most of them, but a few
mysterious ones (related to printing out types of classes) remained.
It turns out that those tests involved classes that were never
actually used in the .cc files, so GCC (reasonably) decided not to
emit debug info for those classes.

So this patch generates references to those classes, so that the
proper debug info is generated.  With this patch in place and with my
dwarf2read.c patch that is awaiting approval applied, namespace.exp
passes with GCC 3.4.

Committed,
David Carlton
carlton@kealia.com

2004-01-23  David Carlton  <carlton@kealia.com>

	* gdb.cp/namespace.cc (C::ensureRefs): New.
	* gdb.cp/namespace1.cc (C::ensureOtherRefs): New.

Index: namespace.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/namespace.cc,v
retrieving revision 1.3
diff -u -p -r1.3 namespace.cc
--- namespace.cc	14 Jan 2004 16:54:42 -0000	1.3
+++ namespace.cc	23 Jan 2004 21:50:40 -0000
@@ -97,6 +97,13 @@ namespace C
     };
   };
 
+  void ensureRefs () {
+    // NOTE (2004-04-23, carlton): This function is here only to make
+    // sure that GCC 3.4 outputs debug info for these classes.
+    static CClass *c = new CClass();
+    static CClass::NestedClass *n = new CClass::NestedClass();
+  }
+
   namespace
   {
     int cX = 6;
Index: namespace1.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/namespace1.cc,v
retrieving revision 1.2
diff -u -p -r1.2 namespace1.cc
--- namespace1.cc	14 Jan 2004 16:54:43 -0000	1.2
+++ namespace1.cc	23 Jan 2004 21:50:44 -0000
@@ -24,6 +24,12 @@ namespace C
     int z;
   };
 
+  void ensureOtherRefs () {
+    // NOTE (2004-04-23, carlton): This function is here only to make
+    // sure that GCC 3.4 outputs debug info for this class.
+    static OtherFileClass *c = new OtherFileClass();
+  }
+
   namespace {
     int cXOtherFile = 29;
   };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]