From 907af001f77f9dee04ecb77a6cb0d21a55850033 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 26 Mar 2010 18:05:46 +0000 Subject: ChangeLog: * dwarf2read.c (dwarf2_name): Work around GCC bugzilla debug/41828 by ignoring spurious DW_AT_name attributes for unnamed structs or unions. * completer.c (add_struct_fields): Fix inverted logic. testsuite/ChangeLog: * gdb.cp/inherit.exp (test_ptype_si): XFAIL test for GCC versions that do not provide the tagless_struct type name at all. (test_print_anon_union): Do not check value of uninitialized union member. Do not use cp_test_ptype_class, so we can accept "long" as well as "long int". --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.cp/inherit.exp | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 08946f3..d506e1a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-03-26 Ulrich Weigand + + * gdb.cp/inherit.exp (test_ptype_si): XFAIL test for GCC versions + that do not provide the tagless_struct type name at all. + (test_print_anon_union): Do not check value of uninitialized + union member. Do not use cp_test_ptype_class, so we can accept + "long" as well as "long int". + 2010-03-26 Pedro Alves * gdb.trace/tfile.c (tohex, bin2hex): New. diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index b3bfea2..a593bc6 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -114,6 +114,11 @@ proc test_ptype_si { } { # gcc 3.4.1 -gstabs+ pass "$name" } + -re "No symbol \"tagless_struct\" in current context.$nl$gdb_prompt $" { + # Several GCC 4.x versions provide neither a DW_TAG_typedef DIE + # nor use the typedef name as struct tag name. + xfail "$name" + } } set name "ptype variable of type tagless struct" @@ -490,25 +495,20 @@ proc test_print_anon_union {} { set name "print variable of type anonymous union" gdb_test_multiple "print g_anon_union" $name { - -re "$vhn = \{one = 1, \{a = 2, b = 2\}\}$nl$gdb_prompt $" { + -re "$vhn = \{one = 1, \{a = 2, b = \[0-9\]+\}\}$nl$gdb_prompt $" { pass $name } } - # The nested union prints as a multi-line field, but the class body - # scanner is inherently line-oriented. This is ugly but it works. - - cp_test_ptype_class \ - "ptype g_anon_union" "print type of anonymous union" \ - "class" "class_with_anon_union" \ - { - { field public "int one;" } - { field public "union \{" } - { field public "int a;" } - { field public "long int b;" } - { field public "\};" } + set name "print type of anonymous union" + set re_tag "class_with_anon_union" + set re_class "(class $re_tag \{${ws}public:|struct $re_tag\{)" + set re_fields "int one;${ws}union \{${ws}int a;${ws}long( int)? b;${ws}\};" + gdb_test_multiple "ptype g_anon_union" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - + } } -- cgit v1.1