1 # Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 # Test resolving of an opaque type from the loaded shared library.
22 set testfile type-opaque-main
23 set libfile type-opaque-lib
24 set srcfile ${testfile}.c
25 set binfile ${objdir}/${subdir}/${testfile}
27 set libsrc "${srcdir}/${subdir}/${libfile}.c"
28 set libobj "${objdir}/${subdir}/${libfile}.so"
29 set execsrc "${srcdir}/${subdir}/${srcfile}"
31 remote_exec build "rm -f ${binfile}"
33 # Are we on a target board? No support for downloading shared libraries
39 # get the value of gcc_compiled
40 if [get_compiler_info ${binfile}] {
44 if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
45 || [gdb_compile $execsrc ${binfile} executable \
46 [list debug shlib=${libobj}]] != "" } {
52 gdb_reinitialize_dir $srcdir/$subdir
55 if ![runto_main] then {
56 fail "Can't run to main"
61 # DWARF3: An incomplete structure, union or class type is represented by
62 # a structure, union or class entry that does not have a byte size attribute
63 # and that has a DW_AT_declaration attribute.
66 proc body { struct } {
70 # <1><15f>: Abbrev Number: 8 (DW_TAG_structure_type)
71 # DW_AT_name : libtype_opaque
72 # DW_AT_declaration : 1
74 set name "opaque $struct type resolving"
75 gdb_test_multiple "ptype pointer_${struct}_opaque" $name \
77 -re "libfield_opaque.*$gdb_prompt $" {
83 # <1><9e>: Abbrev Number: 2 (DW_TAG_structure_type)
84 # DW_AT_name : libtype_empty
87 # DW_AT_decl_line : 25
89 set name "empty $struct type resolving"
90 gdb_test_multiple "ptype pointer_${struct}_empty" $name \
92 -re "\\{\[ \t\r\n\]*<no data fields>\[ \t\r\n\]*\\}.*$gdb_prompt $" {
95 -re "libfield_empty.*$gdb_prompt $" {
101 # <1><b0>: Abbrev Number: 3 (DW_TAG_structure_type)
102 # DW_AT_sibling : <e3>
103 # DW_AT_name : libtype_filled
104 # DW_AT_byte_size : 4
105 # DW_AT_decl_file : 1
106 # DW_AT_decl_line : 29
107 # <2><c7>: Abbrev Number: 4 (DW_TAG_member)
108 # DW_AT_name : mainfield_filled
109 # DW_AT_decl_file : 1
110 # DW_AT_decl_line : 30
112 # DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
114 set name "filled $struct type resolving"
115 gdb_test_multiple "ptype pointer_${struct}_filled" $name \
117 -re "mainfield_filled.*$gdb_prompt $" {
120 -re "libfield_filled.*$gdb_prompt $" {