* gdb.cp/method2.cc: New test.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / method2.exp
1 # Copyright 2007
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # This file is part of the gdb testsuite
19
20 # This tests setting a break in an ambiguous c++ method with
21 # current_language set to c.
22
23 if { [skip_cplus_tests] } { continue }
24
25 set testfile "method2"
26 set srcfile ${testfile}.cc
27 set binfile ${objdir}/${subdir}/${testfile}
28
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
30 untested method2.exp
31 return -1
32 }
33
34 if [get_compiler_info $binfile "c++"] {
35 return -1
36 }
37
38 gdb_exit
39 gdb_start
40 gdb_reinitialize_dir $srcdir/$subdir
41 gdb_load ${binfile}
42
43 if ![runto_main] then {
44 perror "couldn't run to breakpoint"
45 continue
46 }
47
48 proc test_break { lang } {
49 global gdb_prompt
50
51 gdb_test "set lang $lang" \
52 "" \
53 "setting language $lang"
54
55 send_gdb "break A::method\n"
56 gdb_expect {
57 -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::method\\(A\\*\\) at .*\[\r\n\]*.3. A::method\\(int\\) at .*\[\r\n\]*\[\r\n\]*.4. A::method\\(\\) at .*\[\r\n\]*> $" {
58 gdb_test "0" \
59 "canceled" \
60 "breaking in method ($lang)"
61 }
62 -re ".*$gdb_prompt $" { fail "breaking in method ($lang)" }
63 default { fail "breaking in method ($lang) (timeout)" }
64 }
65 }
66
67 test_break "c"
68 test_break "c++"
69
70 gdb_continue_to_end "continue to end"
This page took 0.030819 seconds and 4 git commands to generate.