diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-06-28 20:39:30 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-06-28 20:39:30 +0000 |
commit | 98751a4113ee63e980f4a6fa199151f7da617f1f (patch) | |
tree | a3de7b1c5e376473639539d6b041b001f13f259e /gdb/testsuite | |
parent | 41f62f3939b1c69e68ef5652feb44fef90eb85c9 (diff) | |
download | gdb-98751a4113ee63e980f4a6fa199151f7da617f1f.zip gdb-98751a4113ee63e980f4a6fa199151f7da617f1f.tar.gz gdb-98751a4113ee63e980f4a6fa199151f7da617f1f.tar.bz2 |
gdb/
* c-typeprint.c (c_type_print_base): For no fields check include also
TYPE_TYPEDEF_FIELD_COUNT. Print new typedefs section.
* dwarf2read.c (struct typedef_field_list)
(struct field_info) <typedef_field_list, typedef_field_list_count>: New.
(dwarf2_add_typedef): New.
(read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
Copy also FI.TYPEDEF_FIELD_LIST.
* gdbtypes.h (struct typedef_field)
(struct cplus_struct_type) <typedef_field, typedef_field_count>
(TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
(TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
gdb/testsuite/
* gdb.cp/namespace.exp (ptype OtherFileClass typedefs)
(ptype ::C::OtherFileClass typedefs): New.
* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType2)
(C::OtherFileClass::cOtherFileClassVar2): New.
(C::OtherFileClass::cOtherFileClassVar_use): Use also
cOtherFileClassVar2.
(C::cOtherFileType2, C::cOtherFileVar2): New.
(C::cOtherFileVar_use): use also cOtherFileVar2.
* gdb.cp/userdef.exp (ptype &*c): Permit arbitrary trailing text.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/namespace.exp | 15 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/namespace1.cc | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.exp | 2 |
4 files changed, 34 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9f89500..dd618c9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,17 @@ 2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com> + * gdb.cp/namespace.exp (ptype OtherFileClass typedefs) + (ptype ::C::OtherFileClass typedefs): New. + * gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType2) + (C::OtherFileClass::cOtherFileClassVar2): New. + (C::OtherFileClass::cOtherFileClassVar_use): Use also + cOtherFileClassVar2. + (C::cOtherFileType2, C::cOtherFileVar2): New. + (C::cOtherFileVar_use): use also cOtherFileVar2. + * gdb.cp/userdef.exp (ptype &*c): Permit arbitrary trailing text. + +2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com> + * gdb.cp/namespace.exp (whatis C::cOtherFileType) (whatis ::C::cOtherFileType, whatis C::cOtherFileVar) (whatis ::C::cOtherFileVar, print C::cOtherFileVar) diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index 452dcdc..1eae62f 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -268,6 +268,21 @@ gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public: gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n public:\r\n int z;\r\n.*\}" gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"." +# Test class typedefs printing. +set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}" +if {[test_compiler_info {gcc-[0-3]-*}] + || [test_compiler_info {gcc-4-[0-4]-*}]} { + # The type in class is missing in older GCCs. + setup_xfail *-*-* +} +gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs" +if {[test_compiler_info {gcc-[0-3]-*}] + || [test_compiler_info {gcc-4-[0-4]-*}]} { + # The type in class is missing in older GCCs. + setup_xfail *-*-* +} +gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs" + # Some anonymous namespace tests. gdb_test "print cX" "\\$\[0-9\].* = 6" diff --git a/gdb/testsuite/gdb.cp/namespace1.cc b/gdb/testsuite/gdb.cp/namespace1.cc index 928e357..aad55e5 100644 --- a/gdb/testsuite/gdb.cp/namespace1.cc +++ b/gdb/testsuite/gdb.cp/namespace1.cc @@ -23,12 +23,14 @@ namespace C int z; typedef short cOtherFileClassType; + typedef long cOtherFileClassType2; static const cOtherFileClassType cOtherFileClassVar = 318; + static const cOtherFileClassType2 cOtherFileClassVar2 = 320; cOtherFileClassType cOtherFileClassVar_use (); }; OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use () { - return cOtherFileClassVar; + return cOtherFileClassVar + cOtherFileClassVar2; } namespace { @@ -45,10 +47,12 @@ namespace C } typedef short cOtherFileType; + typedef long cOtherFileType2; static const cOtherFileType cOtherFileVar = 319; + static const cOtherFileType2 cOtherFileVar2 = 321; cOtherFileType cOtherFileVar_use () { - return cOtherFileVar; + return cOtherFileVar + cOtherFileVar2; } } diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 1a6fd2e..050775a 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -148,7 +148,7 @@ gdb_test "break A2::'operator +'" ".*Breakpoint $decimal at.*" gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}" gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}" gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex" -gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*" +gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\].*} &\\*" gdb_test "print operator== (mem1, mem2)" " = false" gdb_test "print operator== (mem1, mem1)" " = true" |