* gdb.base/annota1.exp: Accept printf@... in place of printf.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / gdb2384.exp
1 # Copyright 2007 Free Software Foundation, Inc.
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.
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 if { [skip_cplus_tests] } { continue }
27 if { [skip_shlib_tests] } { continue }
28
29 set prms_id 2384
30 set bug_id 0
31
32 set testfile "gdb2384"
33 set srcfile ${testfile}.cc
34 set binfile $objdir/$subdir/$testfile
35
36 set libfile "gdb2384-base"
37 set libsrcfile ${libfile}.cc
38 set sofile $objdir/$subdir/${libfile}.so
39
40 # Create and source the file that provides information about the compiler
41 # used to compile the test case.
42 if [get_compiler_info ${binfile} "c++"] {
43 return -1
44 }
45
46 if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++}] != ""
47 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} {
48 untested gdb2384.exp
49 return -1
50 }
51
52 gdb_exit
53 gdb_start
54 gdb_reinitialize_dir $srcdir/$subdir
55 gdb_load ${binfile}
56 gdb_load_shlibs ${sofile}
57
58 set bp_location [gdb_get_line_number "set breakpoint here"]
59
60 # Set a breakpoint with multiple locations.
61
62 gdb_test "break $srcfile:$bp_location" \
63 "Breakpoint.*at.* file .*$srcfile, line.*" \
64 "set breakpoint"
65
66 gdb_run_cmd
67 gdb_expect {
68 -re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
69 pass "run to breakpoint"
70 }
71 -re "$gdb_prompt $" {
72 fail "run to breakpoint"
73 }
74 timeout {
75 fail "run to breakpoint (timeout)"
76 }
77 }
78
79 gdb_test "print d.meth ()" \
80 ".*42.*" \
81 "print d.meth ()"
82
83 # Now try again. gdb's without the fix will hopefully segv here
84
85 gdb_run_cmd
86 gdb_expect {
87 -re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
88 pass "run to breakpoint #2"
89 }
90 -re "$gdb_prompt $" {
91 fail "run to breakpoint #2"
92 }
93 timeout {
94 fail "run to breakpoint #2 (timeout)"
95 }
96 }
97
98 gdb_test "print d.meth ()" \
99 ".*42.*" \
100 "gdb2384"
This page took 0.046617 seconds and 4 git commands to generate.