1 # Copyright 2004, 2007 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 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@prep.ai.mit.edu
19 # Test resolving of an opaque type from the loaded shared library.
25 set testfile type-opaque-main
26 set libfile type-opaque-lib
27 set srcfile ${testfile}.c
28 set binfile ${objdir}/${subdir}/${testfile}
30 set libsrc "${srcdir}/${subdir}/${libfile}.c"
31 set libobj "${objdir}/${subdir}/${libfile}.so"
32 set execsrc "${srcdir}/${subdir}/${srcfile}"
34 remote_exec build "rm -f ${binfile}"
36 # Are we on a target board? No support for downloading shared libraries
42 # get the value of gcc_compiled
43 if [get_compiler_info ${binfile}] {
47 if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
48 || [gdb_compile $execsrc ${binfile} executable \
49 [list debug shlib=${libobj}]] != "" } {
55 gdb_reinitialize_dir $srcdir/$subdir
58 if ![runto_main] then {
59 fail "Can't run to main"
64 # DWARF3: An incomplete structure, union or class type is represented by
65 # a structure, union or class entry that does not have a byte size attribute
66 # and that has a DW_AT_declaration attribute.
69 proc body { struct } {
73 # <1><15f>: Abbrev Number: 8 (DW_TAG_structure_type)
74 # DW_AT_name : libtype_opaque
75 # DW_AT_declaration : 1
77 set name "opaque $struct type resolving"
78 gdb_test_multiple "ptype pointer_${struct}_opaque" $name \
80 -re "libfield_opaque.*$gdb_prompt $" {
86 # <1><9e>: Abbrev Number: 2 (DW_TAG_structure_type)
87 # DW_AT_name : libtype_empty
90 # DW_AT_decl_line : 25
92 set name "empty $struct type resolving"
93 gdb_test_multiple "ptype pointer_${struct}_empty" $name \
95 -re "\\{\[ \t\r\n\]*<no data fields>\[ \t\r\n\]*\\}.*$gdb_prompt $" {
98 -re "libfield_empty.*$gdb_prompt $" {
104 # <1><b0>: Abbrev Number: 3 (DW_TAG_structure_type)
105 # DW_AT_sibling : <e3>
106 # DW_AT_name : libtype_filled
107 # DW_AT_byte_size : 4
108 # DW_AT_decl_file : 1
109 # DW_AT_decl_line : 29
110 # <2><c7>: Abbrev Number: 4 (DW_TAG_member)
111 # DW_AT_name : mainfield_filled
112 # DW_AT_decl_file : 1
113 # DW_AT_decl_line : 30
115 # DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
117 set name "filled $struct type resolving"
118 gdb_test_multiple "ptype pointer_${struct}_filled" $name \
120 -re "mainfield_filled.*$gdb_prompt $" {
123 -re "libfield_filled.*$gdb_prompt $" {