2018-01-01 05:43:02 +01:00
|
|
|
# Copyright 2004-2018 Free Software Foundation, Inc.
|
2007-04-11 18:03:59 +02:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-08-23 20:14:19 +02:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2007-04-11 18:03:59 +02:00
|
|
|
# (at your option) any later version.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
2007-04-11 18:03:59 +02:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2007-08-23 20:14:19 +02:00
|
|
|
#
|
2007-04-11 18:03:59 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 20:14:19 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2007-04-11 18:03:59 +02:00
|
|
|
|
|
|
|
# Test resolving of an opaque type from the loaded shared library.
|
|
|
|
|
2012-10-19 09:36:19 +02:00
|
|
|
if {[skip_shlib_tests]} {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
standard_testfile type-opaque-main.c
|
2007-04-11 18:03:59 +02:00
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
set libfile type-opaque-lib
|
2007-04-11 18:03:59 +02:00
|
|
|
set libsrc "${srcdir}/${subdir}/${libfile}.c"
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
set libobj [standard_output_file ${libfile}.so]
|
2007-04-11 18:03:59 +02:00
|
|
|
set execsrc "${srcdir}/${subdir}/${srcfile}"
|
|
|
|
|
|
|
|
remote_exec build "rm -f ${binfile}"
|
|
|
|
|
|
|
|
# get the value of gcc_compiled
|
2012-06-21 22:46:25 +02:00
|
|
|
if [get_compiler_info] {
|
2007-04-11 18:03:59 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
|
|
|
|
|| [gdb_compile $execsrc ${binfile} executable \
|
|
|
|
[list debug shlib=${libobj}]] != "" } {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
clean_restart ${binfile}
|
2016-04-28 00:08:59 +02:00
|
|
|
gdb_load_shlib ${libobj}
|
2007-04-11 18:03:59 +02:00
|
|
|
|
|
|
|
if ![runto_main] then {
|
2016-12-01 21:40:05 +01:00
|
|
|
fail "can't run to main"
|
2007-04-11 18:03:59 +02:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# DWARF3: An incomplete structure, union or class type is represented by
|
|
|
|
# a structure, union or class entry that does not have a byte size attribute
|
|
|
|
# and that has a DW_AT_declaration attribute.
|
|
|
|
|
|
|
|
|
|
|
|
proc body { struct } {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
|
|
|
|
# <1><15f>: Abbrev Number: 8 (DW_TAG_structure_type)
|
|
|
|
# DW_AT_name : libtype_opaque
|
|
|
|
# DW_AT_declaration : 1
|
|
|
|
|
|
|
|
set name "opaque $struct type resolving"
|
|
|
|
gdb_test_multiple "ptype pointer_${struct}_opaque" $name \
|
|
|
|
{
|
|
|
|
-re "libfield_opaque.*$gdb_prompt $" {
|
|
|
|
pass $name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# <1><9e>: Abbrev Number: 2 (DW_TAG_structure_type)
|
|
|
|
# DW_AT_name : libtype_empty
|
|
|
|
# DW_AT_byte_size : 0
|
|
|
|
# DW_AT_decl_file : 1
|
|
|
|
# DW_AT_decl_line : 25
|
|
|
|
|
|
|
|
set name "empty $struct type resolving"
|
|
|
|
gdb_test_multiple "ptype pointer_${struct}_empty" $name \
|
|
|
|
{
|
|
|
|
-re "\\{\[ \t\r\n\]*<no data fields>\[ \t\r\n\]*\\}.*$gdb_prompt $" {
|
|
|
|
pass $name
|
|
|
|
}
|
|
|
|
-re "libfield_empty.*$gdb_prompt $" {
|
|
|
|
fail $name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# <1><b0>: Abbrev Number: 3 (DW_TAG_structure_type)
|
|
|
|
# DW_AT_sibling : <e3>
|
|
|
|
# DW_AT_name : libtype_filled
|
|
|
|
# DW_AT_byte_size : 4
|
|
|
|
# DW_AT_decl_file : 1
|
|
|
|
# DW_AT_decl_line : 29
|
|
|
|
# <2><c7>: Abbrev Number: 4 (DW_TAG_member)
|
|
|
|
# DW_AT_name : mainfield_filled
|
|
|
|
# DW_AT_decl_file : 1
|
|
|
|
# DW_AT_decl_line : 30
|
|
|
|
# DW_AT_type : <e3>
|
|
|
|
# DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
|
|
|
|
|
|
|
|
set name "filled $struct type resolving"
|
|
|
|
gdb_test_multiple "ptype pointer_${struct}_filled" $name \
|
|
|
|
{
|
|
|
|
-re "mainfield_filled.*$gdb_prompt $" {
|
|
|
|
pass $name
|
|
|
|
}
|
|
|
|
-re "libfield_filled.*$gdb_prompt $" {
|
|
|
|
fail $name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body struct
|
|
|
|
body union
|