From 85a20c42eacf836502c5dc0cc2afbd24666b2e86 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 1 Jul 2011 18:32:06 +0000 Subject: [PATCH] gdb/testsuite/ 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. --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.cp/temargs.cc | 18 ++++++++++++++++++ gdb/testsuite/gdb.cp/temargs.exp | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 00a7a45a33..e0c4a0ab16 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-07-01 Jan Kratochvil + + 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 * gdb.ada/packed_array.exp: Fix expected outout. diff --git a/gdb/testsuite/gdb.cp/temargs.cc b/gdb/testsuite/gdb.cp/temargs.cc index b7abef76dc..10e2efd3e6 100644 --- a/gdb/testsuite/gdb.cp/temargs.cc +++ b/gdb/testsuite/gdb.cp/temargs.cc @@ -65,6 +65,21 @@ struct K2 } }; +// GCC PR debug/49546 +struct S3 +{ + static void m (int x) {} +}; +template +// or: template +struct K3 +{ + void k3_m () + { + F (0); // Breakpoint 6. + } +}; + int main () { Base base; @@ -72,12 +87,15 @@ int main () // That would be worth testing, once g++ is fixed. Base::Inner inner; K2<&S::somefunc> k2; + K3<&S3::m> k3; +// or: K3 k3; base.base_m (); inner.inner_m (); func (); base.templ_m (); k2.k2_m (); + k3.k3_m (); return 0; } diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp index 9774138a8e..85f01d92d9 100644 --- a/gdb/testsuite/gdb.cp/temargs.exp +++ b/gdb/testsuite/gdb.cp/temargs.exp @@ -75,6 +75,10 @@ set line [gdb_get_line_number "Breakpoint 5" $srcfile] 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 @@ gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \ 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]+ } \ + "test value of F in k3_m"