1# This testcase is part of GDB, the GNU debugger.
2
3# Copyright 2019-2020 Free Software Foundation, Inc.
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18# This testcase exercises evaluation with amd64 calling conventions.
19
20if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
21    verbose "Skipping x86_64 eval test."
22    return
23}
24
25standard_testfile .cc
26
27if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
28	  { debug c++ additional_flags=-std=c++11 }] } {
29    return -1
30}
31
32if ![runto_main] {
33    return -1
34}
35
36gdb_breakpoint [gdb_get_line_number "break-here"]
37gdb_continue_to_breakpoint "break-here"
38
39gdb_test "call foo.return_simple_base(12)" \
40    " = {x = 12}"
41gdb_test "call foo.return_simple_derived(34)" \
42    " = {<SimpleBase> = {x = 34}, <No data fields>}"
43gdb_test "call foo.return_non_trivial_destructor(56)" \
44    " = {<SimpleBase> = {x = 56}, <No data fields>}"
45gdb_test "call foo.return_unaligned(78, 9.25)" \
46    " = {x = 78, y = 9.25}"
47gdb_test "call foo.return_unaligned_in_base(23, 4.5, 67)" \
48    " = {<UnalignedFields> = {x = 23, y = 4.5}, x2 = 67}"
49gdb_test "call foo.return_bitfields(23, 74)" \
50    " = {fld = 23, fld2 = 74}"
51