1 # Copyright 2007, 2009, 2010 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 # When gdb resolves type information for class "derived" from objfile
17 # gdb2384, it use to fill in the TYPE_VPTR_BASETYPE field with class "base"
18 # from objfile gdb2384-base.so. When the program is rerun the type
19 # information for base-in-so-base.so is discarded leaving
20 # TYPE_VPTR_BASETYPE dangling.
28 if { [skip_cplus_tests] } { continue }
29 if { [skip_shlib_tests] } { continue }
31 set testfile "gdb2384"
32 set srcfile ${testfile}.cc
33 set binfile $objdir/$subdir/$testfile
35 set libfile "gdb2384-base"
36 set libsrcfile ${libfile}.cc
37 set sofile $objdir/$subdir/${libfile}.so
39 # Create and source the file that provides information about the compiler
40 # used to compile the test case.
41 if [get_compiler_info ${binfile} "c++"] {
45 if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++}] != ""
46 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} {
53 gdb_reinitialize_dir $srcdir/$subdir
55 gdb_load_shlibs ${sofile}
58 if ![runto_main] then {
59 perror "couldn't run to breakpoint"
63 gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
64 gdb_continue_to_breakpoint "set breakpoint here"
66 gdb_test "print d1.meth ()" \
70 # Now try again. gdb's without the fix will hopefully segv here
73 gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
74 gdb_continue_to_breakpoint "set breakpoint here"
75 gdb_test "print d1.meth ()" \
82 gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
83 gdb_continue_to_breakpoint "set breakpoint here (second)"
84 gdb_test "print d2.meth ()" \
89 gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
90 gdb_continue_to_breakpoint "set breakpoint here (second)"
91 gdb_test "print d2.meth ()" \