]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2007-2024 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 | |
d6195dc9 | 24 | require allow_cplus_tests allow_shlib_tests |
81fe8080 | 25 | |
f5f3a911 | 26 | standard_testfile .cc gdb2384-base.cc |
81fe8080 | 27 | |
722c4596 TV |
28 | include_file gdb2384-base.h |
29 | ||
f5f3a911 | 30 | set sofile [standard_output_file gdb2384-base.so] |
81fe8080 | 31 | |
f5f3a911 | 32 | if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $sofile {debug c++}] != "" |
81fe8080 | 33 | || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} { |
84c93cd5 | 34 | untested "failed to compile" |
81fe8080 DE |
35 | return -1 |
36 | } | |
37 | ||
f5f3a911 | 38 | clean_restart ${binfile} |
d9019901 | 39 | gdb_load_shlib ${sofile} |
81fe8080 | 40 | |
4fc5b208 | 41 | |
95701cae | 42 | if {![runto_main]} { |
4fc5b208 | 43 | return -1 |
81fe8080 DE |
44 | } |
45 | ||
6e892297 AB |
46 | gdb_breakpoint [gdb_get_line_number "First breakpoint"] |
47 | gdb_continue_to_breakpoint "run to 'First breakpoint', first time" | |
4fc5b208 PP |
48 | |
49 | gdb_test "print d1.meth ()" \ | |
e96ec2ba | 50 | ".*42.*" |
81fe8080 DE |
51 | |
52 | # Now try again. gdb's without the fix will hopefully segv here | |
53 | ||
4fc5b208 | 54 | runto_main |
6e892297 AB |
55 | gdb_breakpoint [gdb_get_line_number "First breakpoint"] |
56 | gdb_continue_to_breakpoint "run to 'First breakpoint', second time" | |
4fc5b208 | 57 | gdb_test "print d1.meth ()" \ |
81fe8080 | 58 | ".*42.*" \ |
6e892297 | 59 | "gdb2384 at 'First breakpoint'" |
4fc5b208 PP |
60 | |
61 | # second case | |
62 | ||
63 | runto_main | |
6e892297 AB |
64 | gdb_breakpoint [gdb_get_line_number "Second breakpoint"] |
65 | gdb_continue_to_breakpoint "run to 'Second breakpoint', first time" | |
4fc5b208 PP |
66 | gdb_test "print d2.meth ()" \ |
67 | ".*24.*" \ | |
68 | "print d2.meth()" | |
69 | ||
70 | runto_main | |
6e892297 AB |
71 | gdb_breakpoint [gdb_get_line_number "Second breakpoint"] |
72 | gdb_continue_to_breakpoint "run to 'Second breakpoint', second time" | |
4fc5b208 PP |
73 | gdb_test "print d2.meth ()" \ |
74 | ".*24.*" \ | |
6e892297 | 75 | "gdb2384 at 'Second breakpoint'" |
4fc5b208 | 76 |