1 # Copyright 1992-2021 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test callling a method on a variable that has been put in a
19 if { [skip_cplus_tests] } { continue }
21 load_lib "cp-support.exp"
25 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
29 proc test_call_register_class {} {
36 set bp_location [gdb_get_line_number "set breakpoint here"]
37 gdb_breakpoint $bp_location
38 gdb_continue_to_breakpoint "break here"
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.
44 # That message is a PASS, not an XFAIL, because gdb prints an
45 # informative message and declines to do something impossible.
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"
56 test_call_register_class