gdb/testsuite: make runto_main not pass no-message to runto
[binutils-gdb.git] / gdb / testsuite / gdb.cp / call-method-register.exp
1 # Copyright 1992-2021 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 # Test callling a method on a variable that has been put in a
17 # register.
18
19 if { [skip_cplus_tests] } { continue }
20
21 load_lib "cp-support.exp"
22
23 standard_testfile .cc
24
25 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
26 return -1
27 }
28
29 proc test_call_register_class {} {
30 global gdb_prompt
31
32 if ![runto_main] {
33 return
34 }
35
36 set bp_location [gdb_get_line_number "set breakpoint here"]
37 gdb_breakpoint $bp_location
38 gdb_continue_to_breakpoint "break here"
39
40 # This class is so small that an instance of it can fit in a register.
41 # When gdb tries to call a method, it gets embarrassed about taking
42 # the address of a register.
43 #
44 # That message is a PASS, not an XFAIL, because gdb prints an
45 # informative message and declines to do something impossible.
46 #
47 # The method call actually succeeds if the compiler allocates very
48 # small classes in memory instead of registers. If that happens,
49 # it's a FAIL, because the testcase is written in a form such that
50 # it should not happen.
51 gdb_test "print v.method ()" \
52 "Address requested for identifier \"v\" which is in register .*" \
53 "call method on register local"
54 }
55
56 test_call_register_class