Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2007-2015 Free Software Foundation, Inc. |
81fe8080 DE |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
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. | |
02e7ea18 JB |
21 | # |
22 | # PR c++/9489. | |
81fe8080 | 23 | |
81fe8080 DE |
24 | if { [skip_cplus_tests] } { continue } |
25 | if { [skip_shlib_tests] } { continue } | |
26 | ||
f5f3a911 | 27 | standard_testfile .cc gdb2384-base.cc |
81fe8080 | 28 | |
f5f3a911 | 29 | set sofile [standard_output_file gdb2384-base.so] |
81fe8080 DE |
30 | |
31 | # Create and source the file that provides information about the compiler | |
32 | # used to compile the test case. | |
4c93b1db | 33 | if [get_compiler_info "c++"] { |
81fe8080 DE |
34 | return -1 |
35 | } | |
36 | ||
f5f3a911 | 37 | if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $sofile {debug c++}] != "" |
81fe8080 DE |
38 | || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} { |
39 | untested gdb2384.exp | |
40 | return -1 | |
41 | } | |
42 | ||
f5f3a911 | 43 | clean_restart ${binfile} |
81fe8080 DE |
44 | gdb_load_shlibs ${sofile} |
45 | ||
4fc5b208 PP |
46 | |
47 | if ![runto_main] then { | |
48 | perror "couldn't run to breakpoint" | |
49 | return -1 | |
81fe8080 DE |
50 | } |
51 | ||
4fc5b208 PP |
52 | gdb_breakpoint [gdb_get_line_number "set breakpoint here"] |
53 | gdb_continue_to_breakpoint "set breakpoint here" | |
54 | ||
55 | gdb_test "print d1.meth ()" \ | |
81fe8080 | 56 | ".*42.*" \ |
4fc5b208 | 57 | "print d1.meth ()" |
81fe8080 DE |
58 | |
59 | # Now try again. gdb's without the fix will hopefully segv here | |
60 | ||
4fc5b208 PP |
61 | runto_main |
62 | gdb_breakpoint [gdb_get_line_number "set breakpoint here"] | |
63 | gdb_continue_to_breakpoint "set breakpoint here" | |
64 | gdb_test "print d1.meth ()" \ | |
81fe8080 DE |
65 | ".*42.*" \ |
66 | "gdb2384" | |
4fc5b208 PP |
67 | |
68 | # second case | |
69 | ||
70 | runto_main | |
71 | gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"] | |
72 | gdb_continue_to_breakpoint "set breakpoint here (second)" | |
73 | gdb_test "print d2.meth ()" \ | |
74 | ".*24.*" \ | |
75 | "print d2.meth()" | |
76 | ||
77 | runto_main | |
78 | gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"] | |
79 | gdb_continue_to_breakpoint "set breakpoint here (second)" | |
80 | gdb_test "print d2.meth ()" \ | |
81 | ".*24.*" \ | |
82 | "gdb2384 (second)" | |
83 |