gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / amd64-entry-value.cc
CommitLineData
8e3b41a9
JK
1/* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2011 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
18static volatile int v;
19
20static void __attribute__((noinline, noclone))
21e (int i, double j)
22{
23 v = 0;
24}
25
26static void __attribute__((noinline, noclone))
27d (int i, double j)
28{
29 i++;
30 j++;
31 e (i, j);
32 e (v, v);
33asm ("breakhere:");
34 e (v, v);
35}
36
e18b2753
JK
37static void __attribute__((noinline, noclone))
38locexpr (int i)
39{
40 i = i;
41asm ("breakhere_locexpr:");
42}
43
111c6489
JK
44static void __attribute__((noinline, noclone))
45c (int i, double j)
46{
47 d (i * 10, j * 10);
48}
49
50static void __attribute__((noinline, noclone))
51a (int i, double j)
52{
53 c (i + 1, j + 1);
54}
55
56static void __attribute__((noinline, noclone))
57b (int i, double j)
58{
59 c (i + 2, j + 2);
60}
61
62static void __attribute__((noinline, noclone))
63amb_z (int i)
64{
65 d (i + 7, i + 7.5);
66}
67
68static void __attribute__((noinline, noclone))
69amb_y (int i)
70{
71 amb_z (i + 6);
72}
73
74static void __attribute__((noinline, noclone))
75amb_x (int i)
76{
77 amb_y (i + 5);
78}
79
80static void __attribute__((noinline, noclone))
81amb (int i)
82{
83 if (i < 0)
84 amb_x (i + 3);
85 else
86 amb_x (i + 4);
87}
88
89static void __attribute__((noinline, noclone))
90amb_b (int i)
91{
92 amb (i + 2);
93}
94
95static void __attribute__((noinline, noclone))
96amb_a (int i)
97{
98 amb_b (i + 1);
99}
100
2d6c5dc2
JK
101static void __attribute__((noinline, noclone)) self (int i);
102
103static void __attribute__((noinline, noclone))
104self2 (int i)
105{
106 self (i);
107}
108
109static void __attribute__((noinline, noclone))
110self (int i)
111{
112 if (i == 200)
113 {
114 /* GCC would inline `self' as `cmovne' without the `self2' indirect. */
115 self2 (i + 1);
116 }
117 else
118 {
119 e (v, v);
120 d (i + 2, i + 2.5);
121 }
122}
123
e18b2753
JK
124static void __attribute__((noinline, noclone))
125stacktest (int r1, int r2, int r3, int r4, int r5, int r6, int s1, int s2,
126 double d1, double d2, double d3, double d4, double d5, double d6,
127 double d7, double d8, double d9, double da)
128{
129 s1 = 3;
130 s2 = 4;
131 d9 = 3.5;
132 da = 4.5;
133 e (v, v);
134asm ("breakhere_stacktest:");
135 e (v, v);
136}
137
138static int __attribute__((noinline, noclone))
139data (void)
140{
141 return 10;
142}
143
144static int __attribute__((noinline, noclone))
145data2 (void)
146{
147 return 20;
148}
149
150static int __attribute__((noinline, noclone))
151different (int val)
152{
153 val++;
154 e (val, val);
155asm ("breakhere_different:");
156 return val;
157}
158
159static int __attribute__((noinline, noclone))
160validity (int lost, int born)
161{
162 lost = data ();
163 e (0, 0.0);
164asm ("breakhere_validity:");
165 return born;
166}
167
168static void __attribute__((noinline, noclone))
169invalid (int inv)
170{
171 e (0, 0.0);
172asm ("breakhere_invalid:");
173}
174
8e3b41a9
JK
175int
176main ()
177{
178 d (30, 30.5);
e18b2753
JK
179 locexpr (30);
180 stacktest (1, 2, 3, 4, 5, 6, 11, 12,
181 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 11.5, 12.5);
182 different (5);
183 validity (5, data ());
184 invalid (data2 ());
185
111c6489
JK
186 if (v)
187 a (1, 1.25);
188 else
189 b (5, 5.25);
190 amb_a (100);
2d6c5dc2 191 self (200);
8e3b41a9
JK
192 return 0;
193}
This page took 0.030901 seconds and 4 git commands to generate.