This is the mail archive of the gdb-patches@sourceware.org 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]

[commit] gdb.cp/temargs.exp: New GCC PR debug/49546 test


Hi,

checked in.  Test:
	class DW_AT_name does not match method's linkage name prefix
	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49546

It currently PASSes with physname but going to XFAIL it by:
	Re: [patch] Follow DW_AT_linkage_name for methods #2
	http://sourceware.org/ml/gdb-patches/2011-06/msg00040.html

This is the only known regression of that DW_AT_linkage_name patch to me.
It is wrongly produced DWARF by GCC but sure GDB could workaround it.
I do not have a workaround at hand, I find the workaround either easy or nice
but never both.

So far I plan to just wait for a GCC fix, it should affect only pointers to
functions as template parameters which result in inaccessible template
types/values from GDB.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-07/msg00020.html

--- src/gdb/testsuite/ChangeLog	2011/07/01 18:27:25	1.2770
+++ src/gdb/testsuite/ChangeLog	2011/07/01 18:32:06	1.2771
@@ -1,3 +1,11 @@
+2011-07-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Test GCC PR debug/49546.
+	* gdb.cp/temargs.exp (set sixth breakpoint for temargs)
+	(test type of F in k3_m, test value of F in k3_m): New.
+	* gdb.cp/temargs.cc (struct S3, struct K3): New.
+	(main): New variable k3.  Call k3.k3_m.
+
 2011-07-01  Jean-Charles Delay  <delay@adacore.com>
 
 	* gdb.ada/packed_array.exp: Fix expected outout.
--- src/gdb/testsuite/gdb.cp/temargs.cc	2011/06/10 16:21:47	1.3
+++ src/gdb/testsuite/gdb.cp/temargs.cc	2011/07/01 18:32:06	1.4
@@ -65,6 +65,21 @@
   }
 };
 
+// GCC PR debug/49546
+struct S3
+{
+  static void m (int x) {}
+};
+template <void (*F) (int)>
+// or: template <void (F) (int)>
+struct K3
+{
+  void k3_m ()
+  {
+    F (0);	// Breakpoint 6.
+  }
+};
+
 int main ()
 {
   Base<double, 23, &a_global, &S::f> base;
@@ -72,12 +87,15 @@
   // That would be worth testing, once g++ is fixed.
   Base<long, 47, &a_global, &S::f>::Inner<float> inner;
   K2<&S::somefunc> k2;
+  K3<&S3::m> k3;
+// or: K3<S3::m> k3;
 
   base.base_m ();
   inner.inner_m ();
   func<unsigned char, 91, &a_global, &S::f> ();
   base.templ_m<short> ();
   k2.k2_m ();
+  k3.k3_m ();
 
   return 0;
 }
--- src/gdb/testsuite/gdb.cp/temargs.exp	2011/06/10 16:21:47	1.4
+++ src/gdb/testsuite/gdb.cp/temargs.exp	2011/07/01 18:32:06	1.5
@@ -75,6 +75,10 @@
 gdb_test "break $srcfile:$line" "Breakpoint 6.*" \
     "set fifth breakpoint for temargs"
 
+set line [gdb_get_line_number "Breakpoint 6" $srcfile]
+gdb_test "break $srcfile:$line" "Breakpoint 7.*" \
+    "set sixth breakpoint for temargs"
+
 #
 # Tests in Base::base_m.
 #
@@ -166,3 +170,19 @@
 
 setup_kfail gcc/49366 "*-*-*"
 gdb_test "print F" "&S::somefunc" "test value of F in k2_m"
+
+#
+# Tests in K3::k3_m, GCC PR debug/49546.
+# The problem reproduces with DW_AT_MIPS_linkage_name.  It does not happen with
+# GDB physname - GDB's own computation of the linkage name based on
+# (incorrectly output by GCC) DW_AT_name.
+#
+
+gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
+
+if $have_older_template_gcc { setup_xfail "*-*-*" }
+gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
+
+if $have_older_template_gcc { setup_xfail "*-*-*" }
+gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
+	 "test value of F in k3_m"


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